Mercurial > minori
comparison src/gui/dialog/settings/application.cc @ 279:657fda1b9cac
*: clean up enums
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Fri, 19 Apr 2024 13:24:06 -0400 |
| parents | 862d0d8619f6 |
| children | b1f4d1867ab1 |
comparison
equal
deleted
inserted
replaced
| 274:f6a756c19bfb | 279:657fda1b9cac |
|---|---|
| 2 #include "core/strings.h" | 2 #include "core/strings.h" |
| 3 #include "gui/dialog/settings.h" | 3 #include "gui/dialog/settings.h" |
| 4 #include "gui/locale.h" | 4 #include "gui/locale.h" |
| 5 #include "gui/theme.h" | 5 #include "gui/theme.h" |
| 6 #include "gui/translate/anime.h" | 6 #include "gui/translate/anime.h" |
| 7 #include "gui/translate/config.h" | |
| 7 | 8 |
| 8 #include <QCheckBox> | 9 #include <QCheckBox> |
| 9 #include <QComboBox> | 10 #include <QComboBox> |
| 10 #include <QGroupBox> | 11 #include <QGroupBox> |
| 11 #include <QHBoxLayout> | 12 #include <QHBoxLayout> |
| 12 #include <QLabel> | 13 #include <QLabel> |
| 13 #include <QPushButton> | 14 #include <QPushButton> |
| 14 #include <QSizePolicy> | 15 #include <QSizePolicy> |
| 15 #include <QVBoxLayout> | 16 #include <QVBoxLayout> |
| 16 | 17 |
| 17 #include <algorithm> | |
| 18 | |
| 19 QWidget* SettingsPageApplication::CreateAnimeListWidget() { | 18 QWidget* SettingsPageApplication::CreateAnimeListWidget() { |
| 20 QWidget* result = new QWidget(this); | 19 QWidget* result = new QWidget(this); |
| 21 result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); | 20 result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); |
| 22 | 21 |
| 23 QVBoxLayout* full_layout = new QVBoxLayout(result); | 22 QVBoxLayout* full_layout = new QVBoxLayout(result); |
| 195 QLabel* theme_combo_box_label = new QLabel(tr("Application theme:"), appearance_group_box); | 194 QLabel* theme_combo_box_label = new QLabel(tr("Application theme:"), appearance_group_box); |
| 196 appearance_layout->addWidget(theme_combo_box_label); | 195 appearance_layout->addWidget(theme_combo_box_label); |
| 197 } | 196 } |
| 198 | 197 |
| 199 { | 198 { |
| 199 /* FIXME: don't hardcode these values */ | |
| 200 QComboBox* theme_combo_box = new QComboBox(appearance_group_box); | 200 QComboBox* theme_combo_box = new QComboBox(appearance_group_box); |
| 201 theme_combo_box->addItem(tr("Default")); | 201 for (const auto& theme : Theme::Themes) |
| 202 theme_combo_box->addItem(tr("Light")); | 202 theme_combo_box->addItem(Strings::ToQString(Translate::ToLocalString(theme))); |
| 203 theme_combo_box->addItem(tr("Dark")); | 203 |
| 204 connect(theme_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, | 204 connect(theme_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, |
| 205 [this](int index) { theme = static_cast<Themes>(index); }); | 205 [this](int index) { theme = static_cast<Theme::Theme>(index); }); |
| 206 theme_combo_box->setCurrentIndex(static_cast<int>(theme)); | 206 theme_combo_box->setCurrentIndex(static_cast<int>(theme)); |
| 207 appearance_layout->addWidget(theme_combo_box); | 207 appearance_layout->addWidget(theme_combo_box); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
