1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(IPC): Remove IPC singlton

This commit is contained in:
Diadlo 2017-04-17 23:44:58 +03:00
parent f11860680b
commit 7d3020cba3
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
3 changed files with 3 additions and 14 deletions

View File

@ -18,7 +18,6 @@
*/ */
#include "src/ipc.h" #include "src/ipc.h"
#include "src/persistence/settings.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
#include <QThread> #include <QThread>
@ -91,15 +90,6 @@ IPC::~IPC()
} }
} }
/**
* @brief Returns the singleton instance.
*/
IPC& IPC::getInstance()
{
static IPC instance(Settings::getInstance().getCurrentProfileId());
return instance;
}
/** /**
* @brief Post IPC event. * @brief Post IPC event.
* @param name Name to set in IPC event. * @param name Name to set in IPC event.

View File

@ -36,7 +36,6 @@ using IPCEventHandler = std::function<bool(const QByteArray&)>;
class IPC : public QObject class IPC : public QObject
{ {
Q_OBJECT Q_OBJECT
IPC(uint32_t profileId);
protected: protected:
static const int EVENT_TIMER_MS = 1000; static const int EVENT_TIMER_MS = 1000;
@ -45,10 +44,9 @@ protected:
static const int OWNERSHIP_TIMEOUT_S = 5; static const int OWNERSHIP_TIMEOUT_S = 5;
public: public:
IPC(uint32_t profileId);
~IPC(); ~IPC();
static IPC& getInstance();
struct IPCEvent struct IPCEvent
{ {
uint32_t dest; uint32_t dest;

View File

@ -165,7 +165,8 @@ int main(int argc, char* argv[])
QObject::tr("profile"))); QObject::tr("profile")));
parser.process(a); parser.process(a);
IPC& ipc = IPC::getInstance(); uint32_t profileId = Settings::getInstance().getCurrentProfileId();
IPC ipc(profileId);
if (sodium_init() < 0) // For the auto-updater if (sodium_init() < 0) // For the auto-updater
{ {