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