Mercurial > minori
changeset 63:3d2decf093bb
*: fix many clang warnings
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 01 Oct 2023 06:39:47 -0400 |
parents | 4c6dd5999b39 |
children | fe719c109dbc |
files | CMakeLists.txt include/core/config.h include/core/filesystem.h include/gui/dark_theme.h include/gui/dialog/information.h include/gui/pages/anime_list.h include/gui/translate/anilist.h include/gui/widgets/optional_date.h include/gui/widgets/text.h include/services/anilist.h src/core/date.cpp src/core/filesystem.cpp src/gui/dark_theme.cpp src/gui/dialog/about.cpp src/gui/dialog/information.cpp src/gui/dialog/settings/services.cpp src/gui/pages/anime_list.cpp src/gui/pages/statistics.cpp src/gui/translate/anilist.cpp src/gui/widgets/optional_date.cpp src/gui/widgets/sidebar.cpp src/gui/widgets/text.cpp src/gui/window.cpp src/services/anilist.cpp src/services/services.cpp |
diffstat | 25 files changed, 139 insertions(+), 147 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Sun Oct 01 06:16:06 2023 -0400 +++ b/CMakeLists.txt Sun Oct 01 06:39:47 2023 -0400 @@ -101,8 +101,7 @@ endif() add_executable(minori ${SRC_FILES}) -# There's a bug in JFMC++ that keeps me from setting this to C++11. -set_property(TARGET minori PROPERTY CXX_STANDARD 17) +set_property(TARGET minori PROPERTY CXX_STANDARD 11) set_property(TARGET minori PROPERTY AUTOMOC ON) set_property(TARGET minori PROPERTY AUTORCC ON) @@ -112,7 +111,7 @@ else() target_include_directories(minori PUBLIC ${Qt5Widgets_INCLUDE_DIRS}) endif() -target_compile_options(minori PRIVATE -Wall -Wextra -Wsuggest-override) +target_compile_options(minori PRIVATE -Wall -Wpedantic -Wextra -Wsuggest-override) if(APPLE) target_compile_definitions(minori PUBLIC MACOSX) elseif(WIN32)
--- a/include/core/config.h Sun Oct 01 06:16:06 2023 -0400 +++ b/include/core/config.h Sun Oct 01 06:39:47 2023 -0400 @@ -33,12 +33,12 @@ } anilist; }; -#define WIDEIFY_EX(x) L ## x -#define WIDEIFY(x) WIDEIFY_EX(x) -#define CONFIG_DIR "minori" -#define CONFIG_WDIR WIDEIFY(CONFIG_DIR) -#define CONFIG_NAME "config.json" -#define CONFIG_WNAME WIDEIFY(CONFIG_NAME) +#define WIDEIFY_EX(x) L##x +#define WIDEIFY(x) WIDEIFY_EX(x) +#define CONFIG_DIR "minori" +#define CONFIG_WDIR WIDEIFY(CONFIG_DIR) +#define CONFIG_NAME "config.json" +#define CONFIG_WNAME WIDEIFY(CONFIG_NAME) #define MAX_LINE_LENGTH 256 #endif // __core__config_h
--- a/include/core/filesystem.h Sun Oct 01 06:16:06 2023 -0400 +++ b/include/core/filesystem.h Sun Oct 01 06:39:47 2023 -0400 @@ -5,25 +5,25 @@ namespace Filesystem { class Path { - public: - Path(); - Path(const std::string& path); - Path(const Path& path); - bool CreateDirectories() const; - bool Exists() const; - std::string Basename() const; - std::string Stem() const; - std::string Extension() const; - Path GetParent() const; - void SetPath(const std::string& path); + public: + Path(); + Path(const std::string& path); + Path(const Path& path); + bool CreateDirectories() const; + bool Exists() const; + std::string Basename() const; + std::string Stem() const; + std::string Extension() const; + Path GetParent() const; + void SetPath(const std::string& path); std::string GetPath() const; - private: - std::string _path; + private: + std::string _path; }; -Path GetDotPath(); // %APPDATA%/minori, ~/Library/Application Support/minori, ~/.config/minori... -Path GetConfigPath(); // (dotpath)/config.json +Path GetDotPath(); // %APPDATA%/minori, ~/Library/Application Support/minori, ~/.config/minori... +Path GetConfigPath(); // (dotpath)/config.json Path GetAnimeDBPath(); // (dotpath)/anime/db.json } // namespace Filesystem
--- a/include/gui/dark_theme.h Sun Oct 01 06:16:06 2023 -0400 +++ b/include/gui/dark_theme.h Sun Oct 01 06:39:47 2023 -0400 @@ -11,6 +11,6 @@ enum Themes GetCurrentOSTheme(); void SetTheme(enum Themes theme); -} +} // namespace DarkTheme #endif // __gui__dark_theme_h
--- a/include/gui/dialog/information.h Sun Oct 01 06:16:06 2023 -0400 +++ b/include/gui/dialog/information.h Sun Oct 01 06:39:47 2023 -0400 @@ -1,9 +1,9 @@ #ifndef __gui__dialog__information_h #define __gui__dialog__information_h +#include "core/anime.h" +#include "core/date.h" #include <QDialog> #include <functional> -#include "core/date.h" -#include "core/anime.h" class InformationDialog : public QDialog { Q_OBJECT @@ -14,7 +14,6 @@ private: unsigned int id; unsigned int progress; - unsigned int episodes; unsigned int score; bool rewatching; Anime::ListStatus status;
--- a/include/gui/pages/anime_list.h Sun Oct 01 06:16:06 2023 -0400 +++ b/include/gui/pages/anime_list.h Sun Oct 01 06:39:47 2023 -0400 @@ -9,7 +9,7 @@ #include <vector> class AnimeListWidgetDelegate : public QStyledItemDelegate { - Q_OBJECT + Q_OBJECT public: explicit AnimeListWidgetDelegate(QObject* parent); @@ -19,7 +19,7 @@ }; class AnimeListWidgetSortFilter : public QSortFilterProxyModel { - Q_OBJECT + Q_OBJECT public: AnimeListWidgetSortFilter(QObject* parent = nullptr); @@ -29,7 +29,7 @@ }; class AnimeListWidgetModel : public QAbstractListModel { - Q_OBJECT + Q_OBJECT public: enum columns { @@ -66,7 +66,7 @@ /* todo: rename these to "page" or something more sensible than "widget" */ class AnimeListWidget : public QWidget { - Q_OBJECT + Q_OBJECT public: AnimeListWidget(QWidget* parent);
--- a/include/gui/translate/anilist.h Sun Oct 01 06:16:06 2023 -0400 +++ b/include/gui/translate/anilist.h Sun Oct 01 06:39:47 2023 -0400 @@ -2,12 +2,14 @@ #define __gui__translate__anilist_h #include "core/anime.h" -namespace Translate::AniList { +namespace Translate { +namespace AniList { Anime::SeriesStatus ToSeriesStatus(std::string status); Anime::SeriesSeason ToSeriesSeason(std::string season); Anime::SeriesFormat ToSeriesFormat(std::string format); -} +} // namespace AniList +} // namespace Translate #endif // __gui__translate__anilist_h
--- a/include/gui/widgets/optional_date.h Sun Oct 01 06:16:06 2023 -0400 +++ b/include/gui/widgets/optional_date.h Sun Oct 01 06:39:47 2023 -0400 @@ -1,14 +1,14 @@ #ifndef __gui__widgets__optional_date_h #define __gui__widgets__optional_date_h +#include "core/date.h" #include <QWidget> -#include "core/date.h" class QCheckBox; class QDateEdit; class QDate; class OptionalDate : public QWidget { - Q_OBJECT + Q_OBJECT public: OptionalDate(QWidget* parent = nullptr);
--- a/include/gui/widgets/text.h Sun Oct 01 06:16:06 2023 -0400 +++ b/include/gui/widgets/text.h Sun Oct 01 06:39:47 2023 -0400 @@ -73,5 +73,5 @@ Header* header; Paragraph* paragraph; }; -}; // namespace UiUtils +}; // namespace TextWidgets #endif // __gui__ui_utils_h
--- a/include/services/anilist.h Sun Oct 01 06:16:06 2023 -0400 +++ b/include/services/anilist.h Sun Oct 01 06:39:47 2023 -0400 @@ -5,7 +5,8 @@ #include "core/json.h" #include <curl/curl.h> -namespace Services::AniList { +namespace Services { +namespace AniList { bool AuthorizeUser(); @@ -15,6 +16,7 @@ /* Write queries (mutations) */ int UpdateAnimeEntry(int id); -}; // namespace Services::AniList +} // namespace AniList +} // namespace Services #endif // __services__anilist_h
--- a/src/core/date.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/core/date.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -2,31 +2,13 @@ #include "core/json.h" #include <QDate> #include <QDebug> +#include <algorithm> #include <cstdint> #include <tuple> /* An implementation of AniList's "fuzzy date" */ -#define MIN(A, B) \ - ({ \ - __typeof__(A) __a = (A); \ - __typeof__(B) __b = (B); \ - __a < __b ? __a : __b; \ - }) -#define MAX(A, B) \ - ({ \ - __typeof__(A) __a = (A); \ - __typeof__(B) __b = (B); \ - __a < __b ? __b : __a; \ - }) - -#define CLAMP(x, low, high) \ - ({ \ - __typeof__(x) __x = (x); \ - __typeof__(low) __low = (low); \ - __typeof__(high) __high = (high); \ - __x > __high ? __high : (__x < __low ? __low : __x); \ - }) +#define CLAMP(x, low, high) (std::max(low, std::min(high, x))) Date::Date() { } @@ -60,7 +42,7 @@ } void Date::SetYear(unsigned int y) { - year.reset(new unsigned int(MAX(0U, y))); + year.reset(new unsigned int(y)); } void Date::SetMonth(unsigned int m) {
--- a/src/core/filesystem.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/core/filesystem.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -23,9 +23,15 @@ namespace Filesystem { -Path::Path() { _path = ""; } -Path::Path(const std::string& path) { _path = path; } -Path::Path(const Path& path) { _path = path.GetPath(); } +Path::Path() { + _path = ""; +} +Path::Path(const std::string& path) { + _path = path; +} +Path::Path(const Path& path) { + _path = path.GetPath(); +} bool Path::CreateDirectories() const { std::string temp = ""; @@ -90,7 +96,8 @@ std::string ret = ""; #ifdef WIN32 std::wstring buf(MAX_PATH, '\0'); - if (SHGetFolderPathAndSubDirW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, CONFIG_WDIR, &buf.front()) == S_OK) { + if (SHGetFolderPathAndSubDirW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, CONFIG_WDIR, &buf.front()) == + S_OK) { buf.resize(buf.find('\0')); ret += Strings::ToUtf8String(buf); }
--- a/src/gui/dark_theme.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/gui/dark_theme.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -1,8 +1,8 @@ +#include "core/config.h" +#include "core/session.h" #include <QApplication> #include <QFile> #include <QTextStream> -#include "core/config.h" -#include "core/session.h" #ifdef MACOSX # include "sys/osx/dark_theme.h" #else @@ -58,7 +58,7 @@ osx::SetToDarkTheme(); else #endif - SetStyleSheet(Themes::DARK); + SetStyleSheet(Themes::DARK); } void SetToLightTheme() {
--- a/src/gui/dialog/about.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/gui/dialog/about.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -1,20 +1,18 @@ -#include "core/version.h" -#include "gui/widgets/text.h" #include "gui/dialog/about.h" #include "core/json.h" +#include "core/version.h" +#include "gui/widgets/text.h" #include "pugixml.hpp" -#include <curl/curl.h> #include <QFont> -#include <QTextCharFormat> -#include <QTextBrowser> -#include <QTextCursor> #include <QHBoxLayout> +#include <QTextBrowser> +#include <QTextCharFormat> +#include <QTextCursor> +#include <curl/curl.h> -#define CONCAT_VERSION_NX(major, minor, patch) \ - ("v" #major "." #minor "." #patch) +#define CONCAT_VERSION_NX(major, minor, patch) ("v" #major "." #minor "." #patch) -#define CONCAT_VERSION(major, minor, patch) \ - CONCAT_VERSION_NX(major, minor, patch) +#define CONCAT_VERSION(major, minor, patch) CONCAT_VERSION_NX(major, minor, patch) #define SET_TITLE_FONT(font, format, cursor) \ { \ @@ -99,7 +97,9 @@ UNSET_FONT_BOLD(font, format, cursor); cursor.insertBlock(); SET_FORMAT_HYPERLINK(format, cursor, "https://github.com/nlohmann/json"); - cursor.insertText(tr("JSON for Modern C++ ") + CONCAT_VERSION(NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, NLOHMANN_JSON_VERSION_PATCH)); + cursor.insertText(tr("JSON for Modern C++ ") + CONCAT_VERSION(NLOHMANN_JSON_VERSION_MAJOR, + NLOHMANN_JSON_VERSION_MINOR, + NLOHMANN_JSON_VERSION_PATCH)); UNSET_FORMAT_HYPERLINK(format, cursor); cursor.insertText(", "); { @@ -114,7 +114,8 @@ UNSET_FORMAT_HYPERLINK(format, cursor); cursor.insertText(", "); SET_FORMAT_HYPERLINK(format, cursor, "https://pugixml.org/"); - cursor.insertText(tr("pugixml v") + QString::number(PUGIXML_VERSION / 1000) + "." + QString::number(PUGIXML_VERSION / 10 % 100) + "." + QString::number(PUGIXML_VERSION % 10)); + cursor.insertText(tr("pugixml v") + QString::number(PUGIXML_VERSION / 1000) + "." + + QString::number(PUGIXML_VERSION / 10 % 100) + "." + QString::number(PUGIXML_VERSION % 10)); UNSET_FORMAT_HYPERLINK(format, cursor); cursor.insertText(", "); SET_FORMAT_HYPERLINK(format, cursor, "https://github.com/erengy/anitomy");
--- a/src/gui/dialog/information.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/gui/dialog/information.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -5,8 +5,8 @@ #include "core/strings.h" #include "gui/pages/anime_list.h" #include "gui/translate/anime.h" +#include "gui/widgets/optional_date.h" #include "gui/widgets/text.h" -#include "gui/widgets/optional_date.h" #include "gui/window.h" #include <QCheckBox> #include <QComboBox> @@ -109,8 +109,9 @@ << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n" << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n" << anime.GetAudienceScore() << "%"; - main_information_widget->layout()->addWidget(new TextWidgets::LabelledTextParagraph( - tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), details_data, main_information_widget)); + main_information_widget->layout()->addWidget( + new TextWidgets::LabelledTextParagraph(tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), + details_data, main_information_widget)); /* synopsis */ TextWidgets::SelectableTextParagraph* synopsis = new TextWidgets::SelectableTextParagraph( @@ -186,9 +187,7 @@ subsection->layout()->addWidget(new QLabel(tr("Episodes watched:"), subsection)); QSpinBox* spin_box = new QSpinBox(subsection); - connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int i) { - progress = i; - }); + connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int i) { progress = i; }); spin_box->setRange(0, anime.GetEpisodes()); spin_box->setSingleStep(1); spin_box->setValue(progress = anime.GetUserProgress()); @@ -198,9 +197,8 @@ subsection->layout()->addWidget(new QLabel(tr(" "), subsection)); QCheckBox* checkbox = new QCheckBox(tr("Rewatching")); - connect(checkbox, QOverload<int>::of(&QCheckBox::stateChanged), this, [this](int state) { - rewatching = (state == Qt::Checked); - }); + connect(checkbox, QOverload<int>::of(&QCheckBox::stateChanged), this, + [this](int state) { rewatching = (state == Qt::Checked); }); checkbox->setCheckState(anime.GetUserIsRewatching() ? Qt::Checked : Qt::Unchecked); subsection->layout()->addWidget(checkbox); }); @@ -216,19 +214,16 @@ QComboBox* combo_box = new QComboBox(subsection); combo_box->addItems(string_list); - connect(combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this](int i) { - status = Anime::ListStatuses[i]; - }); - combo_box->setCurrentIndex(static_cast<int>(status = anime.GetUserStatus())-1); + connect(combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, + [this](int i) { status = Anime::ListStatuses[i]; }); + combo_box->setCurrentIndex(static_cast<int>(status = anime.GetUserStatus()) - 1); subsection->layout()->addWidget(combo_box); }); CREATE_SUBSECTION({ subsection->layout()->addWidget(new QLabel(tr("Score:"), subsection)); QSpinBox* spin_box = new QSpinBox(subsection); - connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int i) { - score = i; - }); + connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int i) { score = i; }); spin_box->setRange(0, 100); spin_box->setSingleStep(5); spin_box->setValue(score = anime.GetUserScore()); @@ -256,9 +251,8 @@ subsection->layout()->addWidget(new QLabel(tr("Date started:"), subsection)); OptionalDate* date = new OptionalDate(true, subsection); - connect(date, &OptionalDate::DataChanged, this, [this](bool enabled, Date date) { - started = (enabled) ? date : Date(); - }); + connect(date, &OptionalDate::DataChanged, this, + [this](bool enabled, Date date) { started = (enabled) ? date : Date(); }); started = anime.GetUserDateStarted(); if (!started.IsValid()) { date->SetEnabled(false); @@ -271,9 +265,8 @@ subsection->layout()->addWidget(new QLabel(tr("Date completed:"), subsection)); OptionalDate* date = new OptionalDate(true, subsection); - connect(date, &OptionalDate::DataChanged, this, [this](bool enabled, Date date) { - completed = (enabled) ? date : Date(); - }); + connect(date, &OptionalDate::DataChanged, this, + [this](bool enabled, Date date) { completed = (enabled) ? date : Date(); }); completed = anime.GetUserDateCompleted(); if (!completed.IsValid()) { date->SetEnabled(false);
--- a/src/gui/dialog/settings/services.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/gui/dialog/settings/services.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -47,7 +47,7 @@ group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); /* this is outdated! usernames are retrieved through a request to AniList now. - although that's a bit... erm... cancerous, maybe this method IS useful. IDK */ + although that's a bit... erm... cancerous, maybe this method IS useful. IDK */ QLabel* username_entry_label = new QLabel(tr("Username: (not your email address)"), group_box); QWidget* auth_widget = new QWidget(group_box);
--- a/src/gui/pages/anime_list.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/gui/pages/anime_list.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -315,10 +315,13 @@ return; } - InformationDialog* dialog = new InformationDialog(*anime, [this, anime] { - Services::UpdateAnimeEntry(anime->GetId()); - Refresh(); - }, this); + InformationDialog* dialog = new InformationDialog( + *anime, + [this, anime] { + Services::UpdateAnimeEntry(anime->GetId()); + Refresh(); + }, + this); dialog->show(); dialog->raise(); @@ -340,10 +343,13 @@ Anime::Anime* anime = ((AnimeListWidgetModel*)sort_models[tab_bar->currentIndex()]->sourceModel())->GetAnimeFromIndex(index); - InformationDialog* dialog = new InformationDialog(*anime, [this, anime] { - Services::UpdateAnimeEntry(anime->GetId()); - Refresh(); - }, this); + InformationDialog* dialog = new InformationDialog( + *anime, + [this, anime] { + Services::UpdateAnimeEntry(anime->GetId()); + Refresh(); + }, + this); dialog->show(); dialog->raise();
--- a/src/gui/pages/statistics.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/gui/pages/statistics.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -24,8 +24,8 @@ TextWidgets::LabelledTextParagraph* anime_list_paragraph = new TextWidgets::LabelledTextParagraph( tr("Anime list"), - tr("Anime count:\nEpisode count:\nTime spent watching:\nTime to complete:\nAverage score:\nScore deviation:"), "\n\n\n\n\n\n", - this); + tr("Anime count:\nEpisode count:\nTime spent watching:\nTime to complete:\nAverage score:\nScore deviation:"), + "\n\n\n\n\n\n", this); anime_list_data = anime_list_paragraph->GetParagraph(); TextWidgets::LabelledTextParagraph* application_paragraph =
--- a/src/gui/translate/anilist.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/gui/translate/anilist.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -1,6 +1,7 @@ #include "gui/translate/anilist.h" -namespace Translate::AniList { +namespace Translate { +namespace AniList { Anime::SeriesStatus ToSeriesStatus(std::string status) { const std::unordered_map<std::string, Anime::SeriesStatus> map = { @@ -48,4 +49,5 @@ return map.at(format); } -} // namespace Translate::AniList +} // namespace AniList +} // namespace Translate
--- a/src/gui/widgets/optional_date.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/gui/widgets/optional_date.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -29,9 +29,7 @@ SetEnabled(state == Qt::Checked); emit DataChanged(IsEnabled(), GetDate()); }); - connect(_dateedit, &QDateEdit::dateChanged, this, [this](QDate) { - emit DataChanged(IsEnabled(), GetDate()); - }); + connect(_dateedit, &QDateEdit::dateChanged, this, [this](QDate) { emit DataChanged(IsEnabled(), GetDate()); }); } void OptionalDate::SetEnabled(bool enabled) { @@ -48,7 +46,8 @@ } void OptionalDate::SetDate(Date date) { - if (!date.IsValid()) return; + if (!date.IsValid()) + return; SetDate(date.GetAsQDate()); }
--- a/src/gui/widgets/sidebar.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/gui/widgets/sidebar.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -1,10 +1,10 @@ #include "gui/widgets/sidebar.h" +#include <QDebug> #include <QFrame> #include <QListWidget> #include <QListWidgetItem> #include <QMessageBox> #include <QMouseEvent> -#include <QDebug> SideBar::SideBar(QWidget* parent) : QListWidget(parent) { setFrameShape(QFrame::NoFrame); @@ -66,12 +66,12 @@ int SideBar::AddSeparatorsToIndex(int index) { int i, j; - for (i = 0, j = 0; i < index; ) { + for (i = 0, j = 0; i < index;) { i++; if (IndexIsSeparator(indexFromItem(item(i)))) j++; } - return i+j; + return i + j; } int SideBar::RemoveSeparatorsFromIndex(int index) {
--- a/src/gui/widgets/text.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/gui/widgets/text.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -1,11 +1,11 @@ #include "gui/widgets/text.h" #include "core/session.h" +#include <QDebug> #include <QFrame> #include <QLabel> #include <QPixmap> #include <QTextBlock> #include <QVBoxLayout> -#include <QDebug> namespace TextWidgets {
--- a/src/gui/window.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/gui/window.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -13,16 +13,16 @@ #include "gui/pages/torrents.h" #include "gui/widgets/sidebar.h" #include "services/services.h" +#include <QActionGroup> #include <QApplication> #include <QFile> #include <QMainWindow> #include <QMenuBar> +#include <QMessageBox> #include <QPlainTextEdit> #include <QStackedWidget> +#include <QTextStream> #include <QTimer> -#include <QActionGroup> -#include <QMessageBox> -#include <QTextStream> #if MACOSX # include "sys/osx/dark_theme.h" #elif defined(WIN32) @@ -91,7 +91,7 @@ action = menu->addAction(tr("E&xit"), qApp, &QApplication::quit); menu = menubar->addMenu(tr("&Services")); - action = menu->addAction(tr("Synchronize &list"), [this, stack] { + action = menu->addAction(tr("Synchronize &list"), [stack] { Services::Synchronize(); ((AnimeListWidget*)stack->widget((int)Pages::ANIME_LIST))->Refresh(); }); @@ -171,13 +171,11 @@ action->setCheckable(true); page_to_index_map[action] = 6; - connect(sidebar, &SideBar::CurrentItemChanged, this, [pages_group](int index){ - pages_group->actions()[index]->setChecked(true); - }); + connect(sidebar, &SideBar::CurrentItemChanged, this, + [pages_group](int index) { pages_group->actions()[index]->setChecked(true); }); - connect(pages_group, &QActionGroup::triggered, this, [page_to_index_map, sidebar](QAction* action) { - sidebar->SetCurrentItem(page_to_index_map.at(action)); - }); + connect(pages_group, &QActionGroup::triggered, this, + [page_to_index_map, sidebar](QAction* action) { sidebar->SetCurrentItem(page_to_index_map.at(action)); }); menu->addSeparator(); menu->addAction(tr("Show sidebar"));
--- a/src/services/anilist.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/services/anilist.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -6,9 +6,9 @@ #include "core/session.h" #include "core/strings.h" #include "gui/translate/anilist.h" +#include <QDebug> #include <QDesktopServices> #include <QInputDialog> -#include <QDebug> #include <QLineEdit> #include <QMessageBox> #include <QUrl> @@ -19,7 +19,8 @@ using nlohmann::literals::operator"" _json_pointer; -namespace Services::AniList { +namespace Services { +namespace AniList { class Account { public: @@ -282,11 +283,13 @@ * Date completedAt **/ Anime::Anime& anime = Anime::db.items[id]; - const std::string query = "mutation ($media_id: Int, $progress: Int, $status: MediaListStatus, $score: Int, $notes: String) {\n" - " SaveMediaListEntry (mediaId: $media_id, progress: $progress, status: $status, scoreRaw: $score, notes: $notes) {\n" - " id\n" - " }\n" - "}\n"; + const std::string query = + "mutation ($media_id: Int, $progress: Int, $status: MediaListStatus, $score: Int, $notes: String) {\n" + " SaveMediaListEntry (mediaId: $media_id, progress: $progress, status: $status, scoreRaw: $score, notes: " + "$notes) {\n" + " id\n" + " }\n" + "}\n"; // clang-format off nlohmann::json json = { {"query", query}, @@ -331,11 +334,12 @@ " }\n" "}\n"; nlohmann::json json = { - {"query", query} - }; + {"query", query} + }; auto ret = nlohmann::json::parse(SendRequest(json.dump())); ParseUser(json["Viewer"]); return true; } -} // namespace Services::AniList +} // namespace AniList +} // namespace Services
--- a/src/services/services.cpp Sun Oct 01 06:16:06 2023 -0400 +++ b/src/services/services.cpp Sun Oct 01 06:39:47 2023 -0400 @@ -1,7 +1,7 @@ #include "services/services.h" #include "core/session.h" +#include "gui/dialog/settings.h" #include "services/anilist.h" -#include "gui/dialog/settings.h" #include <QMessageBox> namespace Services { @@ -34,10 +34,8 @@ bool Authorize() { switch (session.config.service) { - case Anime::Services::ANILIST: - return AniList::AuthorizeUser(); - default: - return true; + case Anime::Services::ANILIST: return AniList::AuthorizeUser(); + default: return true; } }