Mercurial > minori
diff src/dialog/information.cpp @ 7:07a9095eaeed
Update
Refactored some code, moved some around
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Thu, 24 Aug 2023 23:11:38 -0400 |
parents | 1d82f6e04d7d |
children | b1f73678ef61 |
line wrap: on
line diff
--- a/src/dialog/information.cpp Wed Aug 16 00:49:17 2023 -0400 +++ b/src/dialog/information.cpp Thu Aug 24 23:11:38 2023 -0400 @@ -1,5 +1,10 @@ +#include <QPlainTextEdit> +#include <QVBoxLayout> +#include <QTextStream> +#include <QDebug> #include "window.h" #include "anime.h" +#include "anime_list.h" #include "information.h" #include "ui_utils.h" #include "string_utils.h" @@ -25,7 +30,7 @@ widget->move(175, 0); widget->setStyleSheet(UiUtils::IsInDarkMode() ? "" : "background-color: white"); widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - QPlainTextEdit* anime_title = new QPlainTextEdit(QString::fromUtf8(anime->title.english.c_str()), widget); + QPlainTextEdit* anime_title = new QPlainTextEdit(QString::fromUtf8(anime->GetUserPreferredTitle().c_str()), widget); anime_title->setReadOnly(true); anime_title->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); anime_title->setWordWrapMode(QTextOption::NoWrap); @@ -41,7 +46,14 @@ tabbed_widget->move(0, 45); tabbed_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QWidget* main_information_widget = new QWidget(tabbed_widget); - UiUtils::CreateSelectableTextParagraph(main_information_widget, "Alternative titles", "-", QPoint(6, 6), QSize(636-18, 56)); + main_information_widget->setLayout(new QVBoxLayout); + + QString alternative_titles = QString::fromUtf8(StringUtils::Implode(anime->GetTitleSynonyms(), ", ").c_str()); + + 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(""); QTextStream details_data_s(&details_data); details_data_s << AnimeFormatToStringMap[anime->type].c_str() << "\n" @@ -50,8 +62,17 @@ << AnimeSeasonToStringMap[anime->season].c_str() << " " << anime->air_date.GetYear() << "\n" << StringUtils::Implode(anime->genres, ", ").c_str() << "\n" << anime->audience_score << "%\n"; - UiUtils::CreateTextParagraphWithLabels(main_information_widget, "Details", "Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:", details_data, QPoint(6, 62), QSize(636-18, 142)); - UiUtils::CreateSelectableTextParagraph(main_information_widget, "Synopsis", QString::fromUtf8(anime->synopsis.c_str()), QPoint(6, 202), QSize(636-18, 253)); + QWidget* soidjhfh = UiUtils::CreateTextParagraphWithLabels(main_information_widget, "Details", "Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:", details_data)->parentWidget()->parentWidget(); + main_information_widget->layout()->addWidget(soidjhfh); + + 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()); + + //((QVBoxLayout*)main_information_widget->layout())->addStretch(); + tabbed_widget->addTab(main_information_widget, "Main information"); QWidget* settings_widget = new QWidget(tabbed_widget); tabbed_widget->addTab(settings_widget, "My list and settings");