MCPcopy Create free account
hub / github.com/IENT/YUView / isRunning

Method isRunning

YUViewLib/src/handler/SingleInstanceHandler.cpp:83–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83bool singleInstanceHandler::isRunning(QString name, QStringList args)
84{
85 DEBUG_SINGLEISNTANCE("singleInstanceHandler::isRunning %s", name.toLatin1().data());
86
87 QLocalSocket socket;
88 socket.connectToServer(name, QLocalSocket::ReadWrite);
89
90 if (socket.waitForConnected())
91 {
92 DEBUG_SINGLEISNTANCE(
93 "singleInstanceHandler::isRunning Connected to other instance. Sending data.");
94
95 QByteArray buffer;
96 for (auto &item : args)
97 buffer.append(QString(item + "\n").toLatin1());
98 socket.write(buffer);
99 socket.waitForBytesWritten();
100 return true;
101 }
102
103 DEBUG_SINGLEISNTANCE("singleInstanceHandler::isRunning we are the first session - %s",
104 socket.errorString().toLatin1().data());
105 return false;
106}
107
108void singleInstanceHandler::listen(QString name)
109{

Callers 5

openStatisticsFileMethod · 0.80
timerEventMethod · 0.80
YUViewApplicationMethod · 0.80

Calls 3

appendMethod · 0.80
dataMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected