cmake: Modernize (and fix) deployment on macOS
[quassel.git] / src / main / monoapplication.cpp
index 068ec71..293c165 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2018 by the Quassel Project                        *
+ *   Copyright (C) 2005-2020 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  ***************************************************************************/
 
 #include "monoapplication.h"
-#include "coreapplication.h"
+
 #include "client.h"
 #include "core.h"
+#include "coreapplication.h"
 #include "internalpeer.h"
-#include "logmessage.h"
 #include "qtui.h"
 
 class InternalPeer;
 
-MonolithicApplication::MonolithicApplication(int &argc, char **argv)
+MonolithicApplication::MonolithicApplication(int& argc, char** argv)
     : QtUiApplication(argc, argv)
 {
+#if QT_VERSION >= 0x050700
+    QGuiApplication::setDesktopFileName(Quassel::buildInfo().applicationName);
+#endif
 }
 
-
 void MonolithicApplication::init()
 {
     QtUiApplication::init();
 
-    connect(Client::coreConnection(), SIGNAL(connectToInternalCore(QPointer<InternalPeer>)), this, SLOT(onConnectionRequest(QPointer<InternalPeer>)));
+    connect(Client::coreConnection(), &CoreConnection::connectToInternalCore, this, &MonolithicApplication::onConnectionRequest);
 
     // If port is set, start internal core directly so external clients can connect
     // This is useful in case the mono client re-gains remote connection capability,
@@ -48,21 +50,19 @@ void MonolithicApplication::init()
     }
 }
 
-
 Quassel::QuitHandler MonolithicApplication::quitHandler()
 {
     return [this]() {
-        quInfo() << "Client shutting down...";
-        connect(_client.get(), SIGNAL(destroyed()), this, SLOT(onClientDestroyed()));
+        qInfo() << "Client shutting down...";
+        connect(_client.get(), &QObject::destroyed, this, &MonolithicApplication::onClientDestroyed);
         _client.release()->deleteLater();
     };
 }
 
-
 void MonolithicApplication::onClientDestroyed()
 {
     if (_core) {
-        connect(_core, SIGNAL(shutdownComplete()), this, SLOT(onCoreShutdown()));
+        connect(_core, &Core::shutdownComplete, this, &MonolithicApplication::onCoreShutdown);
         _core->shutdown();
     }
     else {
@@ -70,11 +70,10 @@ void MonolithicApplication::onClientDestroyed()
     }
 }
 
-
 void MonolithicApplication::onCoreShutdown()
 {
     if (_core) {
-        connect(_core, SIGNAL(destroyed()), QCoreApplication::instance(), SLOT(quit()));
+        connect(_core, &QObject::destroyed, QCoreApplication::instance(), &QCoreApplication::quit);
         _coreThread.quit();
         _coreThread.wait();
     }
@@ -83,7 +82,6 @@ void MonolithicApplication::onCoreShutdown()
     }
 }
 
-
 void MonolithicApplication::startInternalCore()
 {
     if (_core) {
@@ -94,19 +92,18 @@ void MonolithicApplication::startInternalCore()
     // Start internal core in a separate thread, so it doesn't block the UI
     _core = new Core{};
     _core->moveToThread(&_coreThread);
-    connect(&_coreThread, SIGNAL(started()), _core, SLOT(initAsync()));
-    connect(&_coreThread, SIGNAL(finished()), _core, SLOT(deleteLater()));
+    connect(&_coreThread, &QThread::started, _core.data(), &Core::initAsync);
+    connect(&_coreThread, &QThread::finished, _core.data(), &QObject::deleteLater);
 
-    connect(this, SIGNAL(connectInternalPeer(QPointer<InternalPeer>)), _core, SLOT(connectInternalPeer(QPointer<InternalPeer>)));
-    connect(_core, SIGNAL(sessionState(Protocol::SessionState)), Client::coreConnection(), SLOT(internalSessionStateReceived(Protocol::SessionState)));
+    connect(this, &MonolithicApplication::connectInternalPeer, _core, &Core::connectInternalPeer);
+    connect(_core, &Core::sessionStateReceived, Client::coreConnection(), &CoreConnection::internalSessionStateReceived);
 
-    connect(_core, SIGNAL(dbUpgradeInProgress(bool)), Client::instance(), SLOT(onDbUpgradeInProgress(bool)));
-    connect(_core, SIGNAL(exitRequested(int,QString)), Client::instance(), SLOT(onExitRequested(int,QString)));
+    connect(_core.data(), &Core::dbUpgradeInProgress, Client::instance(), &Client::onDbUpgradeInProgress);
+    connect(_core.data(), &Core::exitRequested, Client::instance(), &Client::onExitRequested);
 
     _coreThread.start();
 }
 
-
 void MonolithicApplication::onConnectionRequest(QPointer<InternalPeer> peer)
 {
     if (!_core) {