File indexing completed on 2024-10-06 13:18:49

0001 /*
0002  * SPDX-FileCopyrightText: 2019 Mikhail Zolotukhin <zomial@protonmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #pragma once
0008 
0009 #include <QTemporaryDir>
0010 
0011 #include <KSharedConfig>
0012 
0013 class QString;
0014 class QFont;
0015 
0016 class ConfigValueProvider
0017 {
0018 public:
0019     ConfigValueProvider();
0020 
0021     QString fontName() const;
0022     QString iconThemeName() const;
0023     QString cursorThemeName() const;
0024     int cursorSize() const;
0025     bool iconsOnButtons() const;
0026     bool iconsInMenus() const;
0027     int toolbarStyle() const;
0028     bool scrollbarBehavior() const;
0029     bool preferDarkTheme() const;
0030     QString windowDecorationsButtonsOrder() const;
0031     QStringList windowDecorationsButtonsImages() const;
0032     bool enableAnimations() const;
0033     QMap<QString, QColor> colors() const;
0034 
0035     // The global scale factor, as X11 doesn't support mixed-DPI
0036     // setups. It's useful both for Plasma/X11 sessions and for
0037     // XWayland apps in Plasma/Wayland sessions.
0038     //
0039     // On Wayland sessions returns 1.0 if XWayland client scaling
0040     // is disabled.
0041     double x11GlobalScaleFactor() const;
0042 
0043     // The Force Font DPI setting from the fonts kcm. Returns 0
0044     // if disabled
0045     int fontDpi() const;
0046 
0047 private:
0048     QString fontStyleHelper(const QFont &font) const;
0049     QString windowDecorationButtonsOrderInGtkNotation(const QString &kdeConfigValue) const;
0050     QString currentWindowDecorationPluginPath() const;
0051 
0052     KSharedConfigPtr kdeglobalsConfig;
0053     KSharedConfigPtr fontsConfig;
0054     KSharedConfigPtr inputConfig;
0055     KSharedConfigPtr kwinConfig;
0056 
0057     QTemporaryDir generatedCSDTempPath;
0058 };