# HG changeset patch # User Paper # Date 1696398393 14400 # Node ID 3364fadc8a36436b3cbe8355d5a17729eba8df61 # Parent d3e9310598b146a26d639105e9e0fa99aa00bd4a *: format source code diff -r d3e9310598b1 -r 3364fadc8a36 include/core/anime_db.h --- a/include/core/anime_db.h Wed Oct 04 01:42:30 2023 -0400 +++ b/include/core/anime_db.h Wed Oct 04 01:46:33 2023 -0400 @@ -1,8 +1,8 @@ #ifndef __core__anime_db_h #define __core__anime_db_h #include "core/anime.h" +#include #include -#include namespace Anime { diff -r d3e9310598b1 -r 3364fadc8a36 include/core/http.h --- a/include/core/http.h Wed Oct 04 01:42:30 2023 -0400 +++ b/include/core/http.h Wed Oct 04 01:46:33 2023 -0400 @@ -1,9 +1,9 @@ #ifndef __core__http_h #define __core__http_h +#include #include #include -#include class QObject; @@ -28,6 +28,6 @@ /* Performs a basic (blocking) post request */ std::string PerformBasicPostRequest(std::string url, std::string data, std::vector headers = {}); -} +} // namespace HTTP #endif // __core__http_h diff -r d3e9310598b1 -r 3364fadc8a36 include/gui/pages/statistics.h --- a/include/gui/pages/statistics.h Wed Oct 04 01:42:30 2023 -0400 +++ b/include/gui/pages/statistics.h Wed Oct 04 01:46:33 2023 -0400 @@ -2,10 +2,10 @@ #define __gui__pages__statistics_h #include #include -//#include "gui/widgets/text.h" +// #include "gui/widgets/text.h" namespace TextWidgets { - class Paragraph; +class Paragraph; } class StatisticsPage : public QFrame { diff -r d3e9310598b1 -r 3364fadc8a36 include/gui/widgets/anime_info.h --- a/include/gui/widgets/anime_info.h Wed Oct 04 01:42:30 2023 -0400 +++ b/include/gui/widgets/anime_info.h Wed Oct 04 01:46:33 2023 -0400 @@ -3,7 +3,7 @@ #include namespace Anime { - class Anime; +class Anime; } class AnimeInfoWidget : public QWidget { diff -r d3e9310598b1 -r 3364fadc8a36 include/gui/widgets/poster.h --- a/include/gui/widgets/poster.h Wed Oct 04 01:42:30 2023 -0400 +++ b/include/gui/widgets/poster.h Wed Oct 04 01:46:33 2023 -0400 @@ -1,8 +1,8 @@ #ifndef __gui__widgets__poster_h #define __gui__widgets__poster_h +#include #include #include -#include class QWidget; class ClickableLabel; diff -r d3e9310598b1 -r 3364fadc8a36 include/gui/widgets/text.h --- a/include/gui/widgets/text.h Wed Oct 04 01:42:30 2023 -0400 +++ b/include/gui/widgets/text.h Wed Oct 04 01:46:33 2023 -0400 @@ -1,11 +1,11 @@ #ifndef __gui__ui_utils_h #define __gui__ui_utils_h -#include -#include +#include +#include #include -#include -#include +#include +#include class QFrame; class QLabel; diff -r d3e9310598b1 -r 3364fadc8a36 src/core/filesystem.cpp --- a/src/core/filesystem.cpp Wed Oct 04 01:42:30 2023 -0400 +++ b/src/core/filesystem.cpp Wed Oct 04 01:46:33 2023 -0400 @@ -68,7 +68,7 @@ std::string Path::Basename() const { unsigned long long pos = _path.find_last_of(DELIM); - return pos != std::string::npos ? _path.substr(pos+1, _path.length()) : ""; + return pos != std::string::npos ? _path.substr(pos + 1, _path.length()) : ""; } std::string Path::Stem() const { @@ -80,7 +80,7 @@ std::string Path::Extension() const { std::string basename = Basename(); unsigned long long pos = basename.find_last_of("."); - return pos != std::string::npos ? basename.substr(pos+1, basename.length()) : ""; + return pos != std::string::npos ? basename.substr(pos + 1, basename.length()) : ""; } Path Path::GetParent() const { diff -r d3e9310598b1 -r 3364fadc8a36 src/core/http.cpp --- a/src/core/http.cpp Wed Oct 04 01:42:30 2023 -0400 +++ b/src/core/http.cpp Wed Oct 04 01:46:33 2023 -0400 @@ -81,6 +81,6 @@ return ""; } -} +} // namespace HTTP #include "core/moc_http.cpp" diff -r d3e9310598b1 -r 3364fadc8a36 src/core/strings.cpp --- a/src/core/strings.cpp Wed Oct 04 01:42:30 2023 -0400 +++ b/src/core/strings.cpp Wed Oct 04 01:46:33 2023 -0400 @@ -64,8 +64,8 @@ } /* these functions suck for i18n!... - but we only use them with JSON - stuff anyway */ + but we only use them with JSON + stuff anyway */ std::string ToUpper(const std::string& string) { std::string result(string); std::transform(result.begin(), result.end(), result.begin(), [](unsigned char c) { return std::toupper(c); }); diff -r d3e9310598b1 -r 3364fadc8a36 src/gui/dialog/information.cpp --- a/src/gui/dialog/information.cpp Wed Oct 04 01:42:30 2023 -0400 +++ b/src/gui/dialog/information.cpp Wed Oct 04 01:46:33 2023 -0400 @@ -6,8 +6,8 @@ #include "gui/pages/anime_list.h" #include "gui/translate/anime.h" #include "gui/widgets/anime_info.h" +#include "gui/widgets/optional_date.h" #include "gui/widgets/poster.h" -#include "gui/widgets/optional_date.h" #include "gui/widgets/text.h" #include "gui/window.h" #include @@ -15,10 +15,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include diff -r d3e9310598b1 -r 3364fadc8a36 src/gui/dialog/settings.cpp --- a/src/gui/dialog/settings.cpp Wed Oct 04 01:42:30 2023 -0400 +++ b/src/gui/dialog/settings.cpp Wed Oct 04 01:46:33 2023 -0400 @@ -2,11 +2,11 @@ #include "gui/widgets/sidebar.h" #include "gui/widgets/text.h" #include +#include +#include #include #include -#include #include -#include SettingsPage::SettingsPage(QWidget* parent, QString title) : QWidget(parent) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); diff -r d3e9310598b1 -r 3364fadc8a36 src/gui/dialog/settings/services.cpp --- a/src/gui/dialog/settings/services.cpp Wed Oct 04 01:42:30 2023 -0400 +++ b/src/gui/dialog/settings/services.cpp Wed Oct 04 01:46:33 2023 -0400 @@ -5,12 +5,11 @@ #include "services/anilist.h" #include #include +#include +#include #include #include #include -#include -#include -#include QWidget* SettingsPageServices::CreateMainPage() { QWidget* result = new QWidget(this); @@ -85,8 +84,8 @@ } void SettingsPageServices::SaveInfo() { - // session.config.anilist.username = -Strings::ToUtf8String(username); + // session.config.anilist.username = + Strings::ToUtf8String(username); session.config.service = service; } diff -r d3e9310598b1 -r 3364fadc8a36 src/gui/pages/anime_list.cpp --- a/src/gui/pages/anime_list.cpp Wed Oct 04 01:42:30 2023 -0400 +++ b/src/gui/pages/anime_list.cpp Wed Oct 04 01:46:33 2023 -0400 @@ -13,8 +13,8 @@ #include "core/anime_db.h" #include "core/array.h" #include "core/session.h" +#include "core/strings.h" #include "core/time.h" -#include "core/strings.h" #include "gui/dialog/information.h" #include "gui/translate/anime.h" #include "services/services.h" diff -r d3e9310598b1 -r 3364fadc8a36 src/gui/widgets/poster.cpp --- a/src/gui/widgets/poster.cpp Wed Oct 04 01:42:30 2023 -0400 +++ b/src/gui/widgets/poster.cpp Wed Oct 04 01:46:33 2023 -0400 @@ -1,18 +1,18 @@ #include "gui/widgets/poster.h" -#include "gui/widgets/clickable_label.h" #include "core/anime_db.h" #include "core/http.h" +#include "core/session.h" #include "core/strings.h" -#include "core/session.h" +#include "gui/widgets/clickable_label.h" +#include +#include +#include #include -#include -#include #include -#include -#include +#include +#include +#include #include -#include -#include #include Poster::Poster(int id, QWidget* parent) : QFrame(parent) { @@ -23,10 +23,10 @@ setFixedSize(150, 225); setFrameShape(QFrame::Box); setFrameShadow(QFrame::Plain); - + const Anime::Anime& anime = Anime::db.items[id]; - HTTP::HttpGetThread *image_thread = new HTTP::HttpGetThread(anime.GetPosterUrl(), {}, this); + HTTP::HttpGetThread* image_thread = new HTTP::HttpGetThread(anime.GetPosterUrl(), {}, this); connect(image_thread, &HTTP::HttpGetThread::resultReady, this, &Poster::ImageDownloadFinished); connect(image_thread, &HTTP::HttpGetThread::finished, image_thread, &QObject::deleteLater); image_thread->start(); @@ -35,9 +35,8 @@ label = new ClickableLabel(this); label->setAlignment(Qt::AlignCenter); - connect(label, &ClickableLabel::clicked, this, [anime]{ - QDesktopServices::openUrl(Strings::ToQString(anime.GetServiceUrl())); - }); + connect(label, &ClickableLabel::clicked, this, + [anime] { QDesktopServices::openUrl(Strings::ToQString(anime.GetServiceUrl())); }); layout->addWidget(label); } @@ -48,7 +47,8 @@ void Poster::RenderToLabel() { QPixmap pixmap = QPixmap::fromImage(img); - if (pixmap.isNull()) return; + if (pixmap.isNull()) + return; label->setPixmap(pixmap.scaled(label->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation)); } diff -r d3e9310598b1 -r 3364fadc8a36 src/gui/widgets/text.cpp --- a/src/gui/widgets/text.cpp Wed Oct 04 01:42:30 2023 -0400 +++ b/src/gui/widgets/text.cpp Wed Oct 04 01:46:33 2023 -0400 @@ -127,8 +127,7 @@ return paragraph; } -LabelledSection::LabelledSection(QString title, QString label, QString data, QWidget* parent) - : QWidget(parent) { +LabelledSection::LabelledSection(QString title, QString label, QString data, QWidget* parent) : QWidget(parent) { QVBoxLayout* layout = new QVBoxLayout(this); header = new Header(title, this); diff -r d3e9310598b1 -r 3364fadc8a36 src/services/anilist.cpp --- a/src/services/anilist.cpp Wed Oct 04 01:42:30 2023 -0400 +++ b/src/services/anilist.cpp Wed Oct 04 01:46:33 2023 -0400 @@ -2,8 +2,8 @@ #include "core/anime.h" #include "core/anime_db.h" #include "core/config.h" +#include "core/http.h" #include "core/json.h" -#include "core/http.h" #include "core/session.h" #include "core/strings.h" #include "gui/translate/anilist.h" @@ -38,11 +38,8 @@ static Account account; std::string SendRequest(std::string data) { - std::vector headers = { - "Authorization: Bearer " + account.AuthToken(), - "Accept: application/json", - "Content-Type: application/json" - }; + std::vector headers = {"Authorization: Bearer " + account.AuthToken(), "Accept: application/json", + "Content-Type: application/json"}; return HTTP::PerformBasicPostRequest("https://graphql.anilist.co", data, headers); } @@ -74,16 +71,11 @@ 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"; } diff -r d3e9310598b1 -r 3364fadc8a36 src/track/media.cpp --- a/src/track/media.cpp Wed Oct 04 01:42:30 2023 -0400 +++ b/src/track/media.cpp Wed Oct 04 01:46:33 2023 -0400 @@ -1,8 +1,8 @@ #include "track/media.h" +#include "animia.h" +#include "anitomy/anitomy.h" #include "core/filesystem.h" #include "core/strings.h" -#include "animia.h" -#include "anitomy/anitomy.h" #include #include