History

Fix sending URL to second interface instance

Ryan Huffman committed 10 years ago

Commit fe4c1611 parent c1e114c1 file · +11 −7Browse files

Showing the changes to interface/src/main.cpp (1 of 1 file). Show all

Unified · Split

interface/src/main.cpp+11−7
@@ -78,8 +78,11 @@ int main(int argc, const char* argv[]) { · 77 unmodified lines
78 if (parser.isSet(urlOption)) {78 if (parser.isSet(urlOption)) {
79 QUrl url = QUrl(parser.value(urlOption));79 QUrl url = QUrl(parser.value(urlOption));
80 if (url.isValid() && url.scheme() == HIFI_URL_SCHEME) {80 if (url.isValid() && url.scheme() == HIFI_URL_SCHEME) {
81 qDebug() << "Writing URL to local socket";
81 socket.write(url.toString().toUtf8());82 socket.write(url.toString().toUtf8());
82 socket.waitForBytesWritten(5000);83 if (!socket.waitForBytesWritten(5000)) {
84 qDebug() << "Error writing URL to local socket";
85 }
83 }86 }
84 }87 }
85 88
@@ -95,12 +98,6 @@ int main(int argc, const char* argv[]) { · 9 unmodified lines
95#endif98#endif
96 }99 }
97 100
98 // Setup local server
99 QLocalServer server;
100
101 // We failed to connect to a local server, so we remove any existing servers.
102 server.removeServer(applicationName);
103 server.listen(applicationName);
104 101
105 QElapsedTimer startupTime;102 QElapsedTimer startupTime;
106 startupTime.start();103 startupTime.start();
@@ -125,6 +122,13 @@ int main(int argc, const char* argv[]) { · 18 unmodified lines
125 QSettings::setDefaultFormat(QSettings::IniFormat);122 QSettings::setDefaultFormat(QSettings::IniFormat);
126 Application app(argc, const_cast<char**>(argv), startupTime);123 Application app(argc, const_cast<char**>(argv), startupTime);
127 124
125 // Setup local server
126 QLocalServer server { &app };
127
128 // We failed to connect to a local server, so we remove any existing servers.
129 server.removeServer(applicationName);
130 server.listen(applicationName);
131
128 QObject::connect(&server, &QLocalServer::newConnection, &app, &Application::handleLocalServerConnection);132 QObject::connect(&server, &QLocalServer::newConnection, &app, &Application::handleLocalServerConnection);
129 133
130 QTranslator translator;134 QTranslator translator;

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