Mercurial > minori
changeset 393:963047512d34
*: clang-format
| author | Paper <paper@tflc.us> |
|---|---|
| date | Fri, 07 Nov 2025 07:16:15 -0500 |
| parents | a72d6d7b3568 |
| children | de10a647eb9b |
| files | .clang-format include/core/byte_stream.h include/core/filesystem.h include/core/http.h include/library/library.h src/core/anime.cc src/core/anime_season.cc src/core/config.cc src/core/filesystem.cc src/core/http.cc src/gui/dialog/settings/application.cc src/gui/dialog/settings/library.cc src/gui/dialog/settings/recognition.cc src/gui/dialog/settings/services.cc src/gui/dialog/settings/torrents.cc src/gui/theme.cc src/gui/window.cc src/library/library.cc src/services/anilist.cc src/services/kitsu.cc src/services/services.cc src/track/media.cc |
| diffstat | 22 files changed, 464 insertions(+), 377 deletions(-) [+] |
line wrap: on
line diff
--- a/.clang-format Fri Nov 07 07:10:32 2025 -0500 +++ b/.clang-format Fri Nov 07 07:16:15 2025 -0500 @@ -10,7 +10,7 @@ # hack!!! AccessModifierOffset: -4 -IndentCaseLabels: true +IndentCaseLabels: false IndentAccessModifiers: false IndentPPDirectives: AfterHash @@ -30,7 +30,7 @@ AllowShortBlocksOnASingleLine: Empty AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: InlineOnly -AllowShortCaseLabelsOnASingleLine: true +AllowShortCaseLabelsOnASingleLine: false Cpp11BracedListStyle: true
--- a/include/core/byte_stream.h Fri Nov 07 07:10:32 2025 -0500 +++ b/include/core/byte_stream.h Fri Nov 07 07:16:15 2025 -0500 @@ -41,23 +41,23 @@ return false; switch (endian_) { - case ByteOrder::Little: - if constexpr (std::is_unsigned<T>::value) { - ret = Endian::byteswap_little_to_host(ret); - } else { - ret = Endian::signed_byteswap_little_to_host(ret); - } - break; - case ByteOrder::Big: - if constexpr (std::is_unsigned<T>::value) { - ret = Endian::byteswap_big_to_host(ret); - } else { - ret = Endian::signed_byteswap_big_to_host(ret); - } - break; - default: - /* can't know for sure. punt */ - return false; + case ByteOrder::Little: + if constexpr (std::is_unsigned<T>::value) { + ret = Endian::byteswap_little_to_host(ret); + } else { + ret = Endian::signed_byteswap_little_to_host(ret); + } + break; + case ByteOrder::Big: + if constexpr (std::is_unsigned<T>::value) { + ret = Endian::byteswap_big_to_host(ret); + } else { + ret = Endian::signed_byteswap_big_to_host(ret); + } + break; + default: + /* can't know for sure. punt */ + return false; } return true;
--- a/include/core/filesystem.h Fri Nov 07 07:10:32 2025 -0500 +++ b/include/core/filesystem.h Fri Nov 07 07:16:15 2025 -0500 @@ -1,8 +1,8 @@ #ifndef MINORI_CORE_FILESYSTEM_H_ #define MINORI_CORE_FILESYSTEM_H_ #include <filesystem> +#include <functional> #include <string> -#include <functional> namespace Filesystem { @@ -32,8 +32,8 @@ }; /* Constructor functions. Yes, I'm doing this the C way :) */ -IWatcher *GetRecursiveFilesystemWatcher(void *opaque, - const std::filesystem::path &path, IWatcher::EventHandler handler); +IWatcher *GetRecursiveFilesystemWatcher(void *opaque, const std::filesystem::path &path, + IWatcher::EventHandler handler); IWatcher *GetFilesystemWatcher(void *opaque, const std::filesystem::path &path, IWatcher::EventHandler handler); } // namespace Filesystem
--- a/include/core/http.h Fri Nov 07 07:10:32 2025 -0500 +++ b/include/core/http.h Fri Nov 07 07:16:15 2025 -0500 @@ -4,10 +4,10 @@ #include <QByteArray> #include <QThread> +#include <atomic> #include <mutex> #include <string> #include <vector> -#include <atomic> namespace HTTP {
--- a/include/library/library.h Fri Nov 07 07:10:32 2025 -0500 +++ b/include/library/library.h Fri Nov 07 07:16:15 2025 -0500 @@ -1,8 +1,8 @@ #ifndef MINORI_LIBRARY_LIBRARY_H_ #define MINORI_LIBRARY_LIBRARY_H_ +#include "core/filesystem.h" #include "library/library.h" -#include "core/filesystem.h" #include <filesystem> #include <optional>
--- a/src/core/anime.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/core/anime.cc Fri Nov 07 07:16:15 2025 -0500 @@ -84,29 +84,31 @@ return ""; switch (session.config.anime_list.score_format) { - case ScoreFormat::Point10Decimal: - return Strings::ToUtf8String(score / 10) + "." + Strings::ToUtf8String(score % 10); - case ScoreFormat::Point10: return Strings::ToUtf8String(score / 10); - case ScoreFormat::Point5: { - std::string stars = ""; + case ScoreFormat::Point10Decimal: + return Strings::ToUtf8String(score / 10) + "." + Strings::ToUtf8String(score % 10); + case ScoreFormat::Point10: + return Strings::ToUtf8String(score / 10); + case ScoreFormat::Point5: { + std::string stars = ""; - for (int i = 0; i < 100; i += 20) - stars.append((i <= score) ? "★" : "☆"); + for (int i = 0; i < 100; i += 20) + stars.append((i <= score) ? "★" : "☆"); - return stars; - } - case ScoreFormat::Point3: { - if (score >= 100) - return ":)"; - else if (score >= 66) - return ":|"; - else if (score >= 33) - return ":("; - else - return ""; - } - default: - case ScoreFormat::Point100: return Strings::ToUtf8String(score); + return stars; + } + case ScoreFormat::Point3: { + if (score >= 100) + return ":)"; + else if (score >= 66) + return ":|"; + else if (score >= 33) + return ":("; + else + return ""; + } + default: + case ScoreFormat::Point100: + return Strings::ToUtf8String(score); } } @@ -332,8 +334,10 @@ return std::nullopt; switch (service) { - case Service::AniList: return "https://anilist.co/anime/" + id.value(); - default: return ""; + case Service::AniList: + return "https://anilist.co/anime/" + id.value(); + default: + return ""; } }
--- a/src/core/anime_season.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/core/anime_season.cc Fri Nov 07 07:16:15 2025 -0500 @@ -6,8 +6,10 @@ static bool WinterStartsInDecember() { switch (session.config.service) { - case Service::MyAnimeList: return false; - default: return true; + case Service::MyAnimeList: + return false; + default: + return true; } } @@ -15,35 +17,45 @@ { if (WinterStartsInDecember()) { switch (month) { - case Date::Month::Dec: - case Date::Month::Jan: - case Date::Month::Feb: return Season::Name::Winter; - case Date::Month::Mar: - case Date::Month::Apr: - case Date::Month::May: return Season::Name::Spring; - case Date::Month::Jun: - case Date::Month::Jul: - case Date::Month::Aug: return Season::Name::Summer; - case Date::Month::Sep: - case Date::Month::Oct: - case Date::Month::Nov: return Season::Name::Autumn; - default: return Season::Name::Unknown; + case Date::Month::Dec: + case Date::Month::Jan: + case Date::Month::Feb: + return Season::Name::Winter; + case Date::Month::Mar: + case Date::Month::Apr: + case Date::Month::May: + return Season::Name::Spring; + case Date::Month::Jun: + case Date::Month::Jul: + case Date::Month::Aug: + return Season::Name::Summer; + case Date::Month::Sep: + case Date::Month::Oct: + case Date::Month::Nov: + return Season::Name::Autumn; + default: + return Season::Name::Unknown; } } else { switch (month) { - case Date::Month::Jan: - case Date::Month::Feb: - case Date::Month::Mar: return Season::Name::Winter; - case Date::Month::Apr: - case Date::Month::May: - case Date::Month::Jun: return Season::Name::Spring; - case Date::Month::Jul: - case Date::Month::Aug: - case Date::Month::Sep: return Season::Name::Summer; - case Date::Month::Oct: - case Date::Month::Nov: - case Date::Month::Dec: return Season::Name::Autumn; - default: return Season::Name::Unknown; + case Date::Month::Jan: + case Date::Month::Feb: + case Date::Month::Mar: + return Season::Name::Winter; + case Date::Month::Apr: + case Date::Month::May: + case Date::Month::Jun: + return Season::Name::Spring; + case Date::Month::Jul: + case Date::Month::Aug: + case Date::Month::Sep: + return Season::Name::Summer; + case Date::Month::Oct: + case Date::Month::Nov: + case Date::Month::Dec: + return Season::Name::Autumn; + default: + return Season::Name::Unknown; } } } @@ -98,14 +110,22 @@ Season &Season::operator++() { switch (season) { - case Season::Name::Winter: season = Season::Name::Spring; break; - case Season::Name::Spring: season = Season::Name::Summer; break; - case Season::Name::Summer: season = Season::Name::Autumn; break; - case Season::Name::Autumn: - season = Season::Name::Winter; - year++; - break; - default: season = Season::Name::Unknown; break; + case Season::Name::Winter: + season = Season::Name::Spring; + break; + case Season::Name::Spring: + season = Season::Name::Summer; + break; + case Season::Name::Summer: + season = Season::Name::Autumn; + break; + case Season::Name::Autumn: + season = Season::Name::Winter; + year++; + break; + default: + season = Season::Name::Unknown; + break; } return *this; @@ -114,14 +134,22 @@ Season &Season::operator--() { switch (season) { - case Season::Name::Winter: - season = Season::Name::Autumn; - year--; - break; - case Season::Name::Spring: season = Season::Name::Winter; break; - case Season::Name::Summer: season = Season::Name::Spring; break; - case Season::Name::Autumn: season = Season::Name::Summer; break; - default: season = Season::Name::Unknown; break; + case Season::Name::Winter: + season = Season::Name::Autumn; + year--; + break; + case Season::Name::Spring: + season = Season::Name::Winter; + break; + case Season::Name::Summer: + season = Season::Name::Spring; + break; + case Season::Name::Autumn: + season = Season::Name::Summer; + break; + default: + season = Season::Name::Unknown; + break; } return *this;
--- a/src/core/config.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/core/config.cc Fri Nov 07 07:16:15 2025 -0500 @@ -91,13 +91,13 @@ for (auto &[enabled, player] : recognition.players) { switch (player.type) { - default: - case animone::PlayerType::Default: - enabled = toml::find_or(data, "Recognition/Players", player.name, true); - break; - case animone::PlayerType::WebBrowser: - enabled = toml::find_or(data, "Recognition/Browsers", player.name, true); - break; + default: + case animone::PlayerType::Default: + enabled = toml::find_or(data, "Recognition/Players", player.name, true); + break; + case animone::PlayerType::WebBrowser: + enabled = toml::find_or(data, "Recognition/Browsers", player.name, true); + break; } }
--- a/src/core/filesystem.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/core/filesystem.cc Fri Nov 07 07:16:15 2025 -0500 @@ -62,15 +62,11 @@ class Watcher : public IWatcher { public: Watcher(void *opaque, const std::filesystem::path &path, EventHandler handler) - : path_(path) - , handler_(handler) - , opaque_(opaque) + : path_(path), handler_(handler), opaque_(opaque) { } - virtual ~Watcher() override - { - } + virtual ~Watcher() override {} protected: std::filesystem::path path_; @@ -87,13 +83,11 @@ class StdFilesystemWatcher : public Watcher { public: StdFilesystemWatcher(void *opaque, const std::filesystem::path &path, EventHandler handler) - : Watcher(opaque, path, handler) + : Watcher(opaque, path, handler) { } - virtual ~StdFilesystemWatcher() override - { - } + virtual ~StdFilesystemWatcher() override {} virtual void Process() override { @@ -157,8 +151,7 @@ std::vector<PathStatus> paths_; }; -IWatcher *GetRecursiveFilesystemWatcher(void *opaque, - const std::filesystem::path &path, IWatcher::EventHandler handler) +IWatcher *GetRecursiveFilesystemWatcher(void *opaque, const std::filesystem::path &path, IWatcher::EventHandler handler) { /* .... :) */ return new StdFilesystemWatcher<std::filesystem::recursive_directory_iterator>(opaque, path, handler);
--- a/src/core/http.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/core/http.cc Fri Nov 07 07:16:15 2025 -0500 @@ -65,7 +65,8 @@ return base; } -static void SetCurlOpts(CURL *curl, const std::string &url, const std::vector<std::string> &headers, const std::string &data, Type type) +static void SetCurlOpts(CURL *curl, const std::string &url, const std::vector<std::string> &headers, + const std::string &data, Type type) { struct curl_slist *list;
--- 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();
--- a/src/gui/dialog/settings/library.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/gui/dialog/settings/library.cc Fri Nov 07 07:16:15 2025 -0500 @@ -14,37 +14,38 @@ #include <QSizePolicy> #include <QVBoxLayout> -QWidget* SettingsPageLibrary::CreateFoldersWidget() { - QWidget* result = new QWidget(this); +QWidget *SettingsPageLibrary::CreateFoldersWidget() +{ + QWidget *result = new QWidget(this); result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* full_layout = new QVBoxLayout(result); + QVBoxLayout *full_layout = new QVBoxLayout(result); { - QGroupBox* group_box = new QGroupBox(tr("Library folders"), result); + QGroupBox *group_box = new QGroupBox(tr("Library folders"), result); group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* group_box_layout = new QVBoxLayout(group_box); + QVBoxLayout *group_box_layout = new QVBoxLayout(group_box); { - QLabel* label = new QLabel(tr("These folders will be scanned and monitored for new episodes."), group_box); + QLabel *label = new QLabel(tr("These folders will be scanned and monitored for new episodes."), group_box); group_box_layout->addWidget(label); } { - DroppableListWidget* listwidget = new DroppableListWidget(group_box); + DroppableListWidget *listwidget = new DroppableListWidget(group_box); listwidget->setSelectionMode(QAbstractItemView::ExtendedSelection); - for (const auto& path : paths) { - QListWidgetItem* item = new QListWidgetItem(listwidget); + for (const auto &path : paths) { + QListWidgetItem *item = new QListWidgetItem(listwidget); item->setText(Strings::ToQString(path)); /* add icons as well soon */ } connect(listwidget, &DroppableListWidget::FilesDropped, this, [this, listwidget](QStringList list) { - for (const auto& dir : list) { + for (const auto &dir : list) { paths.insert(Strings::ToUtf8String(dir)); - QListWidgetItem* item = new QListWidgetItem(listwidget); + QListWidgetItem *item = new QListWidgetItem(listwidget); item->setText(dir); } }); @@ -52,18 +53,18 @@ group_box_layout->addWidget(listwidget); { - QWidget* widget = new QWidget(group_box); - QHBoxLayout* widget_layout = new QHBoxLayout(widget); + QWidget *widget = new QWidget(group_box); + QHBoxLayout *widget_layout = new QHBoxLayout(widget); { - QLabel* label = new QLabel(tr("Tip: You can drag and drop folders here."), widget); + QLabel *label = new QLabel(tr("Tip: You can drag and drop folders here."), widget); widget_layout->addWidget(label); } widget_layout->addStretch(); { - QPushButton* button = new QPushButton(tr("Add new..."), widget); + QPushButton *button = new QPushButton(tr("Add new..."), widget); connect(button, &QPushButton::clicked, this, [this, listwidget] { const QString dir = QFileDialog::getExistingDirectory( @@ -74,7 +75,7 @@ return; paths.insert(s_dir); - QListWidgetItem* item = new QListWidgetItem(listwidget); + QListWidgetItem *item = new QListWidgetItem(listwidget); item->setText(dir); }); @@ -82,16 +83,16 @@ } { - QPushButton* button = new QPushButton(tr("Remove"), widget); + QPushButton *button = new QPushButton(tr("Remove"), widget); connect(listwidget, &QListWidget::itemSelectionChanged, this, [button, listwidget] { - QList<QListWidgetItem*> selection = listwidget->selectedItems(); + QList<QListWidgetItem *> selection = listwidget->selectedItems(); button->setEnabled(selection.size() > 0); }); connect(button, &QPushButton::clicked, this, [this, listwidget] { - QList<QListWidgetItem*> selection = listwidget->selectedItems(); - for (const auto& item : selection) { + QList<QListWidgetItem *> selection = listwidget->selectedItems(); + for (const auto &item : selection) { paths.erase(Strings::ToUtf8String(item->text())); delete item; } @@ -108,13 +109,13 @@ } { - QGroupBox* group_box = new QGroupBox(tr("Real-time monitor"), result); + QGroupBox *group_box = new QGroupBox(tr("Real-time monitor"), result); group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* group_box_layout = new QVBoxLayout(group_box); + QVBoxLayout *group_box_layout = new QVBoxLayout(group_box); { - QCheckBox* checkbox = new QCheckBox(tr("Detect new files and folders under library folders"), group_box); + QCheckBox *checkbox = new QCheckBox(tr("Detect new files and folders under library folders"), group_box); checkbox->setCheckState(real_time_monitor ? Qt::Checked : Qt::Unchecked); connect(checkbox, &QCheckBox::stateChanged, this, @@ -132,13 +133,15 @@ return result; } -void SettingsPageLibrary::SaveInfo() { +void SettingsPageLibrary::SaveInfo() +{ session.config.library.paths = paths; session.config.library.real_time_monitor = real_time_monitor; } -SettingsPageLibrary::SettingsPageLibrary(QWidget* parent) - : SettingsPage(parent, tr("Library")), paths(session.config.library.paths) { +SettingsPageLibrary::SettingsPageLibrary(QWidget *parent) + : SettingsPage(parent, tr("Library")), paths(session.config.library.paths) +{ real_time_monitor = session.config.library.real_time_monitor; AddTab(CreateFoldersWidget(), tr("Folder")); }
--- a/src/gui/dialog/settings/recognition.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/gui/dialog/settings/recognition.cc Fri Nov 07 07:16:15 2025 -0500 @@ -12,39 +12,40 @@ #include <algorithm> -QWidget* SettingsPageRecognition::CreatePlayersWidget() { - QWidget* result = new QWidget(this); +QWidget *SettingsPageRecognition::CreatePlayersWidget() +{ + QWidget *result = new QWidget(this); result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* full_layout = new QVBoxLayout(result); + QVBoxLayout *full_layout = new QVBoxLayout(result); { /* Feed link */ - QWidget* widget = new QWidget(result); - QVBoxLayout* widget_layout = new QVBoxLayout(widget); + QWidget *widget = new QWidget(result); + QVBoxLayout *widget_layout = new QVBoxLayout(widget); - QCheckBox* checkbox = new QCheckBox(result); + QCheckBox *checkbox = new QCheckBox(result); checkbox->setText(tr("Enable media player detection")); checkbox->setCheckState(detect_media_players ? Qt::Checked : Qt::Unchecked); widget_layout->addWidget(checkbox); { - QLabel* label = new QLabel(tr("Allowed media players:"), widget); + QLabel *label = new QLabel(tr("Allowed media players:"), widget); widget_layout->addWidget(label); } { - QListWidget* listwidget = new QListWidget(widget); + QListWidget *listwidget = new QListWidget(widget); for (size_t i = 0; i < players.size(); i++) { - const auto& [enabled, player] = players[i]; + const auto &[enabled, player] = players[i]; if (player.type == animone::PlayerType::Default) { - QListWidgetItem* item = new QListWidgetItem(listwidget); + QListWidgetItem *item = new QListWidgetItem(listwidget); item->setCheckState(enabled ? Qt::Checked : Qt::Unchecked); item->setText(Strings::ToQString(player.name)); item->setData(Qt::UserRole, QVariant::fromValue(i)); } } - connect(listwidget, &QListWidget::itemChanged, this, [this](QListWidgetItem* item) { + connect(listwidget, &QListWidget::itemChanged, this, [this](QListWidgetItem *item) { if (!item) return; size_t i = item->data(Qt::UserRole).toUInt(); @@ -69,13 +70,15 @@ return result; } -void SettingsPageRecognition::SaveInfo() { +void SettingsPageRecognition::SaveInfo() +{ session.config.recognition.detect_media_players = detect_media_players; session.config.recognition.players = players; } -SettingsPageRecognition::SettingsPageRecognition(QWidget* parent) - : SettingsPage(parent, tr("Recognition")), players(session.config.recognition.players) { +SettingsPageRecognition::SettingsPageRecognition(QWidget *parent) + : SettingsPage(parent, tr("Recognition")), players(session.config.recognition.players) +{ detect_media_players = session.config.recognition.detect_media_players; AddTab(CreatePlayersWidget(), tr("Media players")); }
--- a/src/gui/dialog/settings/services.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/gui/dialog/settings/services.cc Fri Nov 07 07:16:15 2025 -0500 @@ -13,32 +13,34 @@ #include <QSizePolicy> #include <QVBoxLayout> -QWidget* SettingsPageServices::CreateMainPage() { - QWidget* result = new QWidget(this); +QWidget *SettingsPageServices::CreateMainPage() +{ + QWidget *result = new QWidget(this); result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* full_layout = new QVBoxLayout(result); + QVBoxLayout *full_layout = new QVBoxLayout(result); { - QGroupBox* sync_group_box = new QGroupBox(tr("Synchronization"), result); + QGroupBox *sync_group_box = new QGroupBox(tr("Synchronization"), result); sync_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* sync_layout = new QVBoxLayout(sync_group_box); + QVBoxLayout *sync_layout = new QVBoxLayout(sync_group_box); { - QLabel* sync_combo_box_label = new QLabel(tr("Active service and metadata provider:"), sync_group_box); + QLabel *sync_combo_box_label = new QLabel(tr("Active service and metadata provider:"), sync_group_box); sync_layout->addWidget(sync_combo_box_label); } { - QComboBox* sync_combo_box = new QComboBox(sync_group_box); - for (const auto& service : Anime::Services) - sync_combo_box->addItem(Strings::ToQString(Translate::ToLocalString(service)), static_cast<int>(service)); + QComboBox *sync_combo_box = new QComboBox(sync_group_box); + 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, sync_combo_box](int index) { - service = static_cast<Anime::Service>(sync_combo_box->itemData(index).toInt()); - }); + service = static_cast<Anime::Service>(sync_combo_box->itemData(index).toInt()); + }); /* this is evil */ sync_combo_box->setCurrentIndex(static_cast<int>(service) - 1); @@ -46,7 +48,7 @@ } { - QLabel* sync_note_label = new QLabel( + QLabel *sync_note_label = new QLabel( tr("Note: Minori is unable to synchronize multiple services at the same time."), sync_group_box); sync_layout->addWidget(sync_note_label); } @@ -60,41 +62,43 @@ return result; } -QWidget* SettingsPageServices::CreateKitsuPage() { - QWidget* result = new QWidget(this); +QWidget *SettingsPageServices::CreateKitsuPage() +{ + QWidget *result = new QWidget(this); result->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); - QVBoxLayout* full_layout = new QVBoxLayout(result); + QVBoxLayout *full_layout = new QVBoxLayout(result); { /* Account */ - QGroupBox* group_box = new QGroupBox(tr("Account"), result); + QGroupBox *group_box = new QGroupBox(tr("Account"), result); group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* group_box_layout = new QVBoxLayout(group_box); + QVBoxLayout *group_box_layout = new QVBoxLayout(group_box); { - QWidget* credentials_grid = new QWidget(group_box); - QGridLayout* credentials_grid_layout = new QGridLayout(credentials_grid); + QWidget *credentials_grid = new QWidget(group_box); + QGridLayout *credentials_grid_layout = new QGridLayout(credentials_grid); /* E-mail */ - QLabel* email_label = new QLabel(tr("&E-mail"), credentials_grid); - QLineEdit* email = new QLineEdit(credentials_grid); + QLabel *email_label = new QLabel(tr("&E-mail"), credentials_grid); + QLineEdit *email = new QLineEdit(credentials_grid); email_label->setBuddy(email); credentials_grid_layout->addWidget(email_label, 0, 0); credentials_grid_layout->addWidget(email, 1, 0); - QLabel* password_label = new QLabel(tr("&Password:"), credentials_grid); - QLineEdit* password = new QLineEdit(credentials_grid); + QLabel *password_label = new QLabel(tr("&Password:"), credentials_grid); + QLineEdit *password = new QLineEdit(credentials_grid); password->setEchoMode(QLineEdit::Password); password_label->setBuddy(password); credentials_grid_layout->addWidget(password_label, 0, 1); credentials_grid_layout->addWidget(password, 1, 1); { - QPushButton* auth_button = new QPushButton(credentials_grid); + QPushButton *auth_button = new QPushButton(credentials_grid); connect(auth_button, &QPushButton::clicked, this, [auth_button, email, password] { - if (Services::Kitsu::AuthorizeUser(Strings::ToUtf8String(email->text()), Strings::ToUtf8String(password->text()))) + if (Services::Kitsu::AuthorizeUser(Strings::ToUtf8String(email->text()), + Strings::ToUtf8String(password->text()))) auth_button->setText(tr("Re-authorize...")); else auth_button->setText(tr("Authorize...")); @@ -111,7 +115,11 @@ { /* Note on password storing */ - QLabel* note_label = new QLabel(tr("Your e-mail and password are never stored by Minori and will only be used to authorize with Kitsu.\nFor more information, see <a href=\"https://kitsu.docs.apiary.io/#introduction/authentication\">Kitsu's API documentation</a>"), group_box); + QLabel *note_label = new QLabel( + tr("Your e-mail and password are never stored by Minori and will only be used to authorize with " + "Kitsu.\nFor more information, see <a " + "href=\"https://kitsu.docs.apiary.io/#introduction/authentication\">Kitsu's API documentation</a>"), + group_box); note_label->setTextFormat(Qt::RichText); note_label->setWordWrap(true); note_label->setTextInteractionFlags(Qt::TextBrowserInteraction); @@ -128,26 +136,27 @@ return result; } -QWidget* SettingsPageServices::CreateAniListPage() { - QWidget* result = new QWidget(this); +QWidget *SettingsPageServices::CreateAniListPage() +{ + QWidget *result = new QWidget(this); result->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); - QVBoxLayout* full_layout = new QVBoxLayout(result); + QVBoxLayout *full_layout = new QVBoxLayout(result); { /* Account */ - QGroupBox* group_box = new QGroupBox(tr("Account"), result); + QGroupBox *group_box = new QGroupBox(tr("Account"), result); group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* layout = new QVBoxLayout(group_box); + QVBoxLayout *layout = new QVBoxLayout(group_box); { /* Authorization */ - QWidget* auth_widget = new QWidget(group_box); - QHBoxLayout* auth_layout = new QHBoxLayout(auth_widget); + QWidget *auth_widget = new QWidget(group_box); + QHBoxLayout *auth_layout = new QHBoxLayout(auth_widget); { - QPushButton* auth_button = new QPushButton(auth_widget); + QPushButton *auth_button = new QPushButton(auth_widget); connect(auth_button, &QPushButton::clicked, this, [] { Services::AniList::AuthorizeUser(); }); auth_button->setText(session.config.auth.anilist.auth_token.empty() ? tr("Authorize...") : tr("Re-authorize...")); @@ -159,7 +168,7 @@ { /* Note on creating new accounts... */ - QLabel* note_label = + QLabel *note_label = new QLabel(tr("<a href=\"http://anilist.co/\">Create a new AniList account</a>"), group_box); note_label->setTextFormat(Qt::RichText); note_label->setWordWrap(true); @@ -176,12 +185,14 @@ return result; } -void SettingsPageServices::SaveInfo() { +void SettingsPageServices::SaveInfo() +{ // see services/anilist.cc for why this is commented out session.config.service = service; } -SettingsPageServices::SettingsPageServices(QWidget* parent) : SettingsPage(parent, tr("Services")) { +SettingsPageServices::SettingsPageServices(QWidget *parent) : SettingsPage(parent, tr("Services")) +{ service = session.config.service; AddTab(CreateMainPage(), tr("Main")); AddTab(CreateKitsuPage(), tr("Kitsu"));
--- a/src/gui/dialog/settings/torrents.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/gui/dialog/settings/torrents.cc Fri Nov 07 07:16:15 2025 -0500 @@ -8,32 +8,33 @@ #include <QVBoxLayout> #include <algorithm> -QWidget* SettingsPageTorrents::CreateGeneralWidget() { - QWidget* result = new QWidget(this); +QWidget *SettingsPageTorrents::CreateGeneralWidget() +{ + QWidget *result = new QWidget(this); result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* full_layout = new QVBoxLayout(result); + QVBoxLayout *full_layout = new QVBoxLayout(result); { /* URLs */ - QGroupBox* group = new QGroupBox(tr("URLs"), result); + QGroupBox *group = new QGroupBox(tr("URLs"), result); group->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QVBoxLayout* group_layout = new QVBoxLayout(group); + QVBoxLayout *group_layout = new QVBoxLayout(group); { /* Feed link */ - QWidget* widget = new QWidget(group); - QVBoxLayout* widget_layout = new QVBoxLayout(widget); + QWidget *widget = new QWidget(group); + QVBoxLayout *widget_layout = new QVBoxLayout(widget); { - QLabel* sync_combo_box_label = new QLabel(tr("URL of the RSS feed to check:"), widget); + QLabel *sync_combo_box_label = new QLabel(tr("URL of the RSS feed to check:"), widget); widget_layout->addWidget(sync_combo_box_label); } { /* Username: this literally never gets used btw */ - QLineEdit* lineedit = new QLineEdit(Strings::ToQString(feed_link), widget); + QLineEdit *lineedit = new QLineEdit(Strings::ToQString(feed_link), widget); connect(lineedit, &QLineEdit::editingFinished, this, [this, lineedit] { feed_link = Strings::ToUtf8String(lineedit->text()); }); widget_layout->addWidget(lineedit); @@ -51,11 +52,13 @@ return result; } -void SettingsPageTorrents::SaveInfo() { +void SettingsPageTorrents::SaveInfo() +{ session.config.torrents.feed_link = feed_link; } -SettingsPageTorrents::SettingsPageTorrents(QWidget* parent) : SettingsPage(parent, tr("Torrents")) { +SettingsPageTorrents::SettingsPageTorrents(QWidget *parent) : SettingsPage(parent, tr("Torrents")) +{ feed_link = session.config.torrents.feed_link; AddTab(CreateGeneralWidget(), tr("General")); }
--- a/src/gui/theme.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/gui/theme.cc Fri Nov 07 07:16:15 2025 -0500 @@ -43,25 +43,26 @@ bool ThemeManager::IsInDarkTheme() const { switch (theme) { - case Theme::Default: + case Theme::Default: #ifdef MACOSX - if (osx::DarkThemeAvailable()) - return osx::IsInDarkTheme(); + if (osx::DarkThemeAvailable()) + return osx::IsInDarkTheme(); #elif defined(WIN32) - if (win32::DarkThemeAvailable()) - return win32::IsInDarkTheme(); + if (win32::DarkThemeAvailable()) + return win32::IsInDarkTheme(); #else # ifdef HAVE_XCB - if (x11::IsInDarkTheme()) - return true; + if (x11::IsInDarkTheme()) + return true; # endif # ifdef GLIB - if (glib::IsInDarkTheme()) - return true; + if (glib::IsInDarkTheme()) + return true; # endif - break; + break; #endif - default: break; + default: + break; } return (theme == Theme::Dark); } @@ -103,71 +104,75 @@ void ThemeManager::SetStyleSheet(Theme theme) { switch (theme) { - case Theme::Dark: { - const QColor darkGray(53, 53, 53); - const QColor gray(128, 128, 128); - const QColor black(25, 25, 25); - const QColor blue(42, 130, 218); + case Theme::Dark: { + const QColor darkGray(53, 53, 53); + const QColor gray(128, 128, 128); + const QColor black(25, 25, 25); + const QColor blue(42, 130, 218); - QPalette pal; + QPalette pal; - pal.setColor(QPalette::Window, darkGray); - pal.setColor(QPalette::WindowText, Qt::white); - pal.setColor(QPalette::Base, black); - pal.setColor(QPalette::AlternateBase, darkGray); - pal.setColor(QPalette::ToolTipBase, blue); - pal.setColor(QPalette::ToolTipText, Qt::white); - pal.setColor(QPalette::Text, Qt::white); - pal.setColor(QPalette::Button, darkGray); - pal.setColor(QPalette::ButtonText, Qt::white); - pal.setColor(QPalette::Link, blue); - pal.setColor(QPalette::Highlight, blue); - pal.setColor(QPalette::HighlightedText, Qt::black); + pal.setColor(QPalette::Window, darkGray); + pal.setColor(QPalette::WindowText, Qt::white); + pal.setColor(QPalette::Base, black); + pal.setColor(QPalette::AlternateBase, darkGray); + pal.setColor(QPalette::ToolTipBase, blue); + pal.setColor(QPalette::ToolTipText, Qt::white); + pal.setColor(QPalette::Text, Qt::white); + pal.setColor(QPalette::Button, darkGray); + pal.setColor(QPalette::ButtonText, Qt::white); + pal.setColor(QPalette::Link, blue); + pal.setColor(QPalette::Highlight, blue); + pal.setColor(QPalette::HighlightedText, Qt::black); - pal.setColor(QPalette::Active, QPalette::Button, gray.darker()); - pal.setColor(QPalette::Disabled, QPalette::ButtonText, gray); - pal.setColor(QPalette::Disabled, QPalette::WindowText, gray); - pal.setColor(QPalette::Disabled, QPalette::Text, gray); - pal.setColor(QPalette::Disabled, QPalette::Light, darkGray); + pal.setColor(QPalette::Active, QPalette::Button, gray.darker()); + pal.setColor(QPalette::Disabled, QPalette::ButtonText, gray); + pal.setColor(QPalette::Disabled, QPalette::WindowText, gray); + pal.setColor(QPalette::Disabled, QPalette::Text, gray); + pal.setColor(QPalette::Disabled, QPalette::Light, darkGray); - qApp->setPalette(pal); + qApp->setPalette(pal); #ifdef WIN32 - qApp->setStyleSheet([] { - QFile f(":/dark.qss"); - if (!f.exists()) - return QStringLiteral(""); - f.open(QFile::ReadOnly | QFile::Text); - QTextStream ts(&f); - return ts.readAll(); - }()); + qApp->setStyleSheet([] { + QFile f(":/dark.qss"); + if (!f.exists()) + return QStringLiteral(""); + f.open(QFile::ReadOnly | QFile::Text); + QTextStream ts(&f); + return ts.readAll(); + }()); #endif - break; - } - default: - /* this sucks */ - QPalette pal(QApplication::style()->standardPalette()); + break; + } + default: + /* this sucks */ + QPalette pal(QApplication::style()->standardPalette()); #ifdef WIN32 /* fuck you Qt 6 */ - pal.setColor(QPalette::Window, QColor(0xF0, 0xF0, 0xF0)); + pal.setColor(QPalette::Window, QColor(0xF0, 0xF0, 0xF0)); #endif - qApp->setPalette(pal); + qApp->setPalette(pal); - qApp->setStyleSheet(""); - break; + qApp->setStyleSheet(""); + break; } } void ThemeManager::SetTheme(Theme theme) { switch (theme) { - case Theme::Light: SetToLightTheme(); break; - case Theme::Dark: SetToDarkTheme(); break; - case Theme::Default: - if (GetCurrentOSTheme() == Theme::Light) - SetToLightTheme(); - else - SetToDarkTheme(); - break; + case Theme::Light: + SetToLightTheme(); + break; + case Theme::Dark: + SetToDarkTheme(); + break; + case Theme::Default: + if (GetCurrentOSTheme() == Theme::Light) + SetToLightTheme(); + else + SetToDarkTheme(); + break; } this->theme = theme; }
--- a/src/gui/window.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/gui/window.cc Fri Nov 07 07:16:15 2025 -0500 @@ -549,10 +549,13 @@ { if (event) { /* is this really necessary */ switch (event->type()) { - // this event is send if a translator is loaded - case QEvent::LanguageChange: RetranslateUI(); break; + // this event is send if a translator is loaded + case QEvent::LanguageChange: + RetranslateUI(); + break; - default: break; + default: + break; } } QMainWindow::changeEvent(event);
--- a/src/library/library.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/library/library.cc Fri Nov 07 07:16:15 2025 -0500 @@ -26,7 +26,8 @@ if (watchers_.count(p)) continue; - watchers_[p].reset(Filesystem::GetRecursiveFilesystemWatcher(reinterpret_cast<void *>(this), p, Database::StaticEventHandler)); + watchers_[p].reset( + Filesystem::GetRecursiveFilesystemWatcher(reinterpret_cast<void *>(this), p, Database::StaticEventHandler)); } } @@ -43,8 +44,7 @@ if (id <= 0 || (find_id_ && find_id_.value() != id)) return false; - const int episode = - Strings::ToInt<int>(Strings::ToUtf8String(elements.get(anitomy::kElementEpisodeNumber))); + const int episode = Strings::ToInt<int>(Strings::ToUtf8String(elements.get(anitomy::kElementEpisodeNumber))); *aid = id; *ep = episode;
--- a/src/services/anilist.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/services/anilist.cc Fri Nov 07 07:16:15 2025 -0500 @@ -139,11 +139,16 @@ return "REWATCHING"; switch (anime.GetUserStatus()) { - case Anime::ListStatus::Planning: return "PLANNING"; - case Anime::ListStatus::Completed: return "COMPLETED"; - case Anime::ListStatus::Dropped: return "DROPPED"; - case Anime::ListStatus::Paused: return "PAUSED"; - default: break; + case Anime::ListStatus::Planning: + return "PLANNING"; + case Anime::ListStatus::Completed: + return "COMPLETED"; + case Anime::ListStatus::Dropped: + return "DROPPED"; + case Anime::ListStatus::Paused: + return "PAUSED"; + default: + break; } return "CURRENT"; }
--- a/src/services/kitsu.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/services/kitsu.cc Fri Nov 07 07:16:15 2025 -0500 @@ -140,8 +140,7 @@ static std::optional<nlohmann::json> SendJSONAPIRequest(const std::string &path, const std::map<std::string, std::string> ¶ms = {}, - const std::string &data = "", - HTTP::Type type = HTTP::Type::Get) + const std::string &data = "", HTTP::Type type = HTTP::Type::Get) { std::optional<std::string> token = AccountAccessToken(); if (!token) @@ -551,7 +550,7 @@ std::map<std::string, std::string> params = anime_params; params["filter[text]"] = search; // ... for some reason, this seems to be buggy - //AddAnimeFilters(params); + // AddAnimeFilters(params); std::optional<nlohmann::json> response = SendJSONAPIRequest("/anime", params); if (!response) @@ -581,10 +580,10 @@ bool GetSeason(Anime::Season season) { static const std::map<Anime::Season::Name, std::string> map = { - {Anime::Season::Name::Winter, "winter"}, - {Anime::Season::Name::Spring, "spring"}, - {Anime::Season::Name::Summer, "summer"}, - {Anime::Season::Name::Autumn, "fall"}, + {Anime::Season::Name::Winter, "winter"}, + {Anime::Season::Name::Spring, "spring"}, + {Anime::Season::Name::Summer, "summer"}, + {Anime::Season::Name::Autumn, "fall" }, }; session.SetStatusBar(Strings::Translate("Kitsu: Retrieving season data...")); @@ -593,7 +592,7 @@ params["filter[season]"] = map.at(season.season); params["filter[seasonYear]"] = Strings::ToUtf8String(season.year); // ... for some reason, this seems to be buggy - //AddAnimeFilters(params); + // AddAnimeFilters(params); std::optional<nlohmann::json> response = SendJSONAPIRequest("/anime", params); if (!response) @@ -616,11 +615,16 @@ static std::string UserStatusToString(Anime::ListStatus status) { switch (status) { - case Anime::ListStatus::Planning: return "planned"; - case Anime::ListStatus::Completed: return "completed"; - case Anime::ListStatus::Dropped: return "dropped"; - case Anime::ListStatus::Paused: return "on_hold"; - default: break; + case Anime::ListStatus::Planning: + return "planned"; + case Anime::ListStatus::Completed: + return "completed"; + case Anime::ListStatus::Dropped: + return "dropped"; + case Anime::ListStatus::Paused: + return "on_hold"; + default: + break; } return "current"; @@ -635,35 +639,34 @@ return 0; /* WTF */ nlohmann::json json = { - {"data", { - {"type", "libraryEntries"}, - {"attributes", { - {"status", UserStatusToString(anime.GetUserStatus())}, - {"progress", anime.GetUserProgress()}, - {"reconsuming", anime.GetUserIsRewatching()}, - {"reconsumeCount", anime.GetUserRewatchedTimes()}, - {"notes", anime.GetUserNotes()}, - {"private", anime.GetUserIsPrivate()}, - // WTF is reactionSkipped? - {"startedAt", anime.GetUserDateStarted().GetAsISO8601()}, - {"finishedAt", anime.GetUserDateCompleted().GetAsISO8601()}, - }}, - {"relationships", { - {"anime", { - {"data", { - {"type", "anime"}, - {"id", anime.GetServiceId(Anime::Service::Kitsu)}, - }} - }}, - {"user", { - {"data", { - {"type", "users"}, - {"id", session.config.auth.kitsu.user_id}, - }} - }} - }} - }} - }; + {"data", + {{"type", "libraryEntries"}, + {"attributes", + { + {"status", UserStatusToString(anime.GetUserStatus())}, + {"progress", anime.GetUserProgress()}, + {"reconsuming", anime.GetUserIsRewatching()}, + {"reconsumeCount", anime.GetUserRewatchedTimes()}, + {"notes", anime.GetUserNotes()}, + {"private", anime.GetUserIsPrivate()}, + // WTF is reactionSkipped? + {"startedAt", anime.GetUserDateStarted().GetAsISO8601()}, + {"finishedAt", anime.GetUserDateCompleted().GetAsISO8601()}, + }}, + {"relationships", + {{"anime", + {{"data", + { + {"type", "anime"}, + {"id", anime.GetServiceId(Anime::Service::Kitsu)}, + }}}}, + {"user", + {{"data", + { + {"type", "users"}, + {"id", session.config.auth.kitsu.user_id}, + }}}}}}}} + }; nlohmann::json &attributes = json["data"]["attributes"];
--- a/src/services/services.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/services/services.cc Fri Nov 07 07:16:15 2025 -0500 @@ -15,9 +15,14 @@ fmt::format(Strings::Translate("{}: Retrieving anime list..."), Translate::ToString(session.config.service))); switch (session.config.service) { - case Anime::Service::AniList: AniList::GetAnimeList(); break; - case Anime::Service::Kitsu: Kitsu::GetAnimeList(); break; - default: break; + case Anime::Service::AniList: + AniList::GetAnimeList(); + break; + case Anime::Service::Kitsu: + Kitsu::GetAnimeList(); + break; + default: + break; } } @@ -30,8 +35,10 @@ bool RetrieveAnimeMetadata(int id) { switch (session.config.service) { - case Anime::Service::Kitsu: return Kitsu::RetrieveAnimeMetadata(id); - default: return false; + case Anime::Service::Kitsu: + return Kitsu::RetrieveAnimeMetadata(id); + default: + return false; } } @@ -41,9 +48,12 @@ fmt::format(Strings::Translate("{}: Requesting search query..."), Translate::ToString(session.config.service))); switch (session.config.service) { - case Anime::Service::AniList: return AniList::Search(search); - case Anime::Service::Kitsu: return Kitsu::Search(search); - default: return {}; + case Anime::Service::AniList: + return AniList::Search(search); + case Anime::Service::Kitsu: + return Kitsu::Search(search); + default: + return {}; } } @@ -53,9 +63,12 @@ Translate::ToString(session.config.service))); switch (session.config.service) { - case Anime::Service::AniList: return AniList::GetSeason(season); - case Anime::Service::Kitsu: return Kitsu::GetSeason(season); - default: return {}; + case Anime::Service::AniList: + return AniList::GetSeason(season); + case Anime::Service::Kitsu: + return Kitsu::GetSeason(season); + default: + return {}; } } @@ -65,9 +78,14 @@ Translate::ToString(session.config.service))); switch (session.config.service) { - case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break; - case Anime::Service::Kitsu: Kitsu::UpdateAnimeEntry(id); break; - default: break; + case Anime::Service::AniList: + AniList::UpdateAnimeEntry(id); + break; + case Anime::Service::Kitsu: + Kitsu::UpdateAnimeEntry(id); + break; + default: + break; } }
--- a/src/track/media.cc Fri Nov 07 07:10:32 2025 -0500 +++ b/src/track/media.cc Fri Nov 07 07:16:15 2025 -0500 @@ -48,17 +48,20 @@ for (const auto &media : result.media) { for (const auto &info : media.information) { switch (info.type) { - case animone::MediaInfoType::File: - vec.push_back(std::filesystem::path(info.value).filename().u8string()); - success |= true; - break; - case animone::MediaInfoType::Title: - vec.push_back(info.value); - success |= true; - break; - case animone::MediaInfoType::Tab: break; - case animone::MediaInfoType::Url: break; - default: break; + case animone::MediaInfoType::File: + vec.push_back(std::filesystem::path(info.value).filename().u8string()); + success |= true; + break; + case animone::MediaInfoType::Title: + vec.push_back(info.value); + success |= true; + break; + case animone::MediaInfoType::Tab: + break; + case animone::MediaInfoType::Url: + break; + default: + break; } } }
