diff src/gui/dialog/information.cc @ 348:6b0768158dcd

text: redesign almost every widget i.e. Paragraph is now a QLabel, etc etc, some things will probably break, idc
author Paper <paper@paper.us.eu.org>
date Tue, 25 Jun 2024 11:19:54 -0400
parents 5d3c9b31aa6e
children
line wrap: on
line diff
--- a/src/gui/dialog/information.cc	Sun Jun 23 10:32:09 2024 -0400
+++ b/src/gui/dialog/information.cc	Tue Jun 25 11:19:54 2024 -0400
@@ -46,7 +46,7 @@
 }
 
 InformationDialog::InformationDialog(Anime::Anime* anime, std::function<void(Anime::Anime*)> accept, enum Pages page,
-                                     QWidget* parent)
+									 QWidget* parent)
 	: QDialog(parent) {
 	/* ack. lots of brackets here, but MUCH, MUCH MUCH better than what it used to be */
 	setFixedSize(842, 613);
@@ -89,8 +89,8 @@
 
 			{
 				/* Anime title */
-				TextWidgets::Title* anime_title =
-				    new TextWidgets::Title(Strings::ToQString(anime->GetUserPreferredTitle()), main_widget);
+				TextWidgets::Title* anime_title = new TextWidgets::Title(main_widget);
+				anime_title->SetText(anime->GetUserPreferredTitle());
 				main_layout->addWidget(anime_title);
 			}
 
@@ -111,7 +111,10 @@
 					settings_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
 
 					QVBoxLayout* settings_layout = new QVBoxLayout(settings_widget);
-					settings_layout->addWidget(new TextWidgets::Header(tr("Anime list"), settings_widget));
+
+					TextWidgets::Header* header = new TextWidgets::Header(settings_widget);
+					header->SetText(Strings::Translate("Anime list"));
+					settings_layout->addWidget(header);
 
 					{
 						/* Anime List */
@@ -143,7 +146,7 @@
 
 								QSpinBox* spin_box = new QSpinBox(section);
 								connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this,
-								        [this](int i) { _progress = i; });
+										[this](int i) { _progress = i; });
 								spin_box->setRange(0, anime->GetEpisodes());
 								spin_box->setSingleStep(1);
 								spin_box->setValue(_progress = anime->GetUserProgress());
@@ -155,9 +158,9 @@
 								/* Rewatching? */
 								QCheckBox* checkbox = new QCheckBox(tr("Rewatching"));
 								connect(checkbox, QOverload<int>::of(&QCheckBox::stateChanged), this,
-								        [this](int state) { _rewatching = (state == Qt::Checked); });
+										[this](int state) { _rewatching = (state == Qt::Checked); });
 								checkbox->setCheckState((_rewatching = anime->GetUserIsRewatching()) ? Qt::Checked
-								                                                                     : Qt::Unchecked);
+																									 : Qt::Unchecked);
 								checkbox->setFixedWidth(LAYOUT_ITEM_WIDTH);
 								layout->addWidget(checkbox, 1, 1);
 							}
@@ -174,15 +177,15 @@
 								_status = anime->GetUserStatus();
 								for (unsigned int i = 0; i < Anime::ListStatuses.size(); i++) {
 									combo_box->addItem(Strings::ToQString(Translate::ToLocalString(Anime::ListStatuses[i])),
-									                   static_cast<int>(Anime::ListStatuses[i]));
+													   static_cast<int>(Anime::ListStatuses[i]));
 									if (Anime::ListStatuses[i] == _status)
 										combo_box->setCurrentIndex(i);
 								}
 
 								connect(combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
-								        [this, combo_box](int) {
-									        _status = static_cast<Anime::ListStatus>(combo_box->currentData().toInt());
-								        });
+										[this, combo_box](int) {
+											_status = static_cast<Anime::ListStatus>(combo_box->currentData().toInt());
+										});
 
 								/* this should NEVER, EVER, be NOT_IN_LIST */
 								combo_box->setFixedWidth(LAYOUT_ITEM_WIDTH);
@@ -195,7 +198,7 @@
 
 								QSpinBox* spin_box = new QSpinBox(section);
 								connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this,
-								        [this](int i) { _score = i; });
+										[this](int i) { _score = i; });
 								spin_box->setRange(0, 100);
 								spin_box->setSingleStep(5);
 								spin_box->setValue(_score = anime->GetUserScore());
@@ -225,7 +228,7 @@
 
 								OptionalDate* date = new OptionalDate(true, section);
 								connect(date, &OptionalDate::DataChanged, this,
-								        [this](bool enabled, Date date) { _started = enabled ? date : Date(); });
+										[this](bool enabled, Date date) { _started = enabled ? date : Date(); });
 								date->setFixedWidth(LAYOUT_ITEM_WIDTH);
 								_started = anime->GetUserDateStarted();
 								if (!_started.IsValid()) {
@@ -242,7 +245,7 @@
 
 								OptionalDate* date = new OptionalDate(true, section);
 								connect(date, &OptionalDate::DataChanged, this,
-								        [this](bool enabled, Date date) { _completed = enabled ? date : Date(); });
+										[this](bool enabled, Date date) { _completed = enabled ? date : Date(); });
 								date->setFixedWidth(LAYOUT_ITEM_WIDTH);
 								_completed = anime->GetUserDateCompleted();
 								if (!_completed.IsValid()) {
@@ -260,28 +263,28 @@
 
 					/*
 					{
-					    // commenting this out until it actually gets implemented :)
+						// commenting this out until it actually gets implemented :)
 
-					    settings_layout->addWidget(new TextWidgets::Header(tr("Local settings"), settings_widget));
+						settings_layout->addWidget(new TextWidgets::Header(tr("Local settings"), settings_widget));
 
-					    QWidget* sg_local_content = new QWidget(settings_widget);
-					    QVBoxLayout* sg_local_layout = new QVBoxLayout(sg_local_content);
-					    sg_local_layout->setSpacing(5);
-					    sg_local_layout->setContentsMargins(12, 0, 0, 0);
+						QWidget* sg_local_content = new QWidget(settings_widget);
+						QVBoxLayout* sg_local_layout = new QVBoxLayout(sg_local_content);
+						sg_local_layout->setSpacing(5);
+						sg_local_layout->setContentsMargins(12, 0, 0, 0);
 
-					    CREATE_SECTION(sg_local_content, [this, &anime](QWidget* section, QGridLayout* layout){
-					        layout->addWidget(new QLabel(tr("Alternative titles:"), section), 0, 0);
+						CREATE_SECTION(sg_local_content, [this, &anime](QWidget* section, QGridLayout* layout){
+							layout->addWidget(new QLabel(tr("Alternative titles:"), section), 0, 0);
 
-					        QLineEdit* line_edit = new QLineEdit("", section);
-					        line_edit->setPlaceholderText(
-					            tr("Enter alternative titles here, separated by a semicolon (i.e. Title 1; Title 2)"));
-					        layout->addWidget(line_edit, 1, 0);
+							QLineEdit* line_edit = new QLineEdit("", section);
+							line_edit->setPlaceholderText(
+								tr("Enter alternative titles here, separated by a semicolon (i.e. Title 1; Title 2)"));
+							layout->addWidget(line_edit, 1, 0);
 
-					        QCheckBox* checkbox = new QCheckBox(tr("Use the first alternative title to search for
+							QCheckBox* checkbox = new QCheckBox(tr("Use the first alternative title to search for
 					torrents")); layout->addWidget(checkbox, 2, 0);
-					    });
+						});
 
-					    settings_layout->addWidget(sg_local_content);
+						settings_layout->addWidget(sg_local_content);
 					}
 					*/