Mercurial > minori
diff 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 |
line wrap: on
line diff
--- a/src/gui/dialog/settings/services.cc Thu Apr 18 17:24:42 2024 -0400 +++ b/src/gui/dialog/settings/services.cc Fri Apr 19 13:24:06 2024 -0400 @@ -2,6 +2,7 @@ #include "core/session.h" #include "core/strings.h" #include "gui/dialog/settings.h" +#include "gui/translate/anime.h" #include "services/anilist.h" #include <QComboBox> #include <QGroupBox> @@ -30,9 +31,15 @@ { QComboBox* sync_combo_box = new QComboBox(sync_group_box); - sync_combo_box->addItem(tr("AniList")); + for (const auto& service : Anime::Services) + sync_combo_box->addItem(Strings::ToQString(Translate::ToLocalString(service)), static_cast<int>(service)); + connect(sync_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, - [this](int index) { service = static_cast<Anime::Services>(index + 1); }); + [this, sync_combo_box](int index) { + service = static_cast<Anime::Service>(sync_combo_box->itemData(index).toInt()); + }); + + /* this is evil */ sync_combo_box->setCurrentIndex(static_cast<int>(service) - 1); sync_layout->addWidget(sync_combo_box); }