diff src/gui/dialog/settings/services.cc @ 393:963047512d34

*: clang-format
author Paper <paper@tflc.us>
date Fri, 07 Nov 2025 07:16:15 -0500
parents d928ec7b6a0d
children
line wrap: on
line diff
--- 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"));