summaryrefslogtreecommitdiff
path: root/src/singleinstance.h
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-11-08 22:09:42 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2020-11-08 22:09:42 -0500
commitd7ae42d3775f88d5cd63fa2f8860bd31e18f981e (patch)
treec7b5852b28a1a96be7f76b73df70ba9440cf6ff7 /src/singleinstance.h
parenta5469ae4e0668c36e4bf36bf7395fa25073b0bc6 (diff)
renamed singleinstance.h/cpp to multiprocess.h/cpp
Diffstat (limited to 'src/singleinstance.h')
-rw-r--r--src/singleinstance.h70
1 files changed, 0 insertions, 70 deletions
diff --git a/src/singleinstance.h b/src/singleinstance.h
deleted file mode 100644
index 810e63d2..00000000
--- a/src/singleinstance.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef MODORGANIZER_MOMULTIPROCESS_INCLUDED
-#define MODORGANIZER_MOMULTIPROCESS_INCLUDED
-
-#include <QObject>
-#include <QSharedMemory>
-#include <QLocalServer>
-
-
-/**
- * used to ensure only a single process of Mod Organizer is started and to
- * allow ephemeral processes to send messages to the primary (visible) one.
- * This way, other processes can start a download in the primary one
- **/
-class MOMultiProcess : public QObject
-{
- Q_OBJECT
-
-public:
- // `allowMultiple`: if another process is running, run this one
- // disconnected from the shared memory
- explicit MOMultiProcess(bool allowMultiple, QObject *parent = 0);
-
- /**
- * @return true if this process's job is to forward data to the primary
- * process through shared memory
- **/
- bool ephemeral() const
- {
- return m_Ephemeral;
- }
-
- // returns true if this is not the primary process, but was allowed because
- // of the AllowMultiple flag
- //
- bool secondary() const
- {
- return !m_Ephemeral && !m_OwnsSM;
- }
-
- /**
- * send a message to the primary process. This can be used to transmit download urls
- *
- * @param message message to send
- **/
- void sendMessage(const QString &message);
-
-signals:
-
- /**
- * @brief emitted when an ephemeral process has sent a message (to us)
- *
- * @param message the message we received
- **/
- void messageSent(const QString &message);
-
-public slots:
-
-private slots:
-
- void receiveMessage();
-
-private:
- bool m_Ephemeral;
- bool m_OwnsSM;
- QSharedMemory m_SharedMem;
- QLocalServer m_Server;
-
-};
-
-#endif // MODORGANIZER_MOMULTIPROCESS_INCLUDED