diff src/gui/dialog/settings/application.cc @ 101:c537996cf67b

*: multitude of config changes 1. theme is now configurable from the settings menu (but you have to restart for it to apply) 2. config is now stored in an INI file, with no method of conversion from json (this repo is private-ish anyway)
author Paper <mrpapersonic@gmail.com>
date Fri, 03 Nov 2023 14:06:02 -0400
parents 9b2b41f83a5e
children b315f3759c56
line wrap: on
line diff
--- a/src/gui/dialog/settings/application.cc	Fri Nov 03 09:43:04 2023 -0400
+++ b/src/gui/dialog/settings/application.cc	Fri Nov 03 14:06:02 2023 -0400
@@ -1,5 +1,6 @@
 #include "core/session.h"
 #include "gui/dialog/settings.h"
+#include "gui/dark_theme.h"
 #include <QCheckBox>
 #include <QComboBox>
 #include <QGroupBox>
@@ -55,6 +56,15 @@
 	        [this](int index) { language = static_cast<Anime::TitleLanguage>(index); });
 	lang_combo_box->setCurrentIndex(static_cast<int>(language));
 
+	QLabel* theme_combo_box_label = new QLabel(tr("Application theme:"), appearance_group_box);
+	QComboBox* theme_combo_box = new QComboBox(appearance_group_box);
+	theme_combo_box->addItem(tr("Default"));
+	theme_combo_box->addItem(tr("Light"));
+	theme_combo_box->addItem(tr("Dark"));
+	connect(theme_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
+		    [this](int index) { theme = static_cast<Themes>(index); });
+	theme_combo_box->setCurrentIndex(static_cast<int>(theme));
+
 	QCheckBox* hl_anime_box =
 	    new QCheckBox(tr("Highlight anime if next episode is available in library folders"), appearance_group_box);
 	QCheckBox* hl_above_anime_box = new QCheckBox(tr("Display highlighted anime above others"), appearance_group_box);
@@ -73,6 +83,8 @@
 	QVBoxLayout* appearance_layout = new QVBoxLayout(appearance_group_box);
 	appearance_layout->addWidget(lang_combo_box_label);
 	appearance_layout->addWidget(lang_combo_box);
+	appearance_layout->addWidget(theme_combo_box_label);
+	appearance_layout->addWidget(theme_combo_box);
 	appearance_layout->addWidget(hl_anime_box);
 	appearance_layout->addWidget(hl_above_anime_box);
 
@@ -111,10 +123,13 @@
 	session.config.anime_list.highlight_anime_if_available = highlight_anime_if_available;
 	session.config.anime_list.display_aired_episodes = display_aired_episodes;
 	session.config.anime_list.display_available_episodes = display_available_episodes;
+	session.config.theme = theme;
+	DarkTheme::SetTheme(session.config.theme);
 }
 
 SettingsPageApplication::SettingsPageApplication(QWidget* parent) : SettingsPage(parent, tr("Application")) {
 	language = session.config.anime_list.language;
+	theme = session.config.theme;
 	highlighted_anime_above_others = session.config.anime_list.highlighted_anime_above_others;
 	highlight_anime_if_available = session.config.anime_list.highlight_anime_if_available;
 	display_aired_episodes = session.config.anime_list.display_aired_episodes;