QtPass  1.2.0
Multi-platform GUI for pass, the standard unix password manager.
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 
12 class 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 
58 public:
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  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  int executeBlocking(QString app, const QStringList &args,
82  QString *process_out, QString *process_err = Q_NULLPTR);
83 
84  void setEnvironment(const QStringList &env);
85 
86  int cancelNext();
87 private slots:
88  void finished(int exitCode, QProcess::ExitStatus exitStatus);
89 signals:
98  void finished(int id, int exitCode, const QString &output,
99  const QString &errout);
103  void starting();
113  void error(int id, int exitCode, const QString &output,
114  const QString &errout);
115 };
116 
117 #endif // EXECUTOR_H
int cancelNext()
Executor::cancelNext cancels execution of first process in queue if it&#39;s not already running...
Definition: executor.cpp:181
void setEnvironment(const QStringList &env)
Executor::setEnvironment set environment variables for executor processes.
Definition: executor.cpp:171
Executes external commands for handleing password, git and other data.
Definition: executor.h:12
void execute(int id, const QString &app, const QStringList &args, bool readStdout, bool readStderr=true)
Executor::execute execute an app.
Definition: executor.cpp:50
void starting()
starting signal that is emited when process starts
Executor(QObject *parent=0)
Executor::Executor executes external applications.
Definition: executor.cpp:11
void error(int id, int exitCode, const QString &output, const QString &errout)
error signal that is emited when process finishes with an error
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:124