Mercurial > minori
changeset 76:3364fadc8a36
*: format source code
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 04 Oct 2023 01:46:33 -0400 |
parents | d3e9310598b1 |
children | 6f7385bd334c |
files | include/core/anime_db.h include/core/http.h include/gui/pages/statistics.h include/gui/widgets/anime_info.h include/gui/widgets/poster.h include/gui/widgets/text.h src/core/filesystem.cpp src/core/http.cpp src/core/strings.cpp src/gui/dialog/information.cpp src/gui/dialog/settings.cpp src/gui/dialog/settings/services.cpp src/gui/pages/anime_list.cpp src/gui/widgets/poster.cpp src/gui/widgets/text.cpp src/services/anilist.cpp src/track/media.cpp |
diffstat | 17 files changed, 50 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- 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 <string> #include <unordered_map> -#include <string> namespace Anime {
--- 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 <QThread> #include <string> #include <vector> -#include <QThread> class QObject; @@ -28,6 +28,6 @@ /* Performs a basic (blocking) post request */ std::string PerformBasicPostRequest(std::string url, std::string data, std::vector<std::string> headers = {}); -} +} // namespace HTTP #endif // __core__http_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 <QFrame> #include <QWidget> -//#include "gui/widgets/text.h" +// #include "gui/widgets/text.h" namespace TextWidgets { - class Paragraph; +class Paragraph; } class StatisticsPage : public QFrame {
--- 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 <QWidget> namespace Anime { - class Anime; +class Anime; } class AnimeInfoWidget : public QWidget {
--- 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 <QByteArray> #include <QFrame> #include <QImage> -#include <QByteArray> class QWidget; class ClickableLabel;
--- 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 <QWidget> -#include <QString> +#include <QLineEdit> +#include <QPlainTextEdit> #include <QSize> -#include <QPlainTextEdit> -#include <QLineEdit> +#include <QString> +#include <QWidget> class QFrame; class QLabel;
--- 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 {
--- 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"
--- 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); });
--- 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 <QCheckBox> @@ -15,10 +15,10 @@ #include <QDateEdit> #include <QDebug> #include <QDialogButtonBox> +#include <QLabel> #include <QLineEdit> #include <QPlainTextEdit> #include <QSpinBox> -#include <QLabel> #include <QStringList> #include <QTextStream> #include <QVBoxLayout>
--- 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 <QDialogButtonBox> +#include <QHBoxLayout> +#include <QLabel> #include <QStackedWidget> #include <QVBoxLayout> -#include <QHBoxLayout> #include <QWidget> -#include <QLabel> SettingsPage::SettingsPage(QWidget* parent, QString title) : QWidget(parent) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
--- 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 <QComboBox> #include <QGroupBox> +#include <QLabel> +#include <QLineEdit> #include <QPushButton> #include <QSizePolicy> #include <QVBoxLayout> -#include <QLabel> -#include <QPushButton> -#include <QLineEdit> 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; }
--- 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"
--- 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 <QByteArray> +#include <QDebug> +#include <QDesktopServices> #include <QFrame> -#include <QMessageBox> -#include <QLabel> #include <QHBoxLayout> -#include <QByteArray> -#include <QDesktopServices> +#include <QLabel> +#include <QMessageBox> +#include <QPixmap> #include <QUrl> -#include <QDebug> -#include <QPixmap> #include <curl/curl.h> 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)); }
--- 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);
--- 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<std::string> headers = { - "Authorization: Bearer " + account.AuthToken(), - "Accept: application/json", - "Content-Type: application/json" - }; + std::vector<std::string> 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"; }
--- 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 <string> #include <vector>