+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
23 #ifndef SINGLE_APPLICATION_H
+
24 #define SINGLE_APPLICATION_H
+
+
26 #include <QtCore/QtGlobal>
+
27 #include <QtNetwork/QLocalSocket>
+
+
29 #ifndef QAPPLICATION_CLASS
+
30 #define QAPPLICATION_CLASS QCoreApplication
+
+
+
33 #include QT_STRINGIFY(QAPPLICATION_CLASS)
+
+
35 class SingleApplicationPrivate;
+
+
+
+
+
+
46 using app_t = QAPPLICATION_CLASS;
+
+
+
+
+
+
+
+
+
+
80 Q_DECLARE_FLAGS(Options,
Mode)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
178 SingleApplicationPrivate *d_ptr;
+
+
+
+
+
183 Q_DECLARE_OPERATORS_FOR_FLAGS(SingleApplication::Options)
+
+
+
Handles multiple instances of the same Application.
Definition: singleapplication.h:43
+
QString currentUser() const
Returns the username of the current user.
+
void receivedMessage(quint32 instanceId, QByteArray message)
Triggered whenever there is a message received from a secondary instance.
+
void instanceStarted()
Triggered whenever a new instance had been started, except for secondary instances if the Mode::Secon...
+
SendMode
Mode of operation of sendMessage.
Definition: singleapplication.h:144
+
@ BlockUntilPrimaryExit
Definition: singleapplication.h:146
+
bool isSecondary() const
Checks if the instance is a secondary instance.
+
bool isPrimary() const
Checks if the instance is primary instance.
+
QStringList userData() const
Get the set user data.
+
qint64 primaryPid() const
Returns the process ID (PID) of the primary instance.
+
QString primaryUser() const
Returns the username of the user running the primary instance.
+
quint32 instanceId() const
Returns a unique identifier for the current instance.
+
bool sendMessage(const QByteArray &message, int timeout=100, SendMode sendMode=NonBlocking)
Sends a message to the primary instance.
+
Mode
Mode of operation of SingleApplication. Whether the block should be user-wide or system-wide and whet...
Definition: singleapplication.h:58
+
@ User
Definition: singleapplication.h:62
+
@ System
Definition: singleapplication.h:66
+
@ ExcludeAppVersion
Definition: singleapplication.h:74
+
@ ExcludeAppPath
Definition: singleapplication.h:78
+
@ SecondaryNotification
Definition: singleapplication.h:70
+