diff src/gui/dialog/settings/application.cpp @ 10:4b198a111713

Update things actually compile now btw qttest wants to fuck over the model but that might be my fault so /shrug
author Paper <mrpapersonic@gmail.com>
date Sat, 16 Sep 2023 02:06:01 -0400
parents 5c0397762b53
children cde8f67a7c7d
line wrap: on
line diff
--- a/src/gui/dialog/settings/application.cpp	Sun Sep 10 03:59:16 2023 -0400
+++ b/src/gui/dialog/settings/application.cpp	Sat Sep 16 02:06:01 2023 -0400
@@ -1,125 +1,125 @@
-#include "core/session.h"
-#include "gui/dialog/settings.h"
-#include <QCheckBox>
-#include <QComboBox>
-#include <QGroupBox>
-#include <QPushButton>
-#include <QSizePolicy>
-
-QWidget* SettingsPageApplication::CreateAnimeListWidget() {
-	QWidget* result = new QWidget(this);
-	result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
-
-	QGroupBox* actions_group_box = new QGroupBox(tr("Actions"), result);
-	actions_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
-
-	/* Actions/Double click */
-	QWidget* double_click_widget = new QWidget(actions_group_box);
-	QLabel* dc_combo_box_label = new QLabel(tr("Double click:"), double_click_widget);
-	QComboBox* dc_combo_box = new QComboBox(double_click_widget);
-	dc_combo_box->addItem(tr("View anime info"));
-
-	QVBoxLayout* double_click_layout = new QVBoxLayout;
-	double_click_layout->addWidget(dc_combo_box_label);
-	double_click_layout->addWidget(dc_combo_box);
-	double_click_layout->setMargin(0);
-	double_click_widget->setLayout(double_click_layout);
-
-	/* Actions/Middle click */
-	QWidget* middle_click_widget = new QWidget(actions_group_box);
-	QLabel* mc_combo_box_label = new QLabel(tr("Middle click:"), middle_click_widget);
-	QComboBox* mc_combo_box = new QComboBox(middle_click_widget);
-	mc_combo_box->addItem(tr("Play next episode"));
-
-	QVBoxLayout* middle_click_layout = new QVBoxLayout;
-	middle_click_layout->addWidget(mc_combo_box_label);
-	middle_click_layout->addWidget(mc_combo_box);
-	middle_click_layout->setMargin(0);
-	middle_click_widget->setLayout(middle_click_layout);
-
-	/* Actions */
-	QHBoxLayout* actions_layout = new QHBoxLayout;
-	actions_layout->addWidget(double_click_widget);
-	actions_layout->addWidget(middle_click_widget);
-	actions_group_box->setLayout(actions_layout);
-
-	QGroupBox* appearance_group_box = new QGroupBox(tr("Appearance"), result);
-	appearance_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
-
-	QLabel* lang_combo_box_label = new QLabel(tr("Title language preference:"), appearance_group_box);
-	QComboBox* lang_combo_box = new QComboBox(appearance_group_box);
-	lang_combo_box->addItem(tr("Romaji"));
-	lang_combo_box->addItem(tr("Native"));
-	lang_combo_box->addItem(tr("English"));
-	connect(lang_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
-			[this](int index) { language = static_cast<Anime::TitleLanguage>(index); });
-	lang_combo_box->setCurrentIndex(static_cast<int>(language));
-
-	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);
-	connect(hl_anime_box, &QCheckBox::stateChanged, this, [this, hl_above_anime_box](int state) {
-		highlight_anime_if_available = (state == Qt::Unchecked) ? false : true;
-		hl_above_anime_box->setEnabled(state);
-	});
-	connect(hl_above_anime_box, &QCheckBox::stateChanged, this,
-			[this](int state) { highlight_anime_if_available = (state == Qt::Unchecked) ? false : true; });
-	hl_anime_box->setCheckState(highlight_anime_if_available ? Qt::Checked : Qt::Unchecked);
-	hl_above_anime_box->setCheckState(highlighted_anime_above_others ? Qt::Checked : Qt::Unchecked);
-	hl_above_anime_box->setEnabled(hl_anime_box->checkState() != Qt::Unchecked);
-	hl_above_anime_box->setStyleSheet("margin-left: 10px;");
-
-	/* Appearance */
-	QVBoxLayout* appearance_layout = new QVBoxLayout;
-	appearance_layout->addWidget(lang_combo_box_label);
-	appearance_layout->addWidget(lang_combo_box);
-	appearance_layout->addWidget(hl_anime_box);
-	appearance_layout->addWidget(hl_above_anime_box);
-	appearance_group_box->setLayout(appearance_layout);
-
-	QGroupBox* progress_group_box = new QGroupBox(tr("Progress"), result);
-	progress_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
-
-	QCheckBox* progress_display_aired_episodes =
-		new QCheckBox(tr("Display aired episodes (estimated)"), progress_group_box);
-	connect(progress_display_aired_episodes, &QCheckBox::stateChanged, this,
-			[this](int state) { display_aired_episodes = (state == Qt::Unchecked) ? false : true; });
-	progress_display_aired_episodes->setCheckState(display_aired_episodes ? Qt::Checked : Qt::Unchecked);
-
-	QCheckBox* progress_display_available_episodes =
-		new QCheckBox(tr("Display available episodes in library folders"), progress_group_box);
-	connect(progress_display_available_episodes, &QCheckBox::stateChanged, this,
-			[this](int state) { display_available_episodes = (state == Qt::Unchecked) ? false : true; });
-	progress_display_available_episodes->setCheckState(display_available_episodes ? Qt::Checked : Qt::Unchecked);
-
-	QVBoxLayout* progress_layout = new QVBoxLayout;
-	progress_layout->addWidget(progress_display_aired_episodes);
-	progress_layout->addWidget(progress_display_available_episodes);
-	progress_group_box->setLayout(progress_layout);
-
-	QVBoxLayout* full_layout = new QVBoxLayout;
-	full_layout->addWidget(actions_group_box);
-	full_layout->addWidget(appearance_group_box);
-	full_layout->addWidget(progress_group_box);
-	full_layout->setSpacing(10);
-	full_layout->addStretch();
-	result->setLayout(full_layout);
-	return result;
-}
-
-void SettingsPageApplication::SaveInfo() {
-	session.config.anime_list.language = language;
-	session.config.anime_list.highlighted_anime_above_others = highlighted_anime_above_others;
-	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;
-}
-
-SettingsPageApplication::SettingsPageApplication(QWidget* parent) : SettingsPage(parent, tr("Application")) {
-	language = session.config.anime_list.language;
-	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;
-	display_available_episodes = session.config.anime_list.display_available_episodes;
-	AddTab(CreateAnimeListWidget(), tr("Anime list"));
-}
+#include "core/session.h"
+#include "gui/dialog/settings.h"
+#include <QCheckBox>
+#include <QComboBox>
+#include <QGroupBox>
+#include <QPushButton>
+#include <QSizePolicy>
+
+QWidget* SettingsPageApplication::CreateAnimeListWidget() {
+	QWidget* result = new QWidget(this);
+	result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
+
+	QGroupBox* actions_group_box = new QGroupBox(tr("Actions"), result);
+	actions_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
+
+	/* Actions/Double click */
+	QWidget* double_click_widget = new QWidget(actions_group_box);
+	QLabel* dc_combo_box_label = new QLabel(tr("Double click:"), double_click_widget);
+	QComboBox* dc_combo_box = new QComboBox(double_click_widget);
+	dc_combo_box->addItem(tr("View anime info"));
+
+	QVBoxLayout* double_click_layout = new QVBoxLayout;
+	double_click_layout->addWidget(dc_combo_box_label);
+	double_click_layout->addWidget(dc_combo_box);
+	double_click_layout->setMargin(0);
+	double_click_widget->setLayout(double_click_layout);
+
+	/* Actions/Middle click */
+	QWidget* middle_click_widget = new QWidget(actions_group_box);
+	QLabel* mc_combo_box_label = new QLabel(tr("Middle click:"), middle_click_widget);
+	QComboBox* mc_combo_box = new QComboBox(middle_click_widget);
+	mc_combo_box->addItem(tr("Play next episode"));
+
+	QVBoxLayout* middle_click_layout = new QVBoxLayout;
+	middle_click_layout->addWidget(mc_combo_box_label);
+	middle_click_layout->addWidget(mc_combo_box);
+	middle_click_layout->setMargin(0);
+	middle_click_widget->setLayout(middle_click_layout);
+
+	/* Actions */
+	QHBoxLayout* actions_layout = new QHBoxLayout;
+	actions_layout->addWidget(double_click_widget);
+	actions_layout->addWidget(middle_click_widget);
+	actions_group_box->setLayout(actions_layout);
+
+	QGroupBox* appearance_group_box = new QGroupBox(tr("Appearance"), result);
+	appearance_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
+
+	QLabel* lang_combo_box_label = new QLabel(tr("Title language preference:"), appearance_group_box);
+	QComboBox* lang_combo_box = new QComboBox(appearance_group_box);
+	lang_combo_box->addItem(tr("Romaji"));
+	lang_combo_box->addItem(tr("Native"));
+	lang_combo_box->addItem(tr("English"));
+	connect(lang_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
+			[this](int index) { language = static_cast<Anime::TitleLanguage>(index); });
+	lang_combo_box->setCurrentIndex(static_cast<int>(language));
+
+	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);
+	connect(hl_anime_box, &QCheckBox::stateChanged, this, [this, hl_above_anime_box](int state) {
+		highlight_anime_if_available = (state == Qt::Unchecked) ? false : true;
+		hl_above_anime_box->setEnabled(state);
+	});
+	connect(hl_above_anime_box, &QCheckBox::stateChanged, this,
+			[this](int state) { highlight_anime_if_available = (state == Qt::Unchecked) ? false : true; });
+	hl_anime_box->setCheckState(highlight_anime_if_available ? Qt::Checked : Qt::Unchecked);
+	hl_above_anime_box->setCheckState(highlighted_anime_above_others ? Qt::Checked : Qt::Unchecked);
+	hl_above_anime_box->setEnabled(hl_anime_box->checkState() != Qt::Unchecked);
+	hl_above_anime_box->setStyleSheet("margin-left: 10px;");
+
+	/* Appearance */
+	QVBoxLayout* appearance_layout = new QVBoxLayout;
+	appearance_layout->addWidget(lang_combo_box_label);
+	appearance_layout->addWidget(lang_combo_box);
+	appearance_layout->addWidget(hl_anime_box);
+	appearance_layout->addWidget(hl_above_anime_box);
+	appearance_group_box->setLayout(appearance_layout);
+
+	QGroupBox* progress_group_box = new QGroupBox(tr("Progress"), result);
+	progress_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
+
+	QCheckBox* progress_display_aired_episodes =
+		new QCheckBox(tr("Display aired episodes (estimated)"), progress_group_box);
+	connect(progress_display_aired_episodes, &QCheckBox::stateChanged, this,
+			[this](int state) { display_aired_episodes = (state == Qt::Unchecked) ? false : true; });
+	progress_display_aired_episodes->setCheckState(display_aired_episodes ? Qt::Checked : Qt::Unchecked);
+
+	QCheckBox* progress_display_available_episodes =
+		new QCheckBox(tr("Display available episodes in library folders"), progress_group_box);
+	connect(progress_display_available_episodes, &QCheckBox::stateChanged, this,
+			[this](int state) { display_available_episodes = (state == Qt::Unchecked) ? false : true; });
+	progress_display_available_episodes->setCheckState(display_available_episodes ? Qt::Checked : Qt::Unchecked);
+
+	QVBoxLayout* progress_layout = new QVBoxLayout;
+	progress_layout->addWidget(progress_display_aired_episodes);
+	progress_layout->addWidget(progress_display_available_episodes);
+	progress_group_box->setLayout(progress_layout);
+
+	QVBoxLayout* full_layout = new QVBoxLayout;
+	full_layout->addWidget(actions_group_box);
+	full_layout->addWidget(appearance_group_box);
+	full_layout->addWidget(progress_group_box);
+	full_layout->setSpacing(10);
+	full_layout->addStretch();
+	result->setLayout(full_layout);
+	return result;
+}
+
+void SettingsPageApplication::SaveInfo() {
+	session.config.anime_list.language = language;
+	session.config.anime_list.highlighted_anime_above_others = highlighted_anime_above_others;
+	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;
+}
+
+SettingsPageApplication::SettingsPageApplication(QWidget* parent) : SettingsPage(parent, tr("Application")) {
+	language = session.config.anime_list.language;
+	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;
+	display_available_episodes = session.config.anime_list.display_available_episodes;
+	AddTab(CreateAnimeListWidget(), tr("Anime list"));
+}