diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-06-28 10:21:47 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-06-28 10:21:47 +0200 |
commit | 0d93cf6fea0a5bae6bdf4adc15d5d6fd3306d0e6 (patch) | |
tree | 8055cb02033892be64b16221bd7710f8012bdeed /src/singleapplication.cpp | |
parent | Socket messages are json formatted (diff) | |
download | smolbote-0d93cf6fea0a5bae6bdf4adc15d5d6fd3306d0e6.tar.xz |
Add --session parameter to load a session json
Add Session menu to main window
Diffstat (limited to 'src/singleapplication.cpp')
-rw-r--r-- | src/singleapplication.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/singleapplication.cpp b/src/singleapplication.cpp index 60eaa6d..3c442b4 100644 --- a/src/singleapplication.cpp +++ b/src/singleapplication.cpp @@ -62,6 +62,18 @@ QString SingleApplication::serverName() const return m_localServer->fullServerName(); } +int SingleApplication::sendMessage(const QByteArray &data) +{ + QLocalSocket socket; + socket.connectToServer(LOCALSERVER_KEY); + if(socket.waitForConnected(LOCALSERVER_TIMEOUT)) { + socket.write(data); + socket.waitForBytesWritten(LOCALSERVER_TIMEOUT); + return EXIT_SUCCESS; + } + return EXIT_FAILURE; +} + int SingleApplication::sendMessage(const QJsonObject &message) { QLocalSocket socket; |