diff options
author | Petr Mrázek <peterix@gmail.com> | 2021-11-22 03:55:16 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2021-11-22 03:55:16 +0100 |
commit | b258eac215c791b2a8eed10cecbbf9551c87f0b9 (patch) | |
tree | 1ae72f62d344f6a9c982b9dc5d598d32fc742acc /launcher/ui/themes/SystemTheme.cpp | |
parent | 5040231f8d6ca865ea50250509c3315ea0c7400e (diff) | |
download | PrismLauncher-b258eac215c791b2a8eed10cecbbf9551c87f0b9.tar.gz PrismLauncher-b258eac215c791b2a8eed10cecbbf9551c87f0b9.tar.bz2 PrismLauncher-b258eac215c791b2a8eed10cecbbf9551c87f0b9.zip |
NOISSUE continue reshuffling the codebase
Diffstat (limited to 'launcher/ui/themes/SystemTheme.cpp')
-rw-r--r-- | launcher/ui/themes/SystemTheme.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/launcher/ui/themes/SystemTheme.cpp b/launcher/ui/themes/SystemTheme.cpp new file mode 100644 index 00000000..49b1afaa --- /dev/null +++ b/launcher/ui/themes/SystemTheme.cpp @@ -0,0 +1,83 @@ +#include "SystemTheme.h" +#include <QApplication> +#include <QStyle> +#include <QStyleFactory> +#include <QDebug> + +SystemTheme::SystemTheme() +{ + qDebug() << "Determining System Theme..."; + const auto & style = QApplication::style(); + systemPalette = style->standardPalette(); + QString lowerThemeName = style->objectName(); + qDebug() << "System theme seems to be:" << lowerThemeName; + QStringList styles = QStyleFactory::keys(); + for(auto &st: styles) + { + qDebug() << "Considering theme from theme factory:" << st.toLower(); + if(st.toLower() == lowerThemeName) + { + systemTheme = st; + qDebug() << "System theme has been determined to be:" << systemTheme; + return; + } + } + // fall back to fusion if we can't find the current theme. + systemTheme = "Fusion"; + qDebug() << "System theme not found, defaulted to Fusion"; +} + +void SystemTheme::apply(bool initial) +{ + // if we are applying the system theme as the first theme, just don't touch anything. it's for the better... + if(initial) + { + return; + } + ITheme::apply(initial); +} + +QString SystemTheme::id() +{ + return "system"; +} + +QString SystemTheme::name() +{ + return QObject::tr("System"); +} + +QString SystemTheme::qtTheme() +{ + return systemTheme; +} + +QPalette SystemTheme::colorScheme() +{ + return systemPalette; +} + +QString SystemTheme::appStyleSheet() +{ + return QString(); +} + +double SystemTheme::fadeAmount() +{ + return 0.5; +} + +QColor SystemTheme::fadeColor() +{ + return QColor(128,128,128); +} + +bool SystemTheme::hasStyleSheet() +{ + return false; +} + +bool SystemTheme::hasColorScheme() +{ + return true; +} |