QtPass 1.7.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
singleapplication.h
1// SPDX-FileCopyrightText: 2014 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
3#ifndef SRC_SINGLEAPPLICATION_H_
4#define SRC_SINGLEAPPLICATION_H_
5
6#include <QApplication>
7#include <QLocalServer>
8#include <QSharedMemory>
9
17class SingleApplication : public QApplication {
18 Q_OBJECT
19
20public:
27 SingleApplication(int &argc, char *argv[], QString uniqueKey);
32 auto isRunning() -> bool;
38 auto sendMessage(const QString &message) -> bool;
39
40public slots:
45
46signals:
51 void messageAvailable(const QString &message);
52
53private:
54 bool _isRunning;
55 QString _uniqueKey;
56 QSharedMemory sharedMemory;
57 QScopedPointer<QLocalServer> localServer;
58
59 static const int timeout = 1000;
60};
61
62#endif // SRC_SINGLEAPPLICATION_H_
void receiveMessage()
Slot invoked when an incoming IPC message arrives.
SingleApplication(int &argc, char *argv[], QString uniqueKey)
Construct a SingleApplication with a unique instance key.
auto isRunning() -> bool
Query whether another instance is already running.
void messageAvailable(const QString &message)
messageAvailable notification from commandline
auto sendMessage(const QString &message) -> bool
Send a message to the running instance.