Add SingleCoreApplication

This commit is contained in:
Jonas Kvinge
2019-01-11 01:04:13 +01:00
parent 5746ee74cf
commit c94f9073f8
11 changed files with 845 additions and 40 deletions

View File

@@ -72,6 +72,7 @@ link_directories(${TAGLIB_LIBRARY_DIRS})
include_directories(${TAGLIB_INCLUDE_DIRS})
include_directories(${SINGLEAPPLICATION_INCLUDE_DIRS})
include_directories(${SINGLECOREAPPLICATION_INCLUDE_DIRS})
include_directories(${CMAKE_SOURCE_DIR}/ext/libstrawberry-common)
include_directories(${CMAKE_SOURCE_DIR}/ext/libstrawberry-tagreader)
@@ -919,6 +920,7 @@ target_link_libraries(strawberry_lib
${SQLITE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${SINGLEAPPLICATION_LIBRARIES}
${SINGLECOREAPPLICATION_LIBRARIES}
${QOCOA_LIBRARIES}
z
)
@@ -1027,7 +1029,7 @@ if (UNIX AND NOT APPLE)
endif ()
endif ()
add_dependencies(strawberry_lib singleapplication)
add_dependencies(strawberry_lib singleapplication singlecoreapplication)
###############################################################################

View File

@@ -49,6 +49,7 @@
#include <QObject>
#include <QApplication>
#include <QCoreApplication>
#include <QStandardPaths>
#include <QFileDevice>
#include <QIODevice>
@@ -69,6 +70,7 @@
#include "core/logging.h"
#include <singleapplication.h>
#include <singlecoreapplication.h>
#ifdef HAVE_DBUS
# include "core/mpris.h"
@@ -125,7 +127,7 @@ int main(int argc, char* argv[]) {
{
// Only start a core application now so we can check if there's another Strawberry running without needing an X server.
// This MUST be done before parsing the commandline options so QTextCodec gets the right system locale for filenames.
SingleApplication a(argc, argv, true, SingleApplication::Mode::User);
SingleCoreApplication a(argc, argv, true, SingleCoreApplication::Mode::User);
Utilities::CheckPortable();
// Parse commandline options - need to do this before starting the full QApplication so it works without an X server