Mercurial > minori
comparison src/gui/theme.cc @ 258:862d0d8619f6
*: HUUUGE changes
animia has been renamed to animone, so instead of thinking of a
health condition, you think of a beautiful flower :)
I've also edited some of the code for animone, but I have no idea
if it even works or not because I don't have a mac or windows
machine lying around. whoops!
... anyway, all of the changes divergent from Anisthesia are now
licensed under BSD. it's possible that I could even rewrite most
of the code to where I don't even have to keep the MIT license,
but that's thinking too far into the future
I've been slacking off on implementing the anime seasons page,
mostly out of laziness. I think I'd have to create another db file
specifically for the seasons
anyway, this code is being pushed *primarily* because the hard drive
it's on is failing! yay :)
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Mon, 01 Apr 2024 02:43:44 -0400 |
| parents | 4d461ef7d424 |
| children | 657fda1b9cac |
comparison
equal
deleted
inserted
replaced
| 257:699a20c57dc8 | 258:862d0d8619f6 |
|---|---|
| 1 #include "core/config.h" | 1 #include "core/config.h" |
| 2 #include "core/session.h" | 2 #include "core/session.h" |
| 3 #include <QApplication> | 3 #include <QApplication> |
| 4 #include <QDebug> | |
| 4 #include <QFile> | 5 #include <QFile> |
| 5 #include <QDebug> | 6 #include <QStyleFactory> |
| 6 #include <QTextStream> | 7 #include <QTextStream> |
| 7 #include <QStyleFactory> | |
| 8 #ifdef MACOSX | 8 #ifdef MACOSX |
| 9 # include "sys/osx/dark_theme.h" | 9 # include "sys/osx/dark_theme.h" |
| 10 #elif WIN32 | 10 #elif WIN32 |
| 11 # include "sys/win32/dark_theme.h" | 11 # include "sys/win32/dark_theme.h" |
| 12 #else | 12 #else |
| 18 /* Weird quirks of this implementation: | 18 /* Weird quirks of this implementation: |
| 19 * 1. Dark mode stuff in Qt changes a lot and Qt 5 and Qt 6 are massively different | 19 * 1. Dark mode stuff in Qt changes a lot and Qt 5 and Qt 6 are massively different |
| 20 * 2. Some widgets, i.e. QTabWidget, QTabBar, etc., just completely IGNORE the QPalette setting | 20 * 2. Some widgets, i.e. QTabWidget, QTabBar, etc., just completely IGNORE the QPalette setting |
| 21 * on different platforms and the only way to fix it is by using Fusion | 21 * on different platforms and the only way to fix it is by using Fusion |
| 22 * 3. Windows dark mode support in Qt 6.5 (with Fusion) is completely unavoidable | 22 * 3. Windows dark mode support in Qt 6.5 (with Fusion) is completely unavoidable |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 namespace Theme { | 25 namespace Theme { |
| 26 | 26 |
| 27 Theme::Theme(Themes theme) { | 27 Theme::Theme(Themes theme) { |
| 28 this->theme = theme; | 28 this->theme = theme; |
| 113 pal.setColor(QPalette::Disabled, QPalette::Text, gray); | 113 pal.setColor(QPalette::Disabled, QPalette::Text, gray); |
| 114 pal.setColor(QPalette::Disabled, QPalette::Light, darkGray); | 114 pal.setColor(QPalette::Disabled, QPalette::Light, darkGray); |
| 115 qApp->setPalette(pal); | 115 qApp->setPalette(pal); |
| 116 | 116 |
| 117 #ifdef WIN32 | 117 #ifdef WIN32 |
| 118 qApp->setStyleSheet([]{ | 118 qApp->setStyleSheet([] { |
| 119 QFile f(":/dark.qss"); | 119 QFile f(":/dark.qss"); |
| 120 if (!f.exists()) | 120 if (!f.exists()) |
| 121 return QStringLiteral(""); | 121 return QStringLiteral(""); |
| 122 f.open(QFile::ReadOnly | QFile::Text); | 122 f.open(QFile::ReadOnly | QFile::Text); |
| 123 QTextStream ts(&f); | 123 QTextStream ts(&f); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 void Theme::SetTheme(Themes theme) { | 143 void Theme::SetTheme(Themes theme) { |
| 144 switch (theme) { | 144 switch (theme) { |
| 145 case Themes::LIGHT: | 145 case Themes::LIGHT: SetToLightTheme(); break; |
| 146 SetToLightTheme(); | 146 case Themes::DARK: SetToDarkTheme(); break; |
| 147 break; | |
| 148 case Themes::DARK: | |
| 149 SetToDarkTheme(); | |
| 150 break; | |
| 151 case Themes::OS: | 147 case Themes::OS: |
| 152 if (GetCurrentOSTheme() == Themes::LIGHT) | 148 if (GetCurrentOSTheme() == Themes::LIGHT) |
| 153 SetToLightTheme(); | 149 SetToLightTheme(); |
| 154 else | 150 else |
| 155 SetToDarkTheme(); | 151 SetToDarkTheme(); |
| 160 | 156 |
| 161 void Theme::RepaintCurrentTheme() { | 157 void Theme::RepaintCurrentTheme() { |
| 162 Theme::SetTheme(theme); | 158 Theme::SetTheme(theme); |
| 163 } | 159 } |
| 164 | 160 |
| 165 } // namespace DarkTheme | 161 } // namespace Theme |
