QtPass 1.4.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
executor.h
Go to the documentation of this file.
1#ifndef EXECUTOR_H
2#define EXECUTOR_H
3
4#include <QObject>
5#include <QProcess>
6#include <QQueue>
7
12class Executor : public QObject {
13 Q_OBJECT
14
19 struct execQueueItem {
23 int id;
27 QString app;
31 QStringList args;
35 QString input;
39 bool readStdout;
45 bool readStderr;
50 QString workingDir;
51 };
52
53 QQueue<execQueueItem> m_execQueue;
54 QProcess m_process;
55 bool running;
56 void executeNext();
57
58public:
59 explicit Executor(QObject *parent = 0);
60
61 void execute(int id, const QString &app, const QStringList &args,
62 bool readStdout, bool readStderr = true);
63
64 void execute(int id, const QString &workDir, const QString &app,
65 const QStringList &args, bool readStdout,
66 bool readStderr = true);
67
68 void execute(int id, const QString &app, const QStringList &args,
69 QString input = QString(), bool readStdout = false,
70 bool readStderr = true);
71
72 void execute(int id, const QString &workDir, const QString &app,
73 const QStringList &args, QString input = QString(),
74 bool readStdout = false, bool readStderr = true);
75
76 static int executeBlocking(QString app, const QStringList &args,
77 QString input = QString(),
78 QString *process_out = Q_NULLPTR,
79 QString *process_err = Q_NULLPTR);
80
81 static int executeBlocking(QString app, const QStringList &args,
82 QString *process_out,
83 QString *process_err = Q_NULLPTR);
84
85 void setEnvironment(const QStringList &env);
86
87 int cancelNext();
88private slots:
89 void finished(int exitCode, QProcess::ExitStatus exitStatus);
90signals:
99 void finished(int id, int exitCode, const QString &output,
100 const QString &errout);
104 void starting();
114 void error(int id, int exitCode, const QString &output,
115 const QString &errout);
116};
117
118#endif // EXECUTOR_H
Executes external commands for handleing password, git and other data.
Definition: executor.h:12
static int executeBlocking(QString app, const QStringList &args, QString input=QString(), QString *process_out=Q_NULLPTR, QString *process_err=Q_NULLPTR)
Executor::executeBlocking blocking version of the executor, takes input and presents it as stdin.
Definition: executor.cpp:171
void execute(int id, const QString &app, const QStringList &args, bool readStdout, bool readStderr=true)
Executor::execute execute an app.
Definition: executor.cpp:68
int cancelNext()
Executor::cancelNext cancels execution of first process in queue if it's not already running.
Definition: executor.cpp:233
void error(int id, int exitCode, const QString &output, const QString &errout)
error signal that is emited when process finishes with an error
void setEnvironment(const QStringList &env)
Executor::setEnvironment set environment variables for executor processes.
Definition: executor.cpp:223
void finished(int id, int exitCode, const QString &output, const QString &errout)
finished signal that is emited when process finishes
void starting()
starting signal that is emited when process starts