Your Stack Manager is now a Server Console
Showing the changes to interface/src/Application.cpp (1 of 151 files). Show all
Unified · Split
| @@ -36,6 +36,9 @@ · 35 unmodified lines | |||
| 36 | #include <QtGui/QMouseEvent> | 36 | #include <QtGui/QMouseEvent> |
| 37 | #include <QtGui/QDesktopServices> | 37 | #include <QtGui/QDesktopServices> |
| 38 | 38 | ||
| 39 | #include <QtNetwork/QLocalSocket> | ||
| 40 | #include <QtNetwork/QLocalServer> | ||
| 41 | |||
| 39 | #include <QtQml/QQmlContext> | 42 | #include <QtQml/QQmlContext> |
| 40 | #include <QtQml/QQmlEngine> | 43 | #include <QtQml/QQmlEngine> |
| 41 | #include <QtQuick/QQuickWindow> | 44 | #include <QtQuick/QQuickWindow> |
| @@ -57,7 +60,7 @@ · 15 unmodified lines | |||
| 57 | #include <ResourceScriptingInterface.h> | 60 | #include <ResourceScriptingInterface.h> |
| 58 | #include <AccountManager.h> | 61 | #include <AccountManager.h> |
| 59 | #include <AddressManager.h> | 62 | #include <AddressManager.h> |
| 60 | #include <ApplicationVersion.h> | 63 | #include <BuildInfo.h> |
| 61 | #include <AssetClient.h> | 64 | #include <AssetClient.h> |
| 62 | #include <AssetUpload.h> | 65 | #include <AssetUpload.h> |
| 63 | #include <AutoUpdater.h> | 66 | #include <AutoUpdater.h> |
| @@ -302,7 +305,7 @@ bool setupEssentials(int& argc, char** argv) { · 238 unmodified lines | |||
| 302 | listenPort = atoi(portStr); | 305 | listenPort = atoi(portStr); |
| 303 | } | 306 | } |
| 304 | // Set build version | 307 | // Set build version |
| 305 | QCoreApplication::setApplicationVersion(BUILD_VERSION); | 308 | QCoreApplication::setApplicationVersion(BuildInfo::VERSION); |
| 306 | 309 | ||
| 307 | Setting::preInit(); | 310 | Setting::preInit(); |
| 308 | 311 | ||
| @@ -5175,3 +5178,30 @@ void Application::setActiveDisplayPlugin(const QString& pluginName) { · 4866 unmodified lines | |||
| 5175 | } | 5178 | } |
| 5176 | updateDisplayMode(); | 5179 | updateDisplayMode(); |
| 5177 | } | 5180 | } |
| 5181 | |||
| 5182 | void Application::handleLocalServerConnection() { | ||
| 5183 | auto server = qobject_cast<QLocalServer*>(sender()); | ||
| 5184 | |||
| 5185 | qDebug() << "Got connection on local server from additional instance - waiting for parameters"; | ||
| 5186 | |||
| 5187 | auto socket = server->nextPendingConnection(); | ||
| 5188 | |||
| 5189 | connect(socket, &QLocalSocket::readyRead, this, &Application::readArgumentsFromLocalSocket); | ||
| 5190 | |||
| 5191 | qApp->getWindow()->raise(); | ||
| 5192 | qApp->getWindow()->activateWindow(); | ||
| 5193 | } | ||
| 5194 | |||
| 5195 | void Application::readArgumentsFromLocalSocket() { | ||
| 5196 | auto socket = qobject_cast<QLocalSocket*>(sender()); | ||
| 5197 | |||
| 5198 | auto message = socket->readAll(); | ||
| 5199 | socket->deleteLater(); | ||
| 5200 | |||
| 5201 | qDebug() << "Read from connection: " << message; | ||
| 5202 | |||
| 5203 | // If we received a message, try to open it as a URL | ||
| 5204 | if (message.length() > 0) { | ||
| 5205 | qApp->openUrl(QString::fromUtf8(message)); | ||
| 5206 | } | ||
| 5207 | } | ||