diff src/gui/dialog/settings/application.cc @ 189:649786bae914

*: etc. code cleanup I've removed most macros and stuff dep/animia: [UNTESTED] use raw C++ instead of Objective-C++
author Paper <mrpapersonic@gmail.com>
date Wed, 06 Dec 2023 19:42:33 -0500
parents 9613d72b097e
children 975a3f0965e2
line wrap: on
line diff
--- a/src/gui/dialog/settings/application.cc	Wed Dec 06 13:44:36 2023 -0500
+++ b/src/gui/dialog/settings/application.cc	Wed Dec 06 19:42:33 2023 -0500
@@ -3,6 +3,8 @@
 #include "gui/dialog/settings.h"
 #include "gui/theme.h"
 #include "gui/locale.h"
+#include "gui/translate/anime.h"
+
 #include <QCheckBox>
 #include <QComboBox>
 #include <QGroupBox>
@@ -11,6 +13,7 @@
 #include <QPushButton>
 #include <QSizePolicy>
 #include <QVBoxLayout>
+
 #include <algorithm>
 
 QWidget* SettingsPageApplication::CreateAnimeListWidget() {
@@ -107,7 +110,7 @@
 		{
 			/* Application locale */
 			{
-				QLabel* locale_combo_box_label = new QLabel(tr("Set application locale:"), appearance_group_box);
+				QLabel* locale_combo_box_label = new QLabel(tr("Application locale:"), appearance_group_box);
 				appearance_layout->addWidget(locale_combo_box_label);
 			}
 
@@ -123,6 +126,7 @@
 				for (size_t i = 0; i < available_locales.size(); i++)
 					if (available_locales[i] == locale)
 						locale_combo_box->setCurrentIndex(i);
+
 				appearance_layout->addWidget(locale_combo_box);
 			}
 		}
@@ -130,19 +134,21 @@
 		{
 			/* Application theme */
 			{
-				QLabel* theme_combo_box_label = new QLabel(tr("Application theme:"), appearance_group_box);
-				appearance_layout->addWidget(theme_combo_box_label);
+				QLabel* rating_combo_box_label = new QLabel(tr("Rating system:"), appearance_group_box);
+				appearance_layout->addWidget(rating_combo_box_label);
 			}
 
 			{
-				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));
-				appearance_layout->addWidget(theme_combo_box);
+				QComboBox* rating_combo_box = new QComboBox(appearance_group_box);
+
+				for (const auto& score_format : Anime::ScoreFormats)
+					rating_combo_box->addItem(Strings::ToQString(Translate::ToLocalString(score_format)), static_cast<int>(score_format));
+
+				connect(rating_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
+					    [this, rating_combo_box](int index) { format = static_cast<Anime::ScoreFormat>(rating_combo_box->itemData(index).toInt()); });
+
+				rating_combo_box->setCurrentIndex(static_cast<int>(format));
+				appearance_layout->addWidget(rating_combo_box);
 			}
 		}
 
@@ -220,6 +226,7 @@
 
 SettingsPageApplication::SettingsPageApplication(QWidget* parent) : SettingsPage(parent, tr("Application")) {
 	language = session.config.anime_list.language;
+	format = session.config.anime_list.score_format;
 	theme = session.config.theme.GetTheme();
 	locale = session.config.locale.GetLocale();
 	highlighted_anime_above_others = session.config.anime_list.highlighted_anime_above_others;