Mercurial > minori
annotate src/gui/dialog/information.cpp @ 66:6481c5aed3e1
posters: add poster widget...
why does AniList call these cover images? they're posters...
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 02 Oct 2023 05:56:32 -0400 |
parents | 26721c28bf22 |
children | 2417121d894e |
rev | line source |
---|---|
9 | 1 #include "gui/dialog/information.h" |
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 | 4 #include "core/array.h" |
9 | 5 #include "core/strings.h" |
6 #include "gui/pages/anime_list.h" | |
7 #include "gui/translate/anime.h" | |
64 | 8 #include "gui/widgets/anime_info.h" |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
65
diff
changeset
|
9 #include "gui/widgets/poster.h" |
63 | 10 #include "gui/widgets/optional_date.h" |
46 | 11 #include "gui/widgets/text.h" |
9 | 12 #include "gui/window.h" |
46 | 13 #include <QCheckBox> |
14 #include <QComboBox> | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
15 #include <QDateEdit> |
9 | 16 #include <QDebug> |
17 #include <QDialogButtonBox> | |
46 | 18 #include <QLineEdit> |
9 | 19 #include <QPlainTextEdit> |
46 | 20 #include <QSpinBox> |
21 #include <QStringList> | |
9 | 22 #include <QTextStream> |
23 #include <QVBoxLayout> | |
24 #include <functional> | |
25 | |
46 | 26 /* TODO: Taiga disables rendering of the tab widget entirely when the anime is not part of a list, |
27 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
|
28 void InformationDialog::SaveData() { |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
29 Anime::Anime& anime = Anime::db.items[id]; |
51 | 30 anime.SetUserProgress(progress); |
31 anime.SetUserScore(score); | |
32 anime.SetUserIsRewatching(rewatching); | |
33 anime.SetUserStatus(status); | |
34 anime.SetUserNotes(notes); | |
35 anime.SetUserDateStarted(started); | |
36 anime.SetUserDateCompleted(completed); | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
37 } |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
38 |
46 | 39 InformationDialog::InformationDialog(const Anime::Anime& anime, std::function<void()> accept, QWidget* parent) |
15 | 40 : QDialog(parent) { |
9 | 41 setFixedSize(842, 613); |
42 setWindowTitle(tr("Anime Information")); | |
43 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); | |
36 | 44 |
45 { | |
46 QPalette pal; | |
47 pal.setColor(QPalette::Window, Qt::white); | |
48 setPalette(pal); | |
49 } | |
9 | 50 |
51 QWidget* widget = new QWidget(this); | |
52 | |
53 /* "sidebar", includes... just the anime image :) */ | |
54 QWidget* sidebar = new QWidget(widget); | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
65
diff
changeset
|
55 QVBoxLayout* sidebar_layout = new QVBoxLayout(sidebar); |
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
65
diff
changeset
|
56 Poster* poster = new Poster(anime.GetId(), sidebar); |
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
65
diff
changeset
|
57 sidebar_layout->addWidget(poster); |
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
65
diff
changeset
|
58 sidebar_layout->setContentsMargins(0, 0, 0, 0); |
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
65
diff
changeset
|
59 sidebar_layout->addStretch(); |
9 | 60 sidebar->setFixedWidth(175); |
61 | |
62 /* main widget */ | |
63 QWidget* main_widget = new QWidget(widget); | |
36 | 64 |
65 { | |
66 QPalette pal; | |
67 pal.setColor(QPalette::Window, Qt::white); | |
68 main_widget->setPalette(pal); | |
69 } | |
70 | |
9 | 71 main_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
72 | |
51 | 73 id = anime.GetId(); |
9 | 74 /* anime title header text */ |
64 | 75 TextWidgets::Title* anime_title = |
65
26721c28bf22
*: avoid usage of (to|from)StdString
Paper <mrpapersonic@gmail.com>
parents:
64
diff
changeset
|
76 new TextWidgets::Title(Strings::ToQString(anime.GetUserPreferredTitle()), main_widget); |
9 | 77 |
78 /* tabbed widget */ | |
79 QTabWidget* tabbed_widget = new QTabWidget(main_widget); | |
80 tabbed_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); | |
81 | |
82 /* main info tab */ | |
64 | 83 AnimeInfoWidget* main_information_widget = new AnimeInfoWidget(anime, tabbed_widget); |
9 | 84 |
85 QWidget* settings_widget = new QWidget(tabbed_widget); | |
46 | 86 settings_widget->setLayout(new QVBoxLayout); |
87 settings_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); | |
88 | |
89 settings_widget->layout()->addWidget(new TextWidgets::Header(tr("Anime list"), settings_widget)); | |
90 | |
91 QWidget* sg_anime_list_content = new QWidget(settings_widget); | |
92 settings_widget->layout()->addWidget(sg_anime_list_content); | |
93 sg_anime_list_content->setLayout(new QVBoxLayout); | |
94 sg_anime_list_content->layout()->setSpacing(5); | |
95 sg_anime_list_content->layout()->setContentsMargins(12, 0, 0, 0); | |
96 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
97 /* 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
|
98 #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
|
99 #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
|
100 #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
|
101 /* 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
|
102 #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
|
103 { \ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
104 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
|
105 subsection->setLayout(new QVBoxLayout); \ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
106 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
|
107 subsection->layout()->setSpacing(LAYOUT_VERT_SPACING); \ |
62 | 108 subsection->layout()->setContentsMargins(0, 0, 0, 0); \ |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
109 x; \ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
110 layout->addWidget(subsection); \ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
111 } |
64 | 112 |
113 /* Creates a subsection with a width of 175 */ | |
114 #define CREATE_SUBSECTION(x) CREATE_FULL_WIDTH_SUBSECTION(x subsection->setFixedWidth(LAYOUT_ITEM_WIDTH);) | |
115 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
116 /* 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
|
117 #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
|
118 { \ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
119 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
|
120 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
|
121 layout->setSpacing(LAYOUT_HORIZ_SPACING); \ |
62 | 122 layout->setContentsMargins(0, 0, 0, 0); \ |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
123 x; \ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
124 a->layout()->addWidget(section); \ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
125 } |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
126 |
64 | 127 /* Creates a section in the parent `a` */ |
128 #define CREATE_SECTION(a, x) CREATE_FULL_WIDTH_SECTION(a, x layout->addStretch();) | |
129 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
130 CREATE_SECTION(sg_anime_list_content, { |
46 | 131 /* Episodes watched section */ |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
132 CREATE_SUBSECTION({ |
46 | 133 subsection->layout()->addWidget(new QLabel(tr("Episodes watched:"), subsection)); |
134 | |
135 QSpinBox* spin_box = new QSpinBox(subsection); | |
63 | 136 connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int i) { progress = i; }); |
46 | 137 spin_box->setRange(0, anime.GetEpisodes()); |
138 spin_box->setSingleStep(1); | |
51 | 139 spin_box->setValue(progress = anime.GetUserProgress()); |
46 | 140 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
|
141 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
142 CREATE_SUBSECTION({ |
46 | 143 subsection->layout()->addWidget(new QLabel(tr(" "), subsection)); |
144 | |
51 | 145 QCheckBox* checkbox = new QCheckBox(tr("Rewatching")); |
63 | 146 connect(checkbox, QOverload<int>::of(&QCheckBox::stateChanged), this, |
147 [this](int state) { rewatching = (state == Qt::Checked); }); | |
51 | 148 checkbox->setCheckState(anime.GetUserIsRewatching() ? Qt::Checked : Qt::Unchecked); |
149 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
|
150 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
151 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
152 CREATE_SECTION(sg_anime_list_content, { |
46 | 153 /* Status & score section */ |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
154 CREATE_SUBSECTION({ |
46 | 155 subsection->layout()->addWidget(new QLabel(tr("Status:"), subsection)); |
156 | |
157 QStringList string_list; | |
158 for (unsigned int i = 0; i < ARRAYSIZE(Anime::ListStatuses); i++) | |
65
26721c28bf22
*: avoid usage of (to|from)StdString
Paper <mrpapersonic@gmail.com>
parents:
64
diff
changeset
|
159 string_list.append(Strings::ToQString(Translate::ToString(Anime::ListStatuses[i]))); |
46 | 160 |
161 QComboBox* combo_box = new QComboBox(subsection); | |
162 combo_box->addItems(string_list); | |
63 | 163 connect(combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, |
164 [this](int i) { status = Anime::ListStatuses[i]; }); | |
165 combo_box->setCurrentIndex(static_cast<int>(status = anime.GetUserStatus()) - 1); | |
46 | 166 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
|
167 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
168 CREATE_SUBSECTION({ |
46 | 169 subsection->layout()->addWidget(new QLabel(tr("Score:"), subsection)); |
170 | |
171 QSpinBox* spin_box = new QSpinBox(subsection); | |
63 | 172 connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int i) { score = i; }); |
46 | 173 spin_box->setRange(0, 100); |
174 spin_box->setSingleStep(5); | |
51 | 175 spin_box->setValue(score = anime.GetUserScore()); |
46 | 176 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
|
177 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
178 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
179 CREATE_FULL_WIDTH_SECTION(sg_anime_list_content, { |
46 | 180 /* Notes section */ |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
181 CREATE_FULL_WIDTH_SUBSECTION({ |
46 | 182 subsection->layout()->addWidget(new QLabel(tr("Notes:"), subsection)); |
183 | |
51 | 184 QLineEdit* line_edit = new QLineEdit(subsection); |
185 connect(line_edit, &QLineEdit::textChanged, this, [this](const QString& text) { | |
186 /* this sucks but I don't really want to implement anything smarter :) */ | |
65
26721c28bf22
*: avoid usage of (to|from)StdString
Paper <mrpapersonic@gmail.com>
parents:
64
diff
changeset
|
187 notes = Strings::ToUtf8String(text); |
51 | 188 }); |
65
26721c28bf22
*: avoid usage of (to|from)StdString
Paper <mrpapersonic@gmail.com>
parents:
64
diff
changeset
|
189 line_edit->setText(Strings::ToQString(notes = anime.GetUserNotes())); |
46 | 190 line_edit->setPlaceholderText(tr("Enter your notes about this anime")); |
191 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
|
192 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
193 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
194 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
|
195 /* Dates section */ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
196 CREATE_SUBSECTION({ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
197 subsection->layout()->addWidget(new QLabel(tr("Date started:"), subsection)); |
46 | 198 |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
199 OptionalDate* date = new OptionalDate(true, subsection); |
63 | 200 connect(date, &OptionalDate::DataChanged, this, |
201 [this](bool enabled, Date date) { started = (enabled) ? date : Date(); }); | |
51 | 202 started = anime.GetUserDateStarted(); |
203 if (!started.IsValid()) { | |
204 date->SetEnabled(false); | |
205 started = anime.GetAirDate(); | |
206 } | |
207 date->SetDate(started); | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
208 subsection->layout()->addWidget(date); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
209 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
210 CREATE_SUBSECTION({ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
211 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
|
212 |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
213 OptionalDate* date = new OptionalDate(true, subsection); |
63 | 214 connect(date, &OptionalDate::DataChanged, this, |
215 [this](bool enabled, Date date) { completed = (enabled) ? date : Date(); }); | |
51 | 216 completed = anime.GetUserDateCompleted(); |
217 if (!completed.IsValid()) { | |
218 date->SetEnabled(false); | |
219 completed = anime.GetAirDate(); | |
220 } | |
221 date->SetDate(completed); | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
222 subsection->layout()->addWidget(date); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
223 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
224 }); |
46 | 225 |
226 settings_widget->layout()->addWidget(new TextWidgets::Header(tr("Local settings"), settings_widget)); | |
227 | |
228 QWidget* sg_local_content = new QWidget(settings_widget); | |
229 settings_widget->layout()->addWidget(sg_local_content); | |
230 sg_local_content->setLayout(new QVBoxLayout); | |
231 sg_local_content->layout()->setSpacing(5); | |
232 sg_local_content->layout()->setContentsMargins(12, 0, 0, 0); | |
233 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
234 CREATE_FULL_WIDTH_SECTION(sg_local_content, { |
46 | 235 /* Alternative titles */ |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
236 CREATE_FULL_WIDTH_SUBSECTION({ |
46 | 237 subsection->layout()->addWidget(new QLabel(tr("Alternative titles:"), subsection)); |
238 | |
65
26721c28bf22
*: avoid usage of (to|from)StdString
Paper <mrpapersonic@gmail.com>
parents:
64
diff
changeset
|
239 QLineEdit* line_edit = new QLineEdit(Strings::ToQString(anime.GetUserNotes()), subsection); |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
240 line_edit->setPlaceholderText( |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
241 tr("Enter alternative titles here, separated by a semicolon (i.e. Title 1; Title 2)")); |
46 | 242 subsection->layout()->addWidget(line_edit); |
243 | |
51 | 244 QCheckBox* checkbox = new QCheckBox(tr("Use the first alternative title to search for torrents")); |
46 | 245 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
|
246 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
247 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
248 #undef CREATE_SECTION |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
249 #undef CREATE_SUBSECTION |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
250 #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
|
251 #undef CREATE_FULL_WIDTH_SUBSECTION |
46 | 252 |
64 | 253 reinterpret_cast<QBoxLayout*>(settings_widget->layout())->addStretch(); |
9 | 254 |
51 | 255 tabbed_widget->addTab(main_information_widget, tr("Main information")); |
256 tabbed_widget->addTab(settings_widget, tr("My list and settings")); | |
9 | 257 |
258 QVBoxLayout* main_layout = new QVBoxLayout; | |
259 main_layout->addWidget(anime_title); | |
260 main_layout->addWidget(tabbed_widget); | |
62 | 261 main_layout->setContentsMargins(0, 0, 0, 0); |
9 | 262 main_widget->setLayout(main_layout); |
263 | |
264 QHBoxLayout* layout = new QHBoxLayout; | |
265 layout->addWidget(sidebar); | |
266 layout->addWidget(main_widget); | |
267 widget->setLayout(layout); | |
268 | |
269 QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); | |
270 connect(button_box, &QDialogButtonBox::accepted, this, [this, accept] { | |
51 | 271 SaveData(); |
9 | 272 accept(); |
273 QDialog::accept(); | |
274 }); | |
275 connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject); | |
276 | |
277 QVBoxLayout* buttons_layout = new QVBoxLayout; | |
278 buttons_layout->addWidget(widget); | |
279 buttons_layout->addWidget(button_box, 0, Qt::AlignBottom); | |
280 setLayout(buttons_layout); | |
281 } | |
282 | |
283 #include "gui/dialog/moc_information.cpp" |