diff --git a/linphone-desktop/src/app/App.cpp b/linphone-desktop/src/app/App.cpp index 886886808..442315b30 100644 --- a/linphone-desktop/src/app/App.cpp +++ b/linphone-desktop/src/app/App.cpp @@ -60,7 +60,7 @@ inline bool installLocale (App &app, QTranslator &translator, const QLocale &loc return translator.load(locale, LANGUAGES_PATH) && app.installTranslator(&translator); } -App::App (int &argc, char *argv[]) : SingleApplication(argc, argv) { +App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true) { setApplicationVersion("4.0"); setWindowIcon(QIcon(WINDOW_ICON_PATH)); @@ -143,7 +143,7 @@ void App::initContentApp () { } } - // Register types and create sub-windows. + // Register types. registerTypes(); // Enable notifications. @@ -155,7 +155,9 @@ void App::initContentApp () { core->setParent(this); } + // Create sub windows. createSubWindows(); + // Load main view. qInfo() << "Loading main view..."; m_engine.load(QUrl(QML_VIEW_MAIN_WINDOW)); @@ -177,6 +179,13 @@ void App::initContentApp () { if (m_parser.isSet("selftest")) QTimer::singleShot(300, this, &App::quit); + + QObject::connect( + this, &App::receivedMessage, this, [this](int, QByteArray message) { + if (message == "show") + getMainWindow()->showNormal(); + } + ); } // ----------------------------------------------------------------------------- diff --git a/linphone-desktop/src/main.cpp b/linphone-desktop/src/main.cpp index ea726ff37..7b972ab8e 100644 --- a/linphone-desktop/src/main.cpp +++ b/linphone-desktop/src/main.cpp @@ -32,23 +32,21 @@ using namespace std; int main (int argc, char *argv[]) { Logger::init(); + // Force OpenGLES & shader version 2.0. QCoreApplication::setAttribute(Qt::AA_UseOpenGLES, true); - // Force shader version 2.0. QSurfaceFormat fmt; fmt.setVersion(2, 0); QSurfaceFormat::setDefaultFormat(fmt); - /* - * TODO: Uncomment me in the future! - * Disabled for a moment. - * `QXcbConnection: XCB error` errors on Cinnamon. - * QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - */ - App app(argc, argv); - app.parseArgs(); + + if (app.isSecondary()) { + app.sendMessage("show", 0); + return 0; + } + app.initContentApp(); // Run!