comparison src/gui/dialog/information.cpp @ 15:cde8f67a7c7d

*: update, megacommit :)
author Paper <mrpapersonic@gmail.com>
date Tue, 19 Sep 2023 22:36:08 -0400
parents 4b198a111713
children 2743011a6042
comparison
equal deleted inserted replaced
14:a29c9402faf0 15:cde8f67a7c7d
11 #include <QTextStream> 11 #include <QTextStream>
12 #include <QVBoxLayout> 12 #include <QVBoxLayout>
13 #include <functional> 13 #include <functional>
14 14
15 InformationDialog::InformationDialog(Anime::Anime& anime, std::function<void()> accept, QWidget* parent) 15 InformationDialog::InformationDialog(Anime::Anime& anime, std::function<void()> accept, QWidget* parent)
16 : QDialog(parent) { 16 : QDialog(parent) {
17 setFixedSize(842, 613); 17 setFixedSize(842, 613);
18 setWindowTitle(tr("Anime Information")); 18 setWindowTitle(tr("Anime Information"));
19 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); 19 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
20 setObjectName("infodiag"); 20 setObjectName("infodiag");
21 setStyleSheet(UiUtils::IsInDarkMode() ? "" : "QDialog#infodiag{background-color: white;}"); 21 setStyleSheet(UiUtils::IsInDarkMode() ? "" : "QDialog#infodiag{background-color: white;}");
31 main_widget->setStyleSheet(UiUtils::IsInDarkMode() ? "" : "background-color: white"); 31 main_widget->setStyleSheet(UiUtils::IsInDarkMode() ? "" : "background-color: white");
32 main_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 32 main_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
33 33
34 /* anime title header text */ 34 /* anime title header text */
35 UiUtils::Paragraph* anime_title = 35 UiUtils::Paragraph* anime_title =
36 new UiUtils::Paragraph(QString::fromUtf8(anime.GetUserPreferredTitle().c_str()), main_widget); 36 new UiUtils::Paragraph(QString::fromUtf8(anime.GetUserPreferredTitle().c_str()), main_widget);
37 anime_title->setReadOnly(true); 37 anime_title->setReadOnly(true);
38 anime_title->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 38 anime_title->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
39 anime_title->setWordWrapMode(QTextOption::NoWrap); 39 anime_title->setWordWrapMode(QTextOption::NoWrap);
40 anime_title->setFrameShape(QFrame::NoFrame); 40 anime_title->setFrameShape(QFrame::NoFrame);
41 anime_title->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); 41 anime_title->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
51 QWidget* main_information_widget = new QWidget(tabbed_widget); 51 QWidget* main_information_widget = new QWidget(tabbed_widget);
52 main_information_widget->setLayout(new QVBoxLayout); 52 main_information_widget->setLayout(new QVBoxLayout);
53 53
54 /* alt titles */ 54 /* alt titles */
55 main_information_widget->layout()->addWidget(new UiUtils::SelectableTextParagraph( 55 main_information_widget->layout()->addWidget(new UiUtils::SelectableTextParagraph(
56 "Alternative titles", QString::fromUtf8(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()), 56 "Alternative titles", QString::fromUtf8(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()),
57 main_information_widget)); 57 main_information_widget));
58 58
59 /* details */ 59 /* details */
60 QString details_data; 60 QString details_data;
61 QTextStream details_data_s(&details_data); 61 QTextStream details_data_s(&details_data);
62 details_data_s << Translate::TranslateSeriesFormat(anime.GetFormat()).c_str() << "\n" 62 details_data_s << Translate::ToString(anime.GetFormat()).c_str() << "\n"
63 << anime.GetEpisodes() << "\n" 63 << anime.GetEpisodes() << "\n"
64 << Translate::TranslateListStatus(anime.GetUserStatus()).c_str() << "\n" 64 << Translate::ToString(anime.GetUserStatus()).c_str() << "\n"
65 << Translate::TranslateSeriesSeason(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() 65 << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear()
66 << "\n" 66 << "\n"
67 << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n" 67 << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n"
68 << anime.GetAudienceScore() << "%"; 68 << anime.GetAudienceScore() << "%";
69 main_information_widget->layout()->addWidget(new UiUtils::LabelledTextParagraph( 69 main_information_widget->layout()->addWidget(new UiUtils::LabelledTextParagraph(
70 "Details", "Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:", details_data, main_information_widget)); 70 "Details", "Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:", details_data, main_information_widget));
71 71
72 /* synopsis */ 72 /* synopsis */
73 UiUtils::SelectableTextParagraph* synopsis = new UiUtils::SelectableTextParagraph( 73 UiUtils::SelectableTextParagraph* synopsis = new UiUtils::SelectableTextParagraph(
74 "Synopsis", QString::fromUtf8(anime.GetSynopsis().c_str()), main_information_widget); 74 "Synopsis", QString::fromUtf8(anime.GetSynopsis().c_str()), main_information_widget);
75 75
76 synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); 76 synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
77 ((QVBoxLayout*)main_information_widget->layout())->addWidget(synopsis); 77 ((QVBoxLayout*)main_information_widget->layout())->addWidget(synopsis);
78 78
79 QWidget* settings_widget = new QWidget(tabbed_widget); 79 QWidget* settings_widget = new QWidget(tabbed_widget);