3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-26 19:55:27 +02:00

Fix sending URL to second interface instance

This commit is contained in:
Ryan Huffman 2016-01-14 12:44:52 -08:00
parent c1e114c576
commit fe4c161cb6

View file

@ -78,8 +78,11 @@ int main(int argc, const char* argv[]) {
if (parser.isSet(urlOption)) {
QUrl url = QUrl(parser.value(urlOption));
if (url.isValid() && url.scheme() == HIFI_URL_SCHEME) {
qDebug() << "Writing URL to local socket";
socket.write(url.toString().toUtf8());
socket.waitForBytesWritten(5000);
if (!socket.waitForBytesWritten(5000)) {
qDebug() << "Error writing URL to local socket";
}
}
}
@ -95,12 +98,6 @@ int main(int argc, const char* argv[]) {
#endif
}
// Setup local server
QLocalServer server;
// We failed to connect to a local server, so we remove any existing servers.
server.removeServer(applicationName);
server.listen(applicationName);
QElapsedTimer startupTime;
startupTime.start();
@ -125,6 +122,13 @@ int main(int argc, const char* argv[]) {
QSettings::setDefaultFormat(QSettings::IniFormat);
Application app(argc, const_cast<char**>(argv), startupTime);
// Setup local server
QLocalServer server { &app };
// We failed to connect to a local server, so we remove any existing servers.
server.removeServer(applicationName);
server.listen(applicationName);
QObject::connect(&server, &QLocalServer::newConnection, &app, &Application::handleLocalServerConnection);
QTranslator translator;