Mercurial > minori
diff src/gui/dialog/settings/application.cc @ 393:963047512d34
*: clang-format
| author | Paper <paper@tflc.us> |
|---|---|
| date | Fri, 07 Nov 2025 07:16:15 -0500 |
| parents | b1f4d1867ab1 |
| children | 2f4dc1580b84 |
line wrap: on
line diff
--- a/src/gui/dialog/settings/application.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/gui/dialog/settings/application.cc Fri Nov 07 07:16:15 2025 -0500 @@ -15,27 +15,28 @@ #include <QSizePolicy> #include <QVBoxLayout> -QWidget* SettingsPageApplication::CreateAnimeListWidget() { - QWidget* result = new QWidget(this); +QWidget *SettingsPageApplication::CreateAnimeListWidget() +{ + QWidget *result = new QWidget(this); result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* full_layout = new QVBoxLayout(result); + QVBoxLayout *full_layout = new QVBoxLayout(result); { /* Actions */ - QGroupBox* actions_group_box = new QGroupBox(tr("Actions"), result); + QGroupBox *actions_group_box = new QGroupBox(tr("Actions"), result); actions_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QHBoxLayout* actions_layout = new QHBoxLayout(actions_group_box); + QHBoxLayout *actions_layout = new QHBoxLayout(actions_group_box); { /* 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); + 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_widget); + QVBoxLayout *double_click_layout = new QVBoxLayout(double_click_widget); double_click_layout->addWidget(dc_combo_box_label); double_click_layout->addWidget(dc_combo_box); double_click_layout->setContentsMargins(0, 0, 0, 0); @@ -45,12 +46,12 @@ { /* 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); + 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_widget); + QVBoxLayout *middle_click_layout = new QVBoxLayout(middle_click_widget); middle_click_layout->addWidget(mc_combo_box_label); middle_click_layout->addWidget(mc_combo_box); middle_click_layout->setContentsMargins(0, 0, 0, 0); @@ -63,19 +64,19 @@ { /* Appearance */ - QGroupBox* appearance_group_box = new QGroupBox(tr("Appearance"), result); + QGroupBox *appearance_group_box = new QGroupBox(tr("Appearance"), result); appearance_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* appearance_layout = new QVBoxLayout(appearance_group_box); + QVBoxLayout *appearance_layout = new QVBoxLayout(appearance_group_box); { /* Title language */ { - QLabel* lang_combo_box_label = new QLabel(tr("Title language preference:"), appearance_group_box); + QLabel *lang_combo_box_label = new QLabel(tr("Title language preference:"), appearance_group_box); appearance_layout->addWidget(lang_combo_box_label); } { - QComboBox* lang_combo_box = new QComboBox(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")); @@ -89,14 +90,14 @@ { /* Application theme */ { - QLabel* rating_combo_box_label = new QLabel(tr("Rating system:"), appearance_group_box); + QLabel *rating_combo_box_label = new QLabel(tr("Rating system:"), appearance_group_box); appearance_layout->addWidget(rating_combo_box_label); } { - QComboBox* rating_combo_box = new QComboBox(appearance_group_box); + QComboBox *rating_combo_box = new QComboBox(appearance_group_box); - for (const auto& score_format : Anime::ScoreFormats) + for (const auto &score_format : Anime::ScoreFormats) rating_combo_box->addItem(Strings::ToQString(Translate::ToLocalString(score_format)), static_cast<int>(score_format)); @@ -112,7 +113,7 @@ { /* Hopefully I made this easy to read... */ - QCheckBox* hl_above_anime_box = + QCheckBox *hl_above_anime_box = new QCheckBox(tr("Display highlighted anime above others"), appearance_group_box); hl_above_anime_box->setCheckState(highlighted_anime_above_others ? Qt::Checked : Qt::Unchecked); hl_above_anime_box->setEnabled(highlight_anime_if_available); @@ -123,7 +124,7 @@ { /* This is here because the above checkbox actually depends on it to be checked. */ - QCheckBox* hl_anime_box = new QCheckBox( + QCheckBox *hl_anime_box = new QCheckBox( tr("Highlight anime if next episode is available in library folders"), appearance_group_box); hl_anime_box->setCheckState(highlight_anime_if_available ? Qt::Checked : Qt::Unchecked); @@ -143,13 +144,13 @@ { /* Progress */ - QGroupBox* progress_group_box = new QGroupBox(tr("Progress"), result); + QGroupBox *progress_group_box = new QGroupBox(tr("Progress"), result); progress_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* progress_layout = new QVBoxLayout(progress_group_box); + QVBoxLayout *progress_layout = new QVBoxLayout(progress_group_box); { - QCheckBox* progress_display_aired_episodes = + 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); }); @@ -157,7 +158,7 @@ progress_layout->addWidget(progress_display_aired_episodes); } { - QCheckBox* progress_display_available_episodes = + 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); }); @@ -175,30 +176,31 @@ return result; } -QWidget* SettingsPageApplication::CreateGeneralWidget() { - QWidget* result = new QWidget(this); +QWidget *SettingsPageApplication::CreateGeneralWidget() +{ + QWidget *result = new QWidget(this); result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* full_layout = new QVBoxLayout(result); + QVBoxLayout *full_layout = new QVBoxLayout(result); { /* Appearance */ - QGroupBox* appearance_group_box = new QGroupBox(tr("Appearance"), result); + QGroupBox *appearance_group_box = new QGroupBox(tr("Appearance"), result); appearance_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* appearance_layout = new QVBoxLayout(appearance_group_box); + QVBoxLayout *appearance_layout = new QVBoxLayout(appearance_group_box); { /* Application theme */ { - QLabel* theme_combo_box_label = new QLabel(tr("Application theme:"), appearance_group_box); + QLabel *theme_combo_box_label = new QLabel(tr("Application theme:"), appearance_group_box); appearance_layout->addWidget(theme_combo_box_label); } { /* FIXME: don't hardcode these values */ - QComboBox* theme_combo_box = new QComboBox(appearance_group_box); - for (const auto& theme : Theme::Themes) + QComboBox *theme_combo_box = new QComboBox(appearance_group_box); + for (const auto &theme : Theme::Themes) theme_combo_box->addItem(Strings::ToQString(Translate::ToLocalString(theme))); connect(theme_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, @@ -211,14 +213,14 @@ { /* Application locale */ { - QLabel* locale_combo_box_label = new QLabel(tr("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); } { - QComboBox* locale_combo_box = new QComboBox(appearance_group_box); - const auto& available_locales = session.config.locale.GetAvailableLocales(); - for (const auto& l : available_locales) + QComboBox *locale_combo_box = new QComboBox(appearance_group_box); + const auto &available_locales = session.config.locale.GetAvailableLocales(); + for (const auto &l : available_locales) locale_combo_box->addItem(Strings::ToQString(Locale::GetLocaleFullName(l)), l); connect(locale_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, @@ -241,7 +243,8 @@ return result; } -void SettingsPageApplication::SaveInfo() { +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; @@ -251,7 +254,8 @@ session.config.locale.SetActiveLocale(locale); } -SettingsPageApplication::SettingsPageApplication(QWidget* parent) : SettingsPage(parent, tr("Application")) { +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();
