25#include <QCoreApplication>
26#include <QtCore/QtGlobal>
27#include <QtNetwork/QLocalSocket>
29class SingleInstancePrivate;
57 Q_DECLARE_FLAGS(Options,
Mode)
142 SingleInstancePrivate* d_ptr;
149Q_DECLARE_OPERATORS_FOR_FLAGS(SingleInstance::Options)
The SingleInstance class handles multiple instances.
Definition SingleInstance.h:35
QString currentUser() const
Gets the username of the current user.
void receivedMessage(quint32 instanceId, QByteArray message)
void initialize(bool allowSecondary=false, Options options=Mode::User, int timeout=1000, const QString &userData={})
Initializes this instance.
~SingleInstance() override
Destructor.
QStringList userData() const
Get the set user data.
bool isPrimary() const
Gets if the instance is the primary instance.
quint32 instanceId() const
Gets a unique identifier for the current instance.
Mode
Definition SingleInstance.h:50
@ User
Definition SingleInstance.h:51
@ System
Definition SingleInstance.h:52
@ SecondaryNotification
Definition SingleInstance.h:53
@ ExcludeAppPath
Definition SingleInstance.h:55
@ ExcludeAppVersion
Definition SingleInstance.h:54
bool isSecondary() const
Gets if the instance is a secondary instance.
qint64 primaryPid() const
Gets the process ID (PID) of the primary instance.
bool sendMessage(const QByteArray &message, int timeout=100)
Sends a message to the primary instance. Returns true on success.
QString primaryUser() const
Gets the username of the user running the primary instance.