annotate src/sys/win32/dark_theme.cpp @ 2:23d0d9319a00

Update Also converted everything to LF from CRLF
author Paper <mrpapersonic@gmail.com>
date Sat, 12 Aug 2023 03:16:26 -0400
parents 1ae666fdf9e2
children 5c0397762b53
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
1 #include <QSettings>
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
2 #include <QOperatingSystemVersion>
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
3 #include "sys/win32/dark_theme.h"
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
4 bool win32::DarkThemeAvailable()
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
5 {
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
6 // dark mode supported Windows 10 1809 10.0.17763 onward
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
7 // https://stackoverflow.com/questions/53501268/win10-dark-theme-how-to-use-in-winapi
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
8 if ( QOperatingSystemVersion::current().majorVersion() == 10 )
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
9 {
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
10 return QOperatingSystemVersion::current().microVersion() >= 17763;
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
11 }
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
12 else if ( QOperatingSystemVersion::current().majorVersion() > 10 )
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
13 {
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
14 return true;
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
15 }
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
16 else
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
17 {
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
18 return false;
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
19 }
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
20 }
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
21
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
22 bool win32::IsInDarkTheme()
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
23 {
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
24 QSettings settings( "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat );
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
25 return settings.value( "AppsUseLightTheme", 1 ).toInt() == 0;
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
26 }