You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.5 KiB
97 lines
3.5 KiB
3 years ago
|
diff -ruN a/CMakeLists.txt b/CMakeLists.txt
|
||
|
--- a/CMakeLists.txt 2021-04-28 20:19:06.995353847 +0300
|
||
|
+++ b/CMakeLists.txt 2021-04-28 21:06:25.811315173 +0300
|
||
|
@@ -86,7 +86,17 @@
|
||
|
set(QAPPLICATION_CLASS
|
||
|
QApplication
|
||
|
CACHE STRING "Inheritance class for SingleApplication")
|
||
|
-add_subdirectory(external/singleapplication)
|
||
|
+
|
||
|
+if(USE_EXTERNAL_SINGLEAPPLICATION)
|
||
|
+ # look for external QtSingleApplication
|
||
|
+ # package dev-qt/qtsingleapplication provides no symlink to current version
|
||
|
+ set(qtsingleapplication_libs libQt5Solutions_SingleApplication-2.6 Qt5Solutions_SingleApplication-2.6)
|
||
|
+ find_library(QTSINGLEAPPLICATION_LIBRARY NAMES ${qtsingleapplication_libs})
|
||
|
+ message(STATUS "Using external SingleApplication library")
|
||
|
+else()
|
||
|
+ add_subdirectory(external/singleapplication)
|
||
|
+ set(QTSINGLEAPPLICATION_LIBRARY SingleApplication::SingleApplication)
|
||
|
+endif()
|
||
|
|
||
|
if(USE_EXTERNAL_SPDLOG)
|
||
|
find_package(spdlog REQUIRED)
|
||
|
diff -ruN a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||
|
--- a/src/CMakeLists.txt 2021-04-28 20:19:07.048354525 +0300
|
||
|
+++ b/src/CMakeLists.txt 2021-04-28 21:07:44.651559479 +0300
|
||
|
@@ -107,7 +107,7 @@
|
||
|
|
||
|
target_sources(
|
||
|
flameshot
|
||
|
- PRIVATE # ${CMAKE_CURRENT_SOURCE_DIR}/../external/singleapplication/singleapplication.cpp
|
||
|
+ PRIVATE
|
||
|
${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/src/color_utils.cpp
|
||
|
${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/src/color_wheel.cpp
|
||
|
${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/include/color_wheel.hpp
|
||
|
@@ -120,7 +120,6 @@
|
||
|
flameshot
|
||
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
|
||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
|
||
|
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../external/singleapplication/>
|
||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/include>
|
||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../dbus/>
|
||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cli>
|
||
|
@@ -153,6 +152,15 @@
|
||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/widgets/capture>
|
||
|
$<INSTALL_INTERFACE:include/mylib>)
|
||
|
|
||
|
+if (USE_EXTERNAL_SINGLEAPPLICATION)
|
||
|
+ add_compile_definitions(USE_EXTERNAL_SINGLEAPPLICATION=1)
|
||
|
+else ()
|
||
|
+ target_include_directories(
|
||
|
+ flameshot
|
||
|
+ PUBLIC
|
||
|
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../external/singleapplication>)
|
||
|
+endif()
|
||
|
+
|
||
|
target_link_libraries(
|
||
|
flameshot
|
||
|
project_warnings
|
||
|
@@ -161,7 +169,7 @@
|
||
|
Qt5::DBus
|
||
|
Qt5::Network
|
||
|
Qt5::Widgets
|
||
|
- SingleApplication::SingleApplication
|
||
|
+ ${QTSINGLEAPPLICATION_LIBRARY}
|
||
|
spdlog::spdlog
|
||
|
)
|
||
|
|
||
|
diff -ruN a/src/main.cpp b/src/main.cpp
|
||
|
--- a/src/main.cpp 2021-04-28 20:19:07.051354563 +0300
|
||
|
+++ b/src/main.cpp 2021-04-28 20:59:32.921808263 +0300
|
||
|
@@ -1,7 +1,12 @@
|
||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||
|
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
|
||
|
|
||
|
-#include "singleapplication.h"
|
||
|
+#ifndef USE_EXTERNAL_SINGLEAPPLICATION
|
||
|
+ #include "singleapplication.h"
|
||
|
+#else
|
||
|
+ #include "QtSolutions/qtsingleapplication.h"
|
||
|
+#endif
|
||
|
+
|
||
|
#include "src/cli/commandlineparser.h"
|
||
|
#include "src/config/styleoverride.h"
|
||
|
#include "src/core/capturerequest.h"
|
||
|
@@ -65,7 +70,11 @@
|
||
|
|
||
|
// no arguments, just launch Flameshot
|
||
|
if (argc == 1) {
|
||
|
+#ifndef USE_EXTERNAL_SINGLEAPPLICATION
|
||
|
SingleApplication app(argc, argv);
|
||
|
+#else
|
||
|
+ QtSingleApplication app(argc, argv);
|
||
|
+#endif
|
||
|
QApplication::setStyle(new StyleOverride);
|
||
|
|
||
|
QTranslator translator, qtTranslator;
|