From a04693e39dec21c95afd147af7022788c0b537ec Mon Sep 17 00:00:00 2001 From: blue Date: Tue, 19 Nov 2024 18:45:11 +0200 Subject: [PATCH] fix: build without KConfig is possible once more --- shared/defines.h | 5 +---- shared/global.cpp | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/shared/defines.h b/shared/defines.h index 227a714..8ead3f6 100644 --- a/shared/defines.h +++ b/shared/defines.h @@ -16,9 +16,6 @@ * along with this program. If not, see . */ -#ifndef SHARED_DEFINES_H -#define SHARED_DEFINES_H +#pragma once #define SHARED_UNUSED(x) (void)(x) - -#endif diff --git a/shared/global.cpp b/shared/global.cpp index efa85cf..362bf81 100644 --- a/shared/global.cpp +++ b/shared/global.cpp @@ -19,6 +19,7 @@ #include "global.h" #include +#include "defines.h" #include "enums.h" #include "ui/models/roster.h" @@ -361,27 +362,32 @@ void Shared::Global::highlightInFileManager(const QString& path) } QIcon Shared::Global::createThemePreview(const QString& path) { +#ifdef WITH_KCONFIG if (supported("colorSchemeTools")) { QIcon* icon = createPreview(path); QIcon localIcon = *icon; deletePreview(icon); return localIcon; - } else { - return QIcon(); } +#endif + + return QIcon(); } QString Shared::Global::getColorSchemeName(const QString& path) { +#ifdef WITH_KCONFIG if (supported("colorSchemeTools")) { QString res; colorSchemeName(path, res); return res; - } else { - return ""; } +#endif + + return ""; } void Shared::Global::setTheme(const QString& path) { +#ifdef WITH_KCONFIG if (supported("colorSchemeTools")) { if (path.toLower() == "system") { QApplication::setPalette(getInstance()->defaultSystemPalette); @@ -391,6 +397,10 @@ void Shared::Global::setTheme(const QString& path) { QApplication::setPalette(pallete); } } +#else + SHARED_UNUSED(path); + qDebug("setTheme() was called, but this version of squawk was compiled without KConfig support, ignoring"); +#endif } void Shared::Global::setStyle(const QString& style) {