comparison src/dialog/information.cpp @ 6:1d82f6e04d7d

Update: add first parts to the settings dialog
author Paper <mrpapersonic@gmail.com>
date Wed, 16 Aug 2023 00:49:17 -0400
parents 190ded9438c0
children 07a9095eaeed
comparison
equal deleted inserted replaced
5:51ae25154b70 6:1d82f6e04d7d
23 QWidget* widget = new QWidget(this); 23 QWidget* widget = new QWidget(this);
24 widget->resize(842-175, 530); 24 widget->resize(842-175, 530);
25 widget->move(175, 0); 25 widget->move(175, 0);
26 widget->setStyleSheet(UiUtils::IsInDarkMode() ? "" : "background-color: white"); 26 widget->setStyleSheet(UiUtils::IsInDarkMode() ? "" : "background-color: white");
27 widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 27 widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
28 QPlainTextEdit* anime_title = new QPlainTextEdit(QString::fromWCharArray(anime->title.english.c_str()), widget); 28 QPlainTextEdit* anime_title = new QPlainTextEdit(QString::fromUtf8(anime->title.english.c_str()), widget);
29 anime_title->setReadOnly(true); 29 anime_title->setReadOnly(true);
30 anime_title->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 30 anime_title->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
31 anime_title->setWordWrapMode(QTextOption::NoWrap); 31 anime_title->setWordWrapMode(QTextOption::NoWrap);
32 anime_title->setFrameShape(QFrame::NoFrame); 32 anime_title->setFrameShape(QFrame::NoFrame);
33 anime_title->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
34 anime_title->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
35 anime_title->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
36 anime_title->setStyleSheet("font-size: 16px; color: blue; background: transparent;");
33 anime_title->resize(636, 28); 37 anime_title->resize(636, 28);
34 anime_title->move(0, 12); 38 anime_title->move(0, 12);
35 anime_title->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
36 anime_title->setStyleSheet("font-size: 16px; color: blue");
37 QTabWidget* tabbed_widget = new QTabWidget(widget); 39 QTabWidget* tabbed_widget = new QTabWidget(widget);
38 tabbed_widget->resize(636, 485); 40 tabbed_widget->resize(636, 485);
39 tabbed_widget->move(0, 45); 41 tabbed_widget->move(0, 45);
40 tabbed_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 42 tabbed_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
41 QWidget* main_information_widget = new QWidget(tabbed_widget); 43 QWidget* main_information_widget = new QWidget(tabbed_widget);
47 << AnimeAiringToStringMap[anime->airing].c_str() << "\n" 49 << AnimeAiringToStringMap[anime->airing].c_str() << "\n"
48 << AnimeSeasonToStringMap[anime->season].c_str() << " " << anime->air_date.GetYear() << "\n" 50 << AnimeSeasonToStringMap[anime->season].c_str() << " " << anime->air_date.GetYear() << "\n"
49 << StringUtils::Implode(anime->genres, ", ").c_str() << "\n" 51 << StringUtils::Implode(anime->genres, ", ").c_str() << "\n"
50 << anime->audience_score << "%\n"; 52 << anime->audience_score << "%\n";
51 UiUtils::CreateTextParagraphWithLabels(main_information_widget, "Details", "Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:", details_data, QPoint(6, 62), QSize(636-18, 142)); 53 UiUtils::CreateTextParagraphWithLabels(main_information_widget, "Details", "Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:", details_data, QPoint(6, 62), QSize(636-18, 142));
52 UiUtils::CreateSelectableTextParagraph(main_information_widget, "Synopsis", QString::fromWCharArray(anime->synopsis.c_str()), QPoint(6, 202), QSize(636-18, 253)); 54 UiUtils::CreateSelectableTextParagraph(main_information_widget, "Synopsis", QString::fromUtf8(anime->synopsis.c_str()), QPoint(6, 202), QSize(636-18, 253));
53 tabbed_widget->addTab(main_information_widget, "Main information"); 55 tabbed_widget->addTab(main_information_widget, "Main information");
54 QWidget* settings_widget = new QWidget(tabbed_widget); 56 QWidget* settings_widget = new QWidget(tabbed_widget);
55 tabbed_widget->addTab(settings_widget, "My list and settings"); 57 tabbed_widget->addTab(settings_widget, "My list and settings");
56 QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); 58 QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
57 connect(button_box, &QDialogButtonBox::accepted, this, &InformationDialog::OnOK); 59 connect(button_box, &QDialogButtonBox::accepted, this, &InformationDialog::OnOK);
58 connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject); 60 connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
59 QVBoxLayout* buttons_layout = new QVBoxLayout(widget); 61 QVBoxLayout* buttons_layout = new QVBoxLayout(this);
60 buttons_layout->addWidget(widget, 0, Qt::AlignTop); 62 //buttons_layout->addWidget(widget, 0, Qt::AlignTop);
61 buttons_layout->addWidget(button_box, 0, Qt::AlignBottom); 63 buttons_layout->addWidget(button_box, 0, Qt::AlignBottom);
62 // this should probably be win32-only 64 // this should probably be win32-only
63 setStyleSheet(UiUtils::IsInDarkMode() ? "" : "QDialog#infodiag{background-color: white;}"); 65 setStyleSheet(UiUtils::IsInDarkMode() ? "" : "QDialog#infodiag{background-color: white;}");
64 setLayout(buttons_layout); 66 setLayout(buttons_layout);
65 } 67 }