Mercurial > minori
comparison src/gui/dialog/settings/services.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 |
|---|---|
| 1 #include "core/anime.h" | 1 #include "core/anime.h" |
| 2 #include "core/session.h" | 2 #include "core/session.h" |
| 3 #include "core/strings.h" | 3 #include "core/strings.h" |
| 4 #include "gui/dialog/settings.h" | 4 #include "gui/dialog/settings.h" |
| 5 #include "gui/translate/anime.h" | |
| 5 #include "services/anilist.h" | 6 #include "services/anilist.h" |
| 6 #include <QComboBox> | 7 #include <QComboBox> |
| 7 #include <QGroupBox> | 8 #include <QGroupBox> |
| 8 #include <QLabel> | 9 #include <QLabel> |
| 9 #include <QLineEdit> | 10 #include <QLineEdit> |
| 28 sync_layout->addWidget(sync_combo_box_label); | 29 sync_layout->addWidget(sync_combo_box_label); |
| 29 } | 30 } |
| 30 | 31 |
| 31 { | 32 { |
| 32 QComboBox* sync_combo_box = new QComboBox(sync_group_box); | 33 QComboBox* sync_combo_box = new QComboBox(sync_group_box); |
| 33 sync_combo_box->addItem(tr("AniList")); | 34 for (const auto& service : Anime::Services) |
| 35 sync_combo_box->addItem(Strings::ToQString(Translate::ToLocalString(service)), static_cast<int>(service)); | |
| 36 | |
| 34 connect(sync_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, | 37 connect(sync_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, |
| 35 [this](int index) { service = static_cast<Anime::Services>(index + 1); }); | 38 [this, sync_combo_box](int index) { |
| 39 service = static_cast<Anime::Service>(sync_combo_box->itemData(index).toInt()); | |
| 40 }); | |
| 41 | |
| 42 /* this is evil */ | |
| 36 sync_combo_box->setCurrentIndex(static_cast<int>(service) - 1); | 43 sync_combo_box->setCurrentIndex(static_cast<int>(service) - 1); |
| 37 sync_layout->addWidget(sync_combo_box); | 44 sync_layout->addWidget(sync_combo_box); |
| 38 } | 45 } |
| 39 | 46 |
| 40 { | 47 { |
