mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-20 03:18:51 +00:00
Add CommandTask
This commit is contained in:
parent
e3bd0612d9
commit
8b293bfe8c
@ -1713,7 +1713,7 @@ QList<QString> CutterCore::getColorThemes()
|
||||
|
||||
RCoreTask *CutterCore::startTask(const QString &cmd)
|
||||
{
|
||||
RCoreTask *task = r_core_task_new (core_, cmd.toLocal8Bit().constData(), nullptr, nullptr);
|
||||
RCoreTask *task = r_core_task_new (core_, true, cmd.toLocal8Bit().constData(), nullptr, nullptr);
|
||||
r_core_task_enqueue(core_, task);
|
||||
return task;
|
||||
}
|
||||
|
@ -167,7 +167,8 @@ SOURCES += \
|
||||
widgets/RegistersWidget.cpp \
|
||||
widgets/BacktraceWidget.cpp \
|
||||
dialogs/OpenFileDialog.cpp \
|
||||
utils/StringsTask.cpp
|
||||
utils/StringsTask.cpp \
|
||||
utils/CommandTask.cpp
|
||||
|
||||
HEADERS += \
|
||||
Cutter.h \
|
||||
@ -249,7 +250,8 @@ HEADERS += \
|
||||
widgets/RegistersWidget.h \
|
||||
widgets/BacktraceWidget.h \
|
||||
dialogs/OpenFileDialog.h \
|
||||
utils/StringsTask.h
|
||||
utils/StringsTask.h \
|
||||
utils/CommandTask.h
|
||||
|
||||
FORMS += \
|
||||
dialogs/AboutDialog.ui \
|
||||
|
13
src/utils/CommandTask.cpp
Normal file
13
src/utils/CommandTask.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
#include "CommandTask.h"
|
||||
|
||||
CommandTask::CommandTask(const QString &cmd)
|
||||
: cmd(cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void CommandTask::runTask()
|
||||
{
|
||||
auto res = Core()->cmdTask(cmd);
|
||||
emit finished(res);
|
||||
}
|
27
src/utils/CommandTask.h
Normal file
27
src/utils/CommandTask.h
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
#ifndef COMMANDTASK_H
|
||||
#define COMMANDTASK_H
|
||||
|
||||
#include "utils/AsyncTask.h"
|
||||
#include "Cutter.h"
|
||||
|
||||
class CommandTask : public AsyncTask
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CommandTask(const QString &cmd);
|
||||
|
||||
QString getTitle() override { return tr("Running Command"); }
|
||||
|
||||
signals:
|
||||
void finished(const QString &result);
|
||||
|
||||
protected:
|
||||
void runTask() override;
|
||||
|
||||
private:
|
||||
QString cmd;
|
||||
};
|
||||
|
||||
#endif //COMMANDTASK_H
|
Loading…
Reference in New Issue
Block a user