File tree Expand file tree Collapse file tree 3 files changed +24
-19
lines changed
Expand file tree Collapse file tree 3 files changed +24
-19
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ set(RUN_IN_PLACE
8989option (FLAMESHOT_DEBUG_CAPTURE "Enable mode to make debugging easier" OFF )
9090option (USE_MONOCHROME_ICON "Build using monochrome icon as default" OFF )
9191option (GENERATE_TS "Regenerate translation source files" OFF )
92- option (USE_SINGLEAPPLICATION "Use SingleApplication library" ON )
92+ option (USE_KDSINGLEAPPLICATION "Use KDSingleApplication library" ON )
9393option (USE_LAUNCHER_ABSOLUTE_PATH "Use absolute path for the desktop launcher" ON )
9494option (USE_WAYLAND_CLIPBOARD "USE KF Gui Wayland Clipboard" OFF )
9595option (DISABLE_UPDATE_CHECKER "Disable check for updates" OFF )
@@ -123,20 +123,18 @@ enable_sanitizers(project_options)
123123
124124# allow for static analysis options include(cmake/StaticAnalyzers.cmake)
125125
126- if (USE_SINGLEAPPLICATION)
127- set (QAPPLICATION_CLASS
128- QApplication
129- CACHE STRING "Inheritance class for SingleApplication" )
126+ if (USE_KDSINGLEAPPLICATION)
127+ set (KDSingleApplication_EXAMPLES OFF CACHE BOOL "Don't build the examples" )
128+ set (KDSingleApplication_STATIC ON CACHE BOOL "Build static versions of the libraries" )
130129
131130 FetchContent_Declare(
132- singleApplication
133- GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication .git
134- GIT_TAG v3.5.2
131+ kdsingleApplication
132+ GIT_REPOSITORY https://github.com/KDAB/KDSingleApplication .git
133+ GIT_TAG v1.2.0
135134 )
136- FetchContent_MakeAvailable(SingleApplication )
135+ FetchContent_MakeAvailable(KDSingleApplication )
137136endif ()
138137
139-
140138option (BUILD_STATIC_LIBS ON )
141139option (BUILD_SHARED_LIBS OFF )
142140
Original file line number Diff line number Diff line change @@ -214,12 +214,13 @@ target_link_libraries(
214214 QtColorWidgets
215215)
216216
217- if (USE_SINGLEAPPLICATION)
218- message (STATUS "SingleApplication is used!" )
219- add_compile_definitions (USE_SINGLEAPPLICATION=1)
217+ if (USE_KDSINGLEAPPLICATION)
218+ message (STATUS "KDSingleApplication is used!" )
219+ add_compile_definitions (USE_KDSINGLEAPPLICATION=1)
220+
220221 target_link_libraries (
221222 flameshot
222- SingleApplication::SingleApplication
223+ kdsingleapplication
223224 )
224225endif ()
225226
Original file line number Diff line number Diff line change 11// SPDX-License-Identifier: GPL-3.0-or-later
22// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
33
4- #ifdef USE_SINGLEAPPLICATION
5- #include " singleapplication .h"
4+ #ifdef USE_KDSINGLEAPPLICATION
5+ #include " kdsingleapplication .h"
66#endif
77
88#include " abstractlogger.h"
@@ -140,10 +140,16 @@ int main(int argc, char* argv[])
140140
141141 // no arguments, just launch Flameshot
142142 if (argc == 1 ) {
143- #ifdef USE_SINGLEAPPLICATION
144- SingleApplication app (argc, argv);
145- #else
146143 QApplication app (argc, argv);
144+
145+ #ifdef USE_KDSINGLEAPPLICATION
146+ KDSingleApplication kdsa (QStringLiteral (" flameshot" ));
147+
148+ if (!kdsa.isPrimaryInstance ()) {
149+ // AbstractLogger::warning()
150+ // << QStringLiteral("Closing second Flameshot instance!");
151+ return 0 ; // Quit
152+ }
147153#endif
148154
149155 configureApp (true );
You can’t perform that action at this time.
0 commit comments