diff options
author | Andreas Loibl <andreas@andreas-loibl.de> | 2011-03-17 05:07:10 +0100 |
---|---|---|
committer | Andreas Loibl <andreas@andreas-loibl.de> | 2011-03-17 05:07:10 +0100 |
commit | 00286a5db286e21a766b6af057052dc5d17561ad (patch) | |
tree | 7232dadf6dc3570705c3104fe0c000f480c7a0ee /backend.h | |
download | acritoxinstaller-00286a5db286e21a766b6af057052dc5d17561ad.zip acritoxinstaller-00286a5db286e21a766b6af057052dc5d17561ad.tar.gz |
Initial commit
Diffstat (limited to 'backend.h')
-rw-r--r-- | backend.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/backend.h b/backend.h new file mode 100644 index 0000000..997b580 --- /dev/null +++ b/backend.h @@ -0,0 +1,59 @@ +#include <QProcess> +#include <QQueue> +#include <QMap> +#include <QVector> + +#ifndef BACKEND_H +#define BACKEND_H + +class Backend : public QObject +{ + Q_OBJECT + +public: + static Backend* instance() {if(!_instance) _instance = new Backend(); return(_instance);} + ~Backend(); + void init(); + void runBackend(); + void exec(QString command); + void exitBackend(); + QString encryptPassword(QString password); + QString cleanUsername(const QString &username); + bool isBusy(); + bool flag(QString flag); + void flag(QString flag, bool set); + QString cfg(QString var); + void cfg(QString var, QString value); + +protected: + QProcess* _process; + +private slots: + void slotProcessExited(); + void slotReceiveOutput(); + +private: + static Backend *_instance; + Backend(); + void processOutput(QString line); + void _flag(QString flag, bool set); + void _cfg(QString var, QString value); + void dequeue(); + QMap<QString,QString> data; + QString currentData; + QMap<QString,QString> cfgMap; + QVector<QString> flags; + QQueue<QString> commandQueue; + QString currentCommand; + bool busy; + +signals: + void processExited(); + void receivedDataLine(QString data, QString line); + void receivedProgress(int percent); + void receivedCommand(QString command, QString args); + void finishedCommand(QString command); + void isBusy(bool busy); +}; + +#endif |