annotate src/gui/dialog/information.cpp @ 47:d8eb763e6661

information.cpp: add widgets to the list tab, and add an "optional date" widget like taiga has so users can specify whether to set the date or not
author Paper <mrpapersonic@gmail.com>
date Mon, 25 Sep 2023 00:43:38 -0400
parents d0adc4aedfc8
children 75c804f713b2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "gui/dialog/information.h"
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #include "core/anime.h"
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
3 #include "core/anime_db.h"
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
4 #include "core/array.h"
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 #include "core/strings.h"
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 #include "gui/pages/anime_list.h"
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7 #include "gui/translate/anime.h"
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
8 #include "gui/widgets/text.h"
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
9 #include "gui/widgets/optional_date.h"
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 #include "gui/window.h"
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
11 #include <QCheckBox>
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
12 #include <QComboBox>
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
13 #include <QDateEdit>
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 #include <QDebug>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 #include <QDialogButtonBox>
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
16 #include <QLineEdit>
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 #include <QPlainTextEdit>
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
18 #include <QSpinBox>
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
19 #include <QStringList>
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 #include <QTextStream>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 #include <QVBoxLayout>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 #include <functional>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
24 /* TODO: Taiga disables rendering of the tab widget entirely when the anime is not part of a list,
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
25 which sucks. Think of a better way to implement this later. */
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
26 void InformationDialog::SaveData() {
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
27 Anime::Anime& anime = Anime::db.items[id];
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
28 }
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
29
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
30 InformationDialog::InformationDialog(const Anime::Anime& anime, std::function<void()> accept, QWidget* parent)
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
31 : QDialog(parent) {
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32 setFixedSize(842, 613);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
33 setWindowTitle(tr("Anime Information"));
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
36
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
35
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
36 {
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
37 QPalette pal;
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
38 pal.setColor(QPalette::Window, Qt::white);
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
39 setPalette(pal);
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
40 }
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
41
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
42 QWidget* widget = new QWidget(this);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
43
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
44 /* "sidebar", includes... just the anime image :) */
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
45 QWidget* sidebar = new QWidget(widget);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
46 sidebar->setFixedWidth(175);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
47
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
48 /* main widget */
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
49 QWidget* main_widget = new QWidget(widget);
36
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
50
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
51 {
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
52 QPalette pal;
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
53 pal.setColor(QPalette::Window, Qt::white);
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
54 main_widget->setPalette(pal);
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
55 }
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
56
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
57 main_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
58
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
59 /* anime title header text */
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
60 TextWidgets::Paragraph* anime_title =
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
61 new TextWidgets::Paragraph(QString::fromUtf8(anime.GetUserPreferredTitle().c_str()), main_widget);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
62 anime_title->setReadOnly(true);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
63 anime_title->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
64 anime_title->setWordWrapMode(QTextOption::NoWrap);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
65 anime_title->setFrameShape(QFrame::NoFrame);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
66 anime_title->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
67 anime_title->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
68 anime_title->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
36
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
69
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
70 {
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
71 QFont font(anime_title->font());
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
72 font.setPointSize(12);
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
73 anime_title->setFont(font);
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
74 }
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
75
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
76 {
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
77 QPalette pal;
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
78 pal.setColor(QPalette::Window, Qt::transparent);
36
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
79 pal.setColor(QPalette::WindowText, Qt::blue);
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
80 }
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
81
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
82 /* tabbed widget */
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
83 QTabWidget* tabbed_widget = new QTabWidget(main_widget);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
84 tabbed_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
85
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
86 /* main info tab */
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
87 QWidget* main_information_widget = new QWidget(tabbed_widget);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
88 main_information_widget->setLayout(new QVBoxLayout);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
89
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
90 /* alt titles */
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
91 main_information_widget->layout()->addWidget(new TextWidgets::SelectableTextParagraph(
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
92 "Alternative titles", QString::fromUtf8(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()),
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
93 main_information_widget));
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
94
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
95 /* details */
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
96 QString details_data;
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
97 QTextStream details_data_s(&details_data);
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
98 details_data_s << Translate::ToString(anime.GetFormat()).c_str() << "\n"
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
99 << anime.GetEpisodes() << "\n"
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
100 << Translate::ToString(anime.GetUserStatus()).c_str() << "\n"
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
101 << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n"
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
102 << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n"
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
103 << anime.GetAudienceScore() << "%";
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
104 main_information_widget->layout()->addWidget(new TextWidgets::LabelledTextParagraph(
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
105 "Details", "Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:", details_data, main_information_widget));
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
106
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
107 /* synopsis */
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
108 TextWidgets::SelectableTextParagraph* synopsis = new TextWidgets::SelectableTextParagraph(
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
109 "Synopsis", QString::fromUtf8(anime.GetSynopsis().c_str()), main_information_widget);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
110
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
111 synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
112 main_information_widget->layout()->addWidget(synopsis);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
113
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
114 QWidget* settings_widget = new QWidget(tabbed_widget);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
115 settings_widget->setLayout(new QVBoxLayout);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
116 settings_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
117
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
118 settings_widget->layout()->addWidget(new TextWidgets::Header(tr("Anime list"), settings_widget));
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
119
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
120 QWidget* sg_anime_list_content = new QWidget(settings_widget);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
121 settings_widget->layout()->addWidget(sg_anime_list_content);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
122 sg_anime_list_content->setLayout(new QVBoxLayout);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
123 sg_anime_list_content->layout()->setSpacing(5);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
124 sg_anime_list_content->layout()->setContentsMargins(12, 0, 0, 0);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
125
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
126 /* these macros make this a lot easier to edit */
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
127 #define LAYOUT_HORIZ_SPACING 25
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
128 #define LAYOUT_VERT_SPACING 5
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
129 #define LAYOUT_ITEM_WIDTH 175
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
130 /* Creates a subsection with a width of 175 */
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
131 #define CREATE_SUBSECTION(x) \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
132 { \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
133 QWidget* subsection = new QWidget(section); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
134 subsection->setLayout(new QVBoxLayout); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
135 subsection->setFixedWidth(LAYOUT_ITEM_WIDTH); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
136 subsection->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
137 subsection->layout()->setSpacing(LAYOUT_VERT_SPACING); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
138 subsection->layout()->setMargin(0); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
139 x; \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
140 layout->addWidget(subsection); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
141 }
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
142 /* Creates a section in the parent `a` */
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
143 #define CREATE_SECTION(a, x) \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
144 { \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
145 QWidget* section = new QWidget(a); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
146 QHBoxLayout* layout = new QHBoxLayout(section); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
147 layout->setSpacing(LAYOUT_HORIZ_SPACING); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
148 layout->setMargin(0); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
149 x; \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
150 layout->addStretch(); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
151 a->layout()->addWidget(section); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
152 }
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
153 /* Creates a subsection that takes up whatever space is necessary */
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
154 #define CREATE_FULL_WIDTH_SUBSECTION(x) \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
155 { \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
156 QWidget* subsection = new QWidget(section); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
157 subsection->setLayout(new QVBoxLayout); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
158 subsection->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
159 subsection->layout()->setSpacing(LAYOUT_VERT_SPACING); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
160 subsection->layout()->setMargin(0); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
161 x; \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
162 layout->addWidget(subsection); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
163 }
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
164 /* Creates a section in the parent `a` */
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
165 #define CREATE_FULL_WIDTH_SECTION(a, x) \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
166 { \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
167 QWidget* section = new QWidget(a); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
168 QHBoxLayout* layout = new QHBoxLayout(section); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
169 layout->setSpacing(LAYOUT_HORIZ_SPACING); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
170 layout->setMargin(0); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
171 x; \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
172 a->layout()->addWidget(section); \
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
173 }
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
174
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
175 CREATE_SECTION(sg_anime_list_content, {
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
176 /* Episodes watched section */
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
177 CREATE_SUBSECTION({
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
178 subsection->layout()->addWidget(new QLabel(tr("Episodes watched:"), subsection));
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
179
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
180 QSpinBox* spin_box = new QSpinBox(subsection);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
181 spin_box->setRange(0, anime.GetEpisodes());
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
182 spin_box->setSingleStep(1);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
183 spin_box->setValue(anime.GetUserProgress());
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
184 subsection->layout()->addWidget(spin_box);
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
185 });
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
186 CREATE_SUBSECTION({
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
187 subsection->layout()->addWidget(new QLabel(tr(" "), subsection));
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
188
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
189 QCheckBox* rewatched_checkbox = new QCheckBox("Rewatching");
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
190 subsection->layout()->addWidget(rewatched_checkbox);
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
191 });
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
192 });
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
193 CREATE_SECTION(sg_anime_list_content, {
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
194 /* Status & score section */
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
195 CREATE_SUBSECTION({
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
196 subsection->layout()->addWidget(new QLabel(tr("Status:"), subsection));
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
197
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
198 QStringList string_list;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
199 for (unsigned int i = 0; i < ARRAYSIZE(Anime::ListStatuses); i++)
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
200 string_list.append(QString::fromStdString(Translate::ToString(Anime::ListStatuses[i])));
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
201
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
202 QComboBox* combo_box = new QComboBox(subsection);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
203 combo_box->addItems(string_list);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
204 subsection->layout()->addWidget(combo_box);
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
205 });
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
206 CREATE_SUBSECTION({
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
207 subsection->layout()->addWidget(new QLabel(tr("Score:"), subsection));
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
208
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
209 QSpinBox* spin_box = new QSpinBox(subsection);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
210 spin_box->setRange(0, 100);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
211 spin_box->setSingleStep(5);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
212 spin_box->setValue(anime.GetUserScore());
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
213 subsection->layout()->addWidget(spin_box);
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
214 });
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
215 });
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
216 CREATE_FULL_WIDTH_SECTION(sg_anime_list_content, {
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
217 /* Notes section */
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
218 CREATE_FULL_WIDTH_SUBSECTION({
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
219 subsection->layout()->addWidget(new QLabel(tr("Notes:"), subsection));
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
220
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
221 QLineEdit* line_edit = new QLineEdit(QString::fromStdString(anime.GetUserNotes()), subsection);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
222 line_edit->setPlaceholderText(tr("Enter your notes about this anime"));
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
223 subsection->layout()->addWidget(line_edit);
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
224 });
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
225 });
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
226 CREATE_SECTION(sg_anime_list_content, {
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
227 /* Dates section */
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
228 CREATE_SUBSECTION({
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
229 subsection->layout()->addWidget(new QLabel(tr("Date started:"), subsection));
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
230
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
231 OptionalDate* date = new OptionalDate(true, subsection);
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
232 date->SetDate(QDate(2000, 1, 1));
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
233 subsection->layout()->addWidget(date);
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
234 });
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
235 CREATE_SUBSECTION({
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
236 subsection->layout()->addWidget(new QLabel(tr("Date completed:"), subsection));
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
237
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
238 OptionalDate* date = new OptionalDate(true, subsection);
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
239 date->SetDate(QDate(2000, 1, 1));
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
240 subsection->layout()->addWidget(date);
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
241 });
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
242 });
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
243
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
244 settings_widget->layout()->addWidget(new TextWidgets::Header(tr("Local settings"), settings_widget));
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
245
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
246 QWidget* sg_local_content = new QWidget(settings_widget);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
247 settings_widget->layout()->addWidget(sg_local_content);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
248 sg_local_content->setLayout(new QVBoxLayout);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
249 sg_local_content->layout()->setSpacing(5);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
250 sg_local_content->layout()->setContentsMargins(12, 0, 0, 0);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
251
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
252 CREATE_FULL_WIDTH_SECTION(sg_local_content, {
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
253 /* Alternative titles */
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
254 CREATE_FULL_WIDTH_SUBSECTION({
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
255 subsection->layout()->addWidget(new QLabel(tr("Alternative titles:"), subsection));
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
256
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
257 QLineEdit* line_edit = new QLineEdit(QString::fromStdString(anime.GetUserNotes()), subsection);
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
258 line_edit->setPlaceholderText(
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
259 tr("Enter alternative titles here, separated by a semicolon (i.e. Title 1; Title 2)"));
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
260 subsection->layout()->addWidget(line_edit);
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
261
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
262 QCheckBox* checkbox = new QCheckBox("Use the first alternative title to search for torrents");
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
263 subsection->layout()->addWidget(checkbox);
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
264 });
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
265 });
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
266 #undef CREATE_SECTION
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
267 #undef CREATE_SUBSECTION
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
268 #undef CREATE_FULL_WIDTH_SECTION
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
269 #undef CREATE_FULL_WIDTH_SUBSECTION
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
270
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
271 static_cast<QBoxLayout*>(settings_widget->layout())->addStretch();
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
272
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
273 tabbed_widget->addTab(main_information_widget, "Main information");
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
274 tabbed_widget->addTab(settings_widget, "My list and settings");
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
275
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
276 QVBoxLayout* main_layout = new QVBoxLayout;
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
277 main_layout->addWidget(anime_title);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
278 main_layout->addWidget(tabbed_widget);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
279 main_layout->setMargin(0);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
280 main_widget->setLayout(main_layout);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
281
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
282 QHBoxLayout* layout = new QHBoxLayout;
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
283 layout->addWidget(sidebar);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
284 layout->addWidget(main_widget);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
285 widget->setLayout(layout);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
286
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
287 QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
288 connect(button_box, &QDialogButtonBox::accepted, this, [this, accept] {
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
289 accept();
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
290 QDialog::accept();
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
291 });
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
292 connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
293
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
294 QVBoxLayout* buttons_layout = new QVBoxLayout;
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
295 buttons_layout->addWidget(widget);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
296 buttons_layout->addWidget(button_box, 0, Qt::AlignBottom);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
297 setLayout(buttons_layout);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
298 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
299
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
300 #include "gui/dialog/moc_information.cpp"