Mercurial > minori
diff src/dialog/information.cpp @ 8:b1f73678ef61
update
text paragraphs are now their own objects, as they should be
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sat, 26 Aug 2023 03:39:34 -0400 |
parents | 07a9095eaeed |
children |
line wrap: on
line diff
--- a/src/dialog/information.cpp Thu Aug 24 23:11:38 2023 -0400 +++ b/src/dialog/information.cpp Sat Aug 26 03:39:34 2023 -0400 @@ -25,11 +25,15 @@ setWindowTitle(tr("Anime Information")); setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); setObjectName("infodiag"); + + /* main widget */ QWidget* widget = new QWidget(this); widget->resize(842-175, 530); widget->move(175, 0); widget->setStyleSheet(UiUtils::IsInDarkMode() ? "" : "background-color: white"); widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + + /* anime title header text */ QPlainTextEdit* anime_title = new QPlainTextEdit(QString::fromUtf8(anime->GetUserPreferredTitle().c_str()), widget); anime_title->setReadOnly(true); anime_title->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -41,40 +45,41 @@ anime_title->setStyleSheet("font-size: 16px; color: blue; background: transparent;"); anime_title->resize(636, 28); anime_title->move(0, 12); + + /* tabbed widget */ QTabWidget* tabbed_widget = new QTabWidget(widget); tabbed_widget->resize(636, 485); tabbed_widget->move(0, 45); tabbed_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + + /* main info tab */ QWidget* main_information_widget = new QWidget(tabbed_widget); main_information_widget->setLayout(new QVBoxLayout); - QString alternative_titles = QString::fromUtf8(StringUtils::Implode(anime->GetTitleSynonyms(), ", ").c_str()); + /* alt titles */ + main_information_widget->layout()->addWidget(new UiUtils::SelectableTextParagraph("Alternative titles", QString::fromUtf8(StringUtils::Implode(anime->GetTitleSynonyms(), ", ").c_str()), main_information_widget)); - QWidget* alternative_titles_w = UiUtils::CreateSelectableTextParagraph(main_information_widget, "Alternative titles", alternative_titles)->parentWidget()->parentWidget(); - //alternative_titles_w->setFixedHeight(60); - main_information_widget->layout()->addWidget(alternative_titles_w); - - QString details_data(""); + /* details */ + QString details_data; QTextStream details_data_s(&details_data); details_data_s << AnimeFormatToStringMap[anime->type].c_str() << "\n" << anime->episodes << "\n" << AnimeAiringToStringMap[anime->airing].c_str() << "\n" << AnimeSeasonToStringMap[anime->season].c_str() << " " << anime->air_date.GetYear() << "\n" << StringUtils::Implode(anime->genres, ", ").c_str() << "\n" - << anime->audience_score << "%\n"; - QWidget* soidjhfh = UiUtils::CreateTextParagraphWithLabels(main_information_widget, "Details", "Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:", details_data)->parentWidget()->parentWidget(); - main_information_widget->layout()->addWidget(soidjhfh); + << anime->audience_score << "%"; + main_information_widget->layout()->addWidget(new UiUtils::LabelledTextParagraph("Details", "Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:", details_data, main_information_widget)); - QPlainTextEdit* synopsis = UiUtils::CreateSelectableTextParagraph(main_information_widget, "Synopsis", QString::fromUtf8(anime->synopsis.c_str())); - synopsis->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); - synopsis->parentWidget()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); - synopsis->parentWidget()->parentWidget()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); - ((QVBoxLayout*)main_information_widget->layout())->addWidget(synopsis->parentWidget()->parentWidget()); + /* synopsis */ + UiUtils::SelectableTextParagraph* synopsis = new UiUtils::SelectableTextParagraph("Synopsis", QString::fromUtf8(anime->synopsis.c_str()), main_information_widget); + synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); + ((QVBoxLayout*)main_information_widget->layout())->addWidget(synopsis); //((QVBoxLayout*)main_information_widget->layout())->addStretch(); + QWidget* settings_widget = new QWidget(tabbed_widget); + tabbed_widget->addTab(main_information_widget, "Main information"); - QWidget* settings_widget = new QWidget(tabbed_widget); tabbed_widget->addTab(settings_widget, "My list and settings"); QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); connect(button_box, &QDialogButtonBox::accepted, this, &InformationDialog::OnOK);