Mercurial > minori
comparison src/sys/win32/dark_theme.cpp @ 9:5c0397762b53
INCOMPLETE: megacommit :)
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Sun, 10 Sep 2023 03:59:16 -0400 |
| parents | 23d0d9319a00 |
| children | cde8f67a7c7d |
comparison
equal
deleted
inserted
replaced
| 8:b1f73678ef61 | 9:5c0397762b53 |
|---|---|
| 1 #include "sys/win32/dark_theme.h" | |
| 2 #include <QOperatingSystemVersion> | |
| 1 #include <QSettings> | 3 #include <QSettings> |
| 2 #include <QOperatingSystemVersion> | 4 |
| 3 #include "sys/win32/dark_theme.h" | 5 namespace win32 { |
| 4 bool win32::DarkThemeAvailable() | 6 |
| 5 { | 7 bool DarkThemeAvailable() { |
| 6 // dark mode supported Windows 10 1809 10.0.17763 onward | 8 // dark mode supported Windows 10 1809 10.0.17763 onward |
| 7 // https://stackoverflow.com/questions/53501268/win10-dark-theme-how-to-use-in-winapi | 9 // https://stackoverflow.com/questions/53501268/win10-dark-theme-how-to-use-in-winapi |
| 8 if ( QOperatingSystemVersion::current().majorVersion() == 10 ) | 10 if (QOperatingSystemVersion::current().majorVersion() == 10) { |
| 9 { | 11 return QOperatingSystemVersion::current().microVersion() >= 17763; |
| 10 return QOperatingSystemVersion::current().microVersion() >= 17763; | 12 } else if (QOperatingSystemVersion::current().majorVersion() > 10) { |
| 11 } | 13 return true; |
| 12 else if ( QOperatingSystemVersion::current().majorVersion() > 10 ) | 14 } else { |
| 13 { | 15 return false; |
| 14 return true; | 16 } |
| 15 } | |
| 16 else | |
| 17 { | |
| 18 return false; | |
| 19 } | |
| 20 } | 17 } |
| 21 | 18 |
| 22 bool win32::IsInDarkTheme() | 19 bool IsInDarkTheme() { |
| 23 { | 20 QSettings settings("HKEY_CURRENT_" |
| 24 QSettings settings( "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat ); | 21 "USER\\Software\\Microsoft\\Windows\\CurrentVersion\\The" |
| 25 return settings.value( "AppsUseLightTheme", 1 ).toInt() == 0; | 22 "mes\\Personalize", |
| 23 QSettings::NativeFormat); | |
| 24 return settings.value("AppsUseLightTheme", 1).toInt() == 0; | |
| 26 } | 25 } |
| 26 | |
| 27 } // namespace win32 |
