]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
macos: disable SingleApplication
authortobtoht <tob@featherwallet.org>
Sun, 22 Sep 2024 11:37:06 +0000 (13:37 +0200)
committertobtoht <tob@featherwallet.org>
Sun, 22 Sep 2024 11:57:43 +0000 (13:57 +0200)
src/CMakeLists.txt
src/main.cpp

index ae06ddb8d8c4a022dce011a3be3cba8c5f139902..9234e06050e70d9076cbe6a20c717eb73de1dd5e 100644 (file)
@@ -20,8 +20,10 @@ endif()
 
 find_package(Qt6 REQUIRED COMPONENTS ${QT_COMPONENTS})
 
-set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
-add_subdirectory(third-party/singleapplication)
+if (NOT APPLE)
+    set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
+    add_subdirectory(third-party/singleapplication)
+endif()
 
 if (CHECK_UPDATES)
     add_subdirectory(openpgp)
@@ -272,13 +274,16 @@ target_link_libraries(feather PRIVATE
         Threads::Threads
         ${QRENCODE_LIBRARY}
         ${POLYSEED_LIBRARY}
-        SingleApplication::SingleApplication
         ${ICU_LIBRARIES}
         ${LIBZIP_LIBRARIES}
         ${ZLIB_LIBRARIES}
         ${BCUR_LIBRARY}
 )
 
+if(NOT APPLE)
+    target_link_libraries(feather PRIVATE SingleApplication::SingleApplication)
+endif()
+
 if(CHECK_UPDATES)
     target_link_libraries(feather PRIVATE openpgp)
 endif()
index 8d1e406599d16569cee4dc174ca6ba531a58b1b0..43a9e7207efb6b4d750bc4d89e7b63d7110f5e10 100644 (file)
@@ -5,7 +5,9 @@
 #include <QApplication>
 #include <QtCore>
 #include <QtGui>
+#if !defined(Q_OS_MAC)
 #include <singleapplication.h>
+#endif
 
 #include "config-feather.h"
 #include "constants.h"
@@ -64,6 +66,8 @@ void signal_handler(int signum) {
 
 int main(int argc, char *argv[])
 {
+    qDebug() << "Reached main";
+
     Q_INIT_RESOURCE(assets);
 
 #if defined(Q_OS_LINUX) && defined(STACK_TRACE)
@@ -131,12 +135,18 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) {
     QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round);
 #endif
 
+    qDebug() << "Setting up QApplication";
+
+#if defined(Q_OS_MAC)
+    // https://github.com/itay-grudev/SingleApplication/issues/136#issuecomment-1925441403
+    QApplication app(argc, argv);
+#else
     SingleApplication app(argc, argv);
+#endif
 
     QApplication::setQuitOnLastWindowClosed(false);
     QApplication::setApplicationName("FeatherWallet");
 
-
     // Setup config directories
     QString configDir = Config::defaultConfigDir().path();
     QString config_dir_tor = QString("%1/%2").arg(configDir, "tor");
@@ -238,9 +248,11 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) {
     auto wm = windowManager();
     wm->setEventFilter(&filter);
 
+#if !defined(Q_OS_MAC)
     QObject::connect(&app, &SingleApplication::instanceStarted, [&wm]() {
         wm->raise();
     });
+#endif
 
     return QApplication::exec();
 }