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 | 36 | #include <QtGui/QMouseEvent> |
| 37 | 37 | #include <QtGui/QDesktopServices> |
| 38 | 38 | |
| 39 | +#include <QtNetwork/QLocalSocket> | |
| 40 | +#include <QtNetwork/QLocalServer> | |
| 41 | + | |
| 39 | 42 | #include <QtQml/QQmlContext> |
| 40 | 43 | #include <QtQml/QQmlEngine> |
| 41 | 44 | #include <QtQuick/QQuickWindow> |
| @@ -57,7 +60,7 @@ · 15 unmodified lines | ||
| 57 | 60 | #include <ResourceScriptingInterface.h> |
| 58 | 61 | #include <AccountManager.h> |
| 59 | 62 | #include <AddressManager.h> |
| 60 | −#include <ApplicationVersion.h> | |
| 63 | +#include <BuildInfo.h> | |
| 61 | 64 | #include <AssetClient.h> |
| 62 | 65 | #include <AssetUpload.h> |
| 63 | 66 | #include <AutoUpdater.h> |
| @@ -302,7 +305,7 @@ bool setupEssentials(int& argc, char** argv) { · 238 unmodified lines | ||
| 302 | 305 | listenPort = atoi(portStr); |
| 303 | 306 | } |
| 304 | 307 | // Set build version |
| 305 | − QCoreApplication::setApplicationVersion(BUILD_VERSION); | |
| 308 | + QCoreApplication::setApplicationVersion(BuildInfo::VERSION); | |
| 306 | 309 | |
| 307 | 310 | Setting::preInit(); |
| 308 | 311 | |
| @@ -5175,3 +5178,30 @@ void Application::setActiveDisplayPlugin(const QString& pluginName) { · 4866 unmodified lines | ||
| 5175 | 5178 | } |
| 5176 | 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 | +} | |