Added qpm Only allow single instance Changed config format (breaking change please delete config file) Added global hotkey functionality Updated build instructions
33 lines
476 B
C++
33 lines
476 B
C++
#ifndef RUNGUARD_H
|
|
#define RUNGUARD_H
|
|
|
|
#include <QObject>
|
|
#include <QSharedMemory>
|
|
#include <QSystemSemaphore>
|
|
|
|
|
|
class RunGuard
|
|
{
|
|
|
|
public:
|
|
RunGuard( const QString& key );
|
|
~RunGuard();
|
|
|
|
bool isAnotherRunning();
|
|
bool tryToRun();
|
|
void release();
|
|
|
|
private:
|
|
const QString key;
|
|
const QString memLockKey;
|
|
const QString sharedmemKey;
|
|
|
|
QSharedMemory sharedMem;
|
|
QSystemSemaphore memLock;
|
|
|
|
Q_DISABLE_COPY( RunGuard )
|
|
};
|
|
|
|
|
|
#endif // RUNGUARD_H
|