diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2014-08-17 05:23:37 +0200 |
---|---|---|
committer | Anne Jan Brouwer <ajbrouwer@totalactivemedia.nl> | 2014-08-17 05:23:37 +0200 |
commit | 9c70b87e1e9736e2cf74162532665d9d7d0c5149 (patch) | |
tree | 7686531a2596bb67321e6bad99c4ff2f442a93ea /singleapplication.h | |
parent | a0b9842a969ed5454d3c502fa03b9a9c036bb862 (diff) |
Highlander code
Diffstat (limited to 'singleapplication.h')
-rw-r--r-- | singleapplication.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/singleapplication.h b/singleapplication.h new file mode 100644 index 00000000..85c5f609 --- /dev/null +++ b/singleapplication.h @@ -0,0 +1,31 @@ +#ifndef SINGLE_APPLICATION_H +#define SINGLE_APPLICATION_H + +#include <QApplication> +#include <QSharedMemory> +#include <QLocalServer> + +class SingleApplication : public QApplication +{ + Q_OBJECT +public: + SingleApplication(int &argc, char *argv[], const QString uniqueKey); + + bool isRunning(); + bool sendMessage(const QString &message); + +public slots: + void receiveMessage(); + +signals: + void messageAvailable(QString message); + +private: + bool _isRunning; + QString _uniqueKey; + QSharedMemory sharedMemory; + QLocalServer *localServer; + + static const int timeout = 1000; +}; +#endif // SINGLE_APPLICATION_H |