diff 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
line wrap: on
line diff
--- a/src/sys/win32/dark_theme.cpp	Sat Aug 26 03:39:34 2023 -0400
+++ b/src/sys/win32/dark_theme.cpp	Sun Sep 10 03:59:16 2023 -0400
@@ -1,26 +1,27 @@
-#include <QSettings>
+#include "sys/win32/dark_theme.h"
 #include <QOperatingSystemVersion>
-#include "sys/win32/dark_theme.h"
-bool win32::DarkThemeAvailable()
-{
-    // dark mode supported Windows 10 1809 10.0.17763 onward
-    // https://stackoverflow.com/questions/53501268/win10-dark-theme-how-to-use-in-winapi
-    if ( QOperatingSystemVersion::current().majorVersion() == 10 )
-    {
-        return QOperatingSystemVersion::current().microVersion() >= 17763;
-    }
-    else if ( QOperatingSystemVersion::current().majorVersion() > 10 )
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
+#include <QSettings>
+
+namespace win32 {
+
+bool DarkThemeAvailable() {
+	// dark mode supported Windows 10 1809 10.0.17763 onward
+	// https://stackoverflow.com/questions/53501268/win10-dark-theme-how-to-use-in-winapi
+	if (QOperatingSystemVersion::current().majorVersion() == 10) {
+		return QOperatingSystemVersion::current().microVersion() >= 17763;
+	} else if (QOperatingSystemVersion::current().majorVersion() > 10) {
+		return true;
+	} else {
+		return false;
+	}
 }
 
-bool win32::IsInDarkTheme()
-{
-    QSettings settings( "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat );
-    return settings.value( "AppsUseLightTheme", 1 ).toInt() == 0;
+bool IsInDarkTheme() {
+	QSettings settings("HKEY_CURRENT_"
+					   "USER\\Software\\Microsoft\\Windows\\CurrentVersion\\The"
+					   "mes\\Personalize",
+					   QSettings::NativeFormat);
+	return settings.value("AppsUseLightTheme", 1).toInt() == 0;
 }
+
+} // namespace win32