diff src/gui/pages/anime_list.cpp @ 51:75c804f713b2

window: add about window, *: use tr() when applicable (useful for i18n)
author Paper <mrpapersonic@gmail.com>
date Mon, 25 Sep 2023 20:29:26 -0400
parents d8eb763e6661
children 0c4138de2ea7
line wrap: on
line diff
--- a/src/gui/pages/anime_list.cpp	Mon Sep 25 13:50:56 2023 -0400
+++ b/src/gui/pages/anime_list.cpp	Mon Sep 25 20:29:26 2023 -0400
@@ -47,8 +47,8 @@
 			int text_width = 59;
 			QRectF text_rect(option.rect.x() + text_width, option.rect.y(), text_width, option.decorationSize.height());
 			painter->save();
-			painter->drawText(text_rect, "/", QTextOption(Qt::AlignCenter | Qt::AlignVCenter));
-			// drawText(const QRectF &rectangle, const QString &text, const QTextOption &option =
+			painter->drawText(text_rect, tr("/"), QTextOption(Qt::AlignCenter | Qt::AlignVCenter));
+			drawText(const QRectF &rectangle, const QString &text, const QTextOption &option =
 			   QTextOption()) painter->drawText(QRectF(text_rect.x(), text_rect.y(), text_width / 2 - 2,
 			   text_rect.height()), QString::number(progress), QTextOption(Qt::AlignRight | Qt::AlignVCenter));
 			   painter->drawText(
@@ -306,7 +306,7 @@
 		return;
 	}
 
-	QAction* action = menu->addAction("Information", [this, selection] {
+	QAction* action = menu->addAction(tr("Information"), [this, selection] {
 		const QModelIndex index = ((AnimeListWidgetModel*)sort_models[tab_bar->currentIndex()]->sourceModel())
 		                              ->index(selection.indexes().first().row());
 		Anime::Anime* anime =
@@ -315,13 +315,9 @@
 			return;
 		}
 
-		InformationDialog* dialog = new InformationDialog(
-		    *anime,
-		    [this, anime] {
-			    ((AnimeListWidgetModel*)sort_models[tab_bar->currentIndex()]->sourceModel())
-			        ->UpdateAnime(anime->GetId());
-		    },
-		    this);
+		InformationDialog* dialog = new InformationDialog(*anime, [this] {
+		    Refresh();
+	    }, this);
 
 		dialog->show();
 		dialog->raise();
@@ -343,12 +339,9 @@
 	Anime::Anime* anime =
 	    ((AnimeListWidgetModel*)sort_models[tab_bar->currentIndex()]->sourceModel())->GetAnimeFromIndex(index);
 
-	InformationDialog* dialog = new InformationDialog(
-	    *anime,
-	    [this, anime] {
-		    ((AnimeListWidgetModel*)sort_models[tab_bar->currentIndex()]->sourceModel())->UpdateAnime(anime->GetId());
-	    },
-	    this);
+	InformationDialog* dialog = new InformationDialog(*anime, [this] {
+		Refresh();
+	}, this);
 
 	dialog->show();
 	dialog->raise();