diff src/gui/theme.cc @ 369:47c9f8502269

*: clang-format all the things I've edited the formatting a bit. Now pointer asterisks (and reference ampersands) are on the variable instead of the type, as well as having newlines for function braces (but nothing else)
author Paper <paper@tflc.us>
date Fri, 25 Jul 2025 10:16:02 -0400
parents c844f8bb87ce
children
line wrap: on
line diff
--- a/src/gui/theme.cc	Fri Jul 25 10:05:23 2025 -0400
+++ b/src/gui/theme.cc	Fri Jul 25 10:16:02 2025 -0400
@@ -1,24 +1,24 @@
+#include "gui/theme.h"
 #include "core/config.h"
 #include "core/session.h"
-#include "gui/theme.h"
 #include <QApplication>
 #include <QDebug>
 #include <QFile>
+#include <QStyle>
 #include <QStyleFactory>
 #include <QTextStream>
-#include <QStyle>
 #include <QtGlobal>
 #ifdef MACOSX
-#	include "sys/osx/dark_theme.h"
+# include "sys/osx/dark_theme.h"
 #elif defined(WIN32)
-#	include "sys/win32/dark_theme.h"
+# include "sys/win32/dark_theme.h"
 #else
-#	ifdef GLIB
-#		include "sys/glib/dark_theme.h"
-#	endif
-#	ifdef HAVE_XCB
-#		include "sys/x11/dark_theme.h"
-#	endif
+# ifdef GLIB
+#  include "sys/glib/dark_theme.h"
+# endif
+# ifdef HAVE_XCB
+#  include "sys/x11/dark_theme.h"
+# endif
 #endif
 
 /* Weird quirks of this implementation:
@@ -30,15 +30,18 @@
 
 namespace Theme {
 
-ThemeManager::ThemeManager(Theme theme) {
+ThemeManager::ThemeManager(Theme theme)
+{
 	this->theme = theme;
 }
 
-Theme ThemeManager::GetTheme() const {
+Theme ThemeManager::GetTheme() const
+{
 	return theme;
 }
 
-bool ThemeManager::IsInDarkTheme() const {
+bool ThemeManager::IsInDarkTheme() const
+{
 	switch (theme) {
 		case Theme::Default:
 #ifdef MACOSX
@@ -48,23 +51,23 @@
 			if (win32::DarkThemeAvailable())
 				return win32::IsInDarkTheme();
 #else
-#	ifdef HAVE_XCB
+# ifdef HAVE_XCB
 			if (x11::IsInDarkTheme())
 				return true;
-#	endif
-#	ifdef GLIB
+# endif
+# ifdef GLIB
 			if (glib::IsInDarkTheme())
 				return true;
-#	endif
+# endif
 			break;
 #endif
-		default:
-			break;
+		default: break;
 	}
 	return (theme == Theme::Dark);
 }
 
-void ThemeManager::SetToDarkTheme() {
+void ThemeManager::SetToDarkTheme()
+{
 	/* macOS >= 10.14 has its own global dark theme,
 	   use it :) */
 #ifdef MACOSX
@@ -78,7 +81,8 @@
 		SetStyleSheet(Theme::Dark);
 }
 
-void ThemeManager::SetToLightTheme() {
+void ThemeManager::SetToLightTheme()
+{
 #ifdef MACOSX
 	if (osx::DarkThemeAvailable())
 		osx::SetToLightTheme();
@@ -90,12 +94,14 @@
 		SetStyleSheet(Theme::Light);
 }
 
-Theme ThemeManager::GetCurrentOSTheme() const {
+Theme ThemeManager::GetCurrentOSTheme() const
+{
 	return IsInDarkTheme() ? Theme::Dark : Theme::Light;
 }
 
 /* this function is private, and should stay that way */
-void ThemeManager::SetStyleSheet(Theme theme) {
+void ThemeManager::SetStyleSheet(Theme theme)
+{
 	switch (theme) {
 		case Theme::Dark: {
 			const QColor darkGray(53, 53, 53);
@@ -151,7 +157,8 @@
 	}
 }
 
-void ThemeManager::SetTheme(Theme theme) {
+void ThemeManager::SetTheme(Theme theme)
+{
 	switch (theme) {
 		case Theme::Light: SetToLightTheme(); break;
 		case Theme::Dark: SetToDarkTheme(); break;
@@ -165,7 +172,8 @@
 	this->theme = theme;
 }
 
-void ThemeManager::RepaintCurrentTheme() {
+void ThemeManager::RepaintCurrentTheme()
+{
 	SetTheme(theme);
 }