History

Merge pull request #6870 from birarda/console

Your Stack Manager is now a Server Console

Leonardo Murillo committed 10 years ago

Commit 098b7a42 parents 7387d6e 4cfe394151 files · +7017 −3257Browse files

Showing the changes to interface/src/Application.cpp (1 of 151 files). Show all

Unified · Split

interface/src/Application.cpp+32−2
@@ -36,6 +36,9 @@ · 35 unmodified lines
3636 #include <QtGui/QMouseEvent>
3737 #include <QtGui/QDesktopServices>
3838
39+#include <QtNetwork/QLocalSocket>
40+#include <QtNetwork/QLocalServer>
41+
3942 #include <QtQml/QQmlContext>
4043 #include <QtQml/QQmlEngine>
4144 #include <QtQuick/QQuickWindow>
@@ -57,7 +60,7 @@ · 15 unmodified lines
5760 #include <ResourceScriptingInterface.h>
5861 #include <AccountManager.h>
5962 #include <AddressManager.h>
60−#include <ApplicationVersion.h>
63+#include <BuildInfo.h>
6164 #include <AssetClient.h>
6265 #include <AssetUpload.h>
6366 #include <AutoUpdater.h>
@@ -302,7 +305,7 @@ bool setupEssentials(int& argc, char** argv) { · 238 unmodified lines
302305 listenPort = atoi(portStr);
303306 }
304307 // Set build version
305− QCoreApplication::setApplicationVersion(BUILD_VERSION);
308+ QCoreApplication::setApplicationVersion(BuildInfo::VERSION);
306309
307310 Setting::preInit();
308311
@@ -5175,3 +5178,30 @@ void Application::setActiveDisplayPlugin(const QString& pluginName) { · 4866 unmodified lines
51755178 }
51765179 updateDisplayMode();
51775180 }
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+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t