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:
parent
f11860680b
commit
7d3020cba3
10
src/ipc.cpp
10
src/ipc.cpp
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
#include "src/ipc.h"
|
||||
#include "src/persistence/settings.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#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.
|
||||
* @param name Name to set in IPC event.
|
||||
|
|
|
@ -36,7 +36,6 @@ using IPCEventHandler = std::function<bool(const QByteArray&)>;
|
|||
class IPC : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
IPC(uint32_t profileId);
|
||||
|
||||
protected:
|
||||
static const int EVENT_TIMER_MS = 1000;
|
||||
|
@ -45,10 +44,9 @@ protected:
|
|||
static const int OWNERSHIP_TIMEOUT_S = 5;
|
||||
|
||||
public:
|
||||
IPC(uint32_t profileId);
|
||||
~IPC();
|
||||
|
||||
static IPC& getInstance();
|
||||
|
||||
struct IPCEvent
|
||||
{
|
||||
uint32_t dest;
|
||||
|
|
|
@ -165,7 +165,8 @@ int main(int argc, char* argv[])
|
|||
QObject::tr("profile")));
|
||||
parser.process(a);
|
||||
|
||||
IPC& ipc = IPC::getInstance();
|
||||
uint32_t profileId = Settings::getInstance().getCurrentProfileId();
|
||||
IPC ipc(profileId);
|
||||
|
||||
if (sodium_init() < 0) // For the auto-updater
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user