Mercurial > minori
comparison src/gui/dialog/information.cc @ 108:2004b41d4a59
*: huge commit
1. WORKING LOCALIZATION + translation for Spanish and British English
2. idk like 2 changes for the dark theme :)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 05 Nov 2023 23:31:49 -0500 |
parents | 6d8da6e64d61 |
children | 39521c47c7a3 |
comparison
equal
deleted
inserted
replaced
107:49c8d1976869 | 108:2004b41d4a59 |
---|---|
1 #include "gui/dialog/information.h" | 1 #include "gui/dialog/information.h" |
2 #include "core/anime.h" | 2 #include "core/anime.h" |
3 #include "core/anime_db.h" | 3 #include "core/anime_db.h" |
4 #include "core/strings.h" | 4 #include "core/strings.h" |
5 #include "core/session.h" | |
5 #include "gui/pages/anime_list.h" | 6 #include "gui/pages/anime_list.h" |
6 #include "gui/translate/anime.h" | 7 #include "gui/translate/anime.h" |
7 #include "gui/widgets/anime_info.h" | 8 #include "gui/widgets/anime_info.h" |
8 #include "gui/widgets/optional_date.h" | 9 #include "gui/widgets/optional_date.h" |
9 #include "gui/widgets/poster.h" | 10 #include "gui/widgets/poster.h" |
20 #include <QSpinBox> | 21 #include <QSpinBox> |
21 #include <QStringList> | 22 #include <QStringList> |
22 #include <QTextStream> | 23 #include <QTextStream> |
23 #include <QVBoxLayout> | 24 #include <QVBoxLayout> |
24 #include <functional> | 25 #include <functional> |
26 #ifdef WIN32 | |
27 #include "sys/win32/dark_theme.h" | |
28 #endif | |
25 | 29 |
26 /* TODO: Taiga disables rendering of the tab widget entirely when the anime is not part of a list, | 30 /* 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. */ | 31 which sucks. Think of a better way to implement this later. */ |
28 void InformationDialog::SaveData(Anime::Anime& anime) { | 32 void InformationDialog::SaveData(Anime::Anime& anime) { |
29 anime.SetUserProgress(_progress); | 33 anime.SetUserProgress(_progress); |
35 anime.SetUserDateCompleted(_completed); | 39 anime.SetUserDateCompleted(_completed); |
36 } | 40 } |
37 | 41 |
38 InformationDialog::InformationDialog(Anime::Anime& anime, std::function<void()> accept, QWidget* parent) | 42 InformationDialog::InformationDialog(Anime::Anime& anime, std::function<void()> accept, QWidget* parent) |
39 : QDialog(parent) { | 43 : QDialog(parent) { |
44 /* ack. lots of brackets here, but MUCH, MUCH MUCH better than what it used to be */ | |
40 setFixedSize(842, 613); | 45 setFixedSize(842, 613); |
41 setWindowTitle(tr("Anime Information")); | 46 setWindowTitle(tr("Anime Information")); |
42 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); | 47 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); |
43 | 48 |
44 { | 49 { |
45 QPalette pal; | 50 QPalette pal; |
46 pal.setColor(QPalette::Window, pal.color(QPalette::Base)); | 51 pal.setColor(QPalette::Window, pal.color(QPalette::Base)); |
47 setPalette(pal); | 52 setPalette(pal); |
48 } | 53 } |
49 | 54 |
50 QWidget* widget = new QWidget(this); | 55 QVBoxLayout* full_layout = new QVBoxLayout(this); |
51 | 56 |
52 /* "sidebar", includes... just the anime image :) */ | 57 { |
53 QWidget* sidebar = new QWidget(widget); | 58 /* this handles the actual page. */ |
54 QVBoxLayout* sidebar_layout = new QVBoxLayout(sidebar); | 59 QWidget* widget = new QWidget(this); |
55 Poster* poster = new Poster(anime, sidebar); | 60 QHBoxLayout* layout = new QHBoxLayout(widget); |
56 sidebar_layout->addWidget(poster); | 61 |
57 sidebar_layout->setContentsMargins(0, 0, 0, 0); | 62 { |
58 sidebar_layout->addStretch(); | 63 /* Sidebar */ |
59 | 64 QWidget* sidebar = new QWidget(widget); |
60 /* main widget */ | 65 QVBoxLayout* sidebar_layout = new QVBoxLayout(sidebar); |
61 QWidget* main_widget = new QWidget(widget); | 66 { |
62 | 67 /* Poster */ |
63 main_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | 68 Poster* poster = new Poster(anime, sidebar); |
64 | 69 sidebar_layout->addWidget(poster); |
65 /* anime title header text */ | 70 } |
66 TextWidgets::Title* anime_title = | 71 sidebar_layout->setContentsMargins(0, 0, 0, 0); |
67 new TextWidgets::Title(Strings::ToQString(anime.GetUserPreferredTitle()), main_widget); | 72 sidebar_layout->addStretch(); |
68 | 73 layout->addWidget(sidebar); |
69 /* tabbed widget */ | 74 } |
70 QTabWidget* tabbed_widget = new QTabWidget(main_widget); | 75 |
71 tabbed_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); | 76 { |
72 | 77 /* ... everything else. */ |
73 /* main info tab */ | 78 QWidget* main_widget = new QWidget(widget); |
74 AnimeInfoWidget* main_information_widget = new AnimeInfoWidget(anime, tabbed_widget); | 79 QVBoxLayout* main_layout = new QVBoxLayout(main_widget); |
75 | 80 |
76 QWidget* settings_widget = new QWidget(tabbed_widget); | 81 main_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
77 settings_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); | 82 |
78 | 83 { |
79 QVBoxLayout* settings_layout = new QVBoxLayout(settings_widget); | 84 /* Anime title */ |
80 settings_layout->addWidget(new TextWidgets::Header(tr("Anime list"), settings_widget)); | 85 TextWidgets::Title* anime_title = |
81 | 86 new TextWidgets::Title(Strings::ToQString(anime.GetUserPreferredTitle()), main_widget); |
82 QWidget* sg_anime_list_content = new QWidget(settings_widget); | 87 main_layout->addWidget(anime_title); |
83 | 88 } |
84 constexpr int LAYOUT_HORIZ_SPACING = 25; | 89 |
85 constexpr int LAYOUT_VERT_SPACING = 5; | 90 { |
86 constexpr int LAYOUT_ITEM_WIDTH = 175; | 91 /* Tab widget, contains main info and settings */ |
87 | 92 QTabWidget* tabbed_widget = new QTabWidget(main_widget); |
88 QVBoxLayout* al_layout = new QVBoxLayout(sg_anime_list_content); | 93 tabbed_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
89 al_layout->setSpacing(LAYOUT_VERT_SPACING); | 94 |
90 al_layout->setContentsMargins(12, 0, 0, 0); | 95 { |
91 | 96 /* Main information */ |
92 const auto CREATE_SECTION = [](QWidget* parent, std::function<void(QWidget*, QGridLayout*)> x) { | 97 AnimeInfoWidget* main_information_widget = new AnimeInfoWidget(anime, tabbed_widget); |
93 QWidget* section = new QWidget(parent); | 98 tabbed_widget->addTab(main_information_widget, tr("Main information")); |
94 QGridLayout* layout = new QGridLayout(section); | 99 } |
95 layout->setHorizontalSpacing(LAYOUT_HORIZ_SPACING); | 100 |
96 layout->setVerticalSpacing(LAYOUT_VERT_SPACING); | 101 { |
97 layout->setContentsMargins(0, 0, 0, 0); | 102 /* My list and settings */ |
98 x(section, layout); | 103 QWidget* settings_widget = new QWidget(tabbed_widget); |
99 parent->layout()->addWidget(section); | 104 settings_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); |
100 }; | 105 |
101 | 106 QVBoxLayout* settings_layout = new QVBoxLayout(settings_widget); |
102 CREATE_SECTION(sg_anime_list_content, [this, &anime](QWidget* section, QGridLayout* layout){ | 107 settings_layout->addWidget(new TextWidgets::Header(tr("Anime list"), settings_widget)); |
103 /* Episodes watched... */ | 108 |
104 layout->addWidget(new QLabel(tr("Episodes watched:"), section), 0, 0); | 109 { |
105 | 110 /* Anime List */ |
106 QSpinBox* spin_box = new QSpinBox(section); | 111 QWidget* sg_anime_list_content = new QWidget(settings_widget); |
107 connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int i) { _progress = i; }); | 112 |
108 spin_box->setRange(0, anime.GetEpisodes()); | 113 constexpr int LAYOUT_HORIZ_SPACING = 25; |
109 spin_box->setSingleStep(1); | 114 constexpr int LAYOUT_VERT_SPACING = 5; |
110 spin_box->setValue(_progress = anime.GetUserProgress()); | 115 constexpr int LAYOUT_ITEM_WIDTH = 175; |
111 spin_box->setFixedWidth(LAYOUT_ITEM_WIDTH); | 116 |
112 layout->addWidget(spin_box, 1, 0); | 117 QVBoxLayout* al_layout = new QVBoxLayout(sg_anime_list_content); |
113 | 118 al_layout->setSpacing(LAYOUT_VERT_SPACING); |
114 /* Rewatching? */ | 119 al_layout->setContentsMargins(12, 0, 0, 0); |
115 QCheckBox* checkbox = new QCheckBox(tr("Rewatching")); | 120 |
116 connect(checkbox, QOverload<int>::of(&QCheckBox::stateChanged), this, | 121 /* Helper function for creating sections, reduces clutter. */ |
117 [this](int state) { _rewatching = (state == Qt::Checked); }); | 122 const auto CREATE_SECTION = [](QWidget* parent, std::function<void(QWidget*, QGridLayout*)> x) { |
118 checkbox->setCheckState((_rewatching = anime.GetUserIsRewatching()) ? Qt::Checked : Qt::Unchecked); | 123 QWidget* section = new QWidget(parent); |
119 checkbox->setFixedWidth(LAYOUT_ITEM_WIDTH); | 124 QGridLayout* layout = new QGridLayout(section); |
120 layout->addWidget(checkbox, 1, 1); | 125 layout->setHorizontalSpacing(LAYOUT_HORIZ_SPACING); |
121 layout->setColumnStretch(layout->columnCount(), 1); | 126 layout->setVerticalSpacing(LAYOUT_VERT_SPACING); |
122 }); | 127 layout->setContentsMargins(0, 0, 0, 0); |
123 | 128 x(section, layout); |
124 CREATE_SECTION(sg_anime_list_content, [this, &anime](QWidget* section, QGridLayout* layout){ | 129 parent->layout()->addWidget(section); |
125 /* Status */ | 130 }; |
126 layout->addWidget(new QLabel(tr("Status:"), section), 0, 0); | 131 |
127 | 132 CREATE_SECTION(sg_anime_list_content, [this, &anime](QWidget* section, QGridLayout* layout){ |
128 QComboBox* combo_box = new QComboBox(section); | 133 { |
129 | 134 /* Episodes watched... */ |
130 for (unsigned int i = 0; i < Anime::ListStatuses.size(); i++) | 135 layout->addWidget(new QLabel(tr("Episodes watched:"), section), 0, 0); |
131 combo_box->addItem(Strings::ToQString(Translate::ToString(Anime::ListStatuses[i])), static_cast<int>(Anime::ListStatuses[i])); | 136 |
132 | 137 QSpinBox* spin_box = new QSpinBox(section); |
133 connect(combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this, combo_box](int) { | 138 connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int i) { _progress = i; }); |
134 _status = static_cast<Anime::ListStatus>(combo_box->currentData().toInt()); | 139 spin_box->setRange(0, anime.GetEpisodes()); |
140 spin_box->setSingleStep(1); | |
141 spin_box->setValue(_progress = anime.GetUserProgress()); | |
142 spin_box->setFixedWidth(LAYOUT_ITEM_WIDTH); | |
143 layout->addWidget(spin_box, 1, 0); | |
144 } | |
145 | |
146 { | |
147 /* Rewatching? */ | |
148 QCheckBox* checkbox = new QCheckBox(tr("Rewatching")); | |
149 connect(checkbox, QOverload<int>::of(&QCheckBox::stateChanged), this, | |
150 [this](int state) { _rewatching = (state == Qt::Checked); }); | |
151 checkbox->setCheckState((_rewatching = anime.GetUserIsRewatching()) ? Qt::Checked : Qt::Unchecked); | |
152 checkbox->setFixedWidth(LAYOUT_ITEM_WIDTH); | |
153 layout->addWidget(checkbox, 1, 1); | |
154 } | |
155 layout->setColumnStretch(layout->columnCount(), 1); | |
156 }); | |
157 | |
158 CREATE_SECTION(sg_anime_list_content, [this, &anime](QWidget* section, QGridLayout* layout){ | |
159 { | |
160 /* Status */ | |
161 layout->addWidget(new QLabel(tr("Status:"), section), 0, 0); | |
162 | |
163 QComboBox* combo_box = new QComboBox(section); | |
164 | |
165 for (unsigned int i = 0; i < Anime::ListStatuses.size(); i++) | |
166 combo_box->addItem(Strings::ToQString(Translate::ToString(Anime::ListStatuses[i])), static_cast<int>(Anime::ListStatuses[i])); | |
167 | |
168 connect(combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this, combo_box](int) { | |
169 _status = static_cast<Anime::ListStatus>(combo_box->currentData().toInt()); | |
170 }); | |
171 | |
172 /* this should NEVER, EVER, be NOT_IN_LIST */ | |
173 combo_box->setCurrentIndex(static_cast<int>(_status = anime.GetUserStatus()) - 1); | |
174 combo_box->setFixedWidth(LAYOUT_ITEM_WIDTH); | |
175 layout->addWidget(combo_box, 1, 0); | |
176 } | |
177 | |
178 { | |
179 /* Score */ | |
180 layout->addWidget(new QLabel(tr("Score:"), section), 0, 1); | |
181 | |
182 QSpinBox* spin_box = new QSpinBox(section); | |
183 connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int i) { | |
184 _score = i; | |
185 }); | |
186 spin_box->setRange(0, 100); | |
187 spin_box->setSingleStep(5); | |
188 spin_box->setValue(_score = anime.GetUserScore()); | |
189 spin_box->setFixedWidth(LAYOUT_ITEM_WIDTH); | |
190 layout->addWidget(spin_box, 1, 1); | |
191 } | |
192 layout->setColumnStretch(layout->columnCount(), 1); | |
193 }); | |
194 | |
195 CREATE_SECTION(sg_anime_list_content, [this, &anime](QWidget* section, QGridLayout* layout){ | |
196 layout->addWidget(new QLabel(tr("Notes:"), section), 0, 0); | |
197 | |
198 QLineEdit* line_edit = new QLineEdit(section); | |
199 connect(line_edit, &QLineEdit::textChanged, this, [this](const QString& text) { | |
200 /* this sucks but I don't really want to implement anything smarter :) */ | |
201 _notes = Strings::ToUtf8String(text); | |
202 }); | |
203 line_edit->setText(Strings::ToQString(_notes = anime.GetUserNotes())); | |
204 line_edit->setPlaceholderText(tr("Enter your notes about this anime")); | |
205 layout->addWidget(line_edit, 1, 0); | |
206 }); | |
207 | |
208 CREATE_SECTION(sg_anime_list_content, [this, &anime](QWidget* section, QGridLayout* layout){ | |
209 /* Started */ | |
210 { | |
211 layout->addWidget(new QLabel(tr("Date started:"), section), 0, 0); | |
212 | |
213 OptionalDate* date = new OptionalDate(true, section); | |
214 connect(date, &OptionalDate::DataChanged, this, | |
215 [this](bool enabled, Date date) { _started = enabled ? date : Date(); }); | |
216 date->setFixedWidth(LAYOUT_ITEM_WIDTH); | |
217 _started = anime.GetUserDateStarted(); | |
218 if (!_started.IsValid()) { | |
219 date->SetEnabled(false); | |
220 _started = anime.GetAirDate(); | |
221 } | |
222 date->SetDate(_started); | |
223 layout->addWidget(date, 1, 0); | |
224 } | |
225 | |
226 /* Completed */ | |
227 { | |
228 layout->addWidget(new QLabel(tr("Date completed:"), section), 0, 1); | |
229 | |
230 OptionalDate* date = new OptionalDate(true, section); | |
231 connect(date, &OptionalDate::DataChanged, this, | |
232 [this](bool enabled, Date date) { _completed = enabled ? date : Date(); }); | |
233 date->setFixedWidth(LAYOUT_ITEM_WIDTH); | |
234 _completed = anime.GetUserDateCompleted(); | |
235 if (!_completed.IsValid()) { | |
236 date->SetEnabled(false); | |
237 _completed = anime.GetAirDate(); | |
238 } | |
239 date->SetDate(_completed); | |
240 layout->addWidget(date, 1, 1); | |
241 } | |
242 layout->setColumnStretch(layout->columnCount(), 1); | |
243 }); | |
244 | |
245 settings_layout->addWidget(sg_anime_list_content); | |
246 } | |
247 | |
248 /* | |
249 { | |
250 // commenting this out until it actually gets implemented :) | |
251 | |
252 settings_layout->addWidget(new TextWidgets::Header(tr("Local settings"), settings_widget)); | |
253 | |
254 QWidget* sg_local_content = new QWidget(settings_widget); | |
255 QVBoxLayout* sg_local_layout = new QVBoxLayout(sg_local_content); | |
256 sg_local_layout->setSpacing(5); | |
257 sg_local_layout->setContentsMargins(12, 0, 0, 0); | |
258 | |
259 CREATE_SECTION(sg_local_content, [this, &anime](QWidget* section, QGridLayout* layout){ | |
260 layout->addWidget(new QLabel(tr("Alternative titles:"), section), 0, 0); | |
261 | |
262 QLineEdit* line_edit = new QLineEdit("", section); | |
263 line_edit->setPlaceholderText( | |
264 tr("Enter alternative titles here, separated by a semicolon (i.e. Title 1; Title 2)")); | |
265 layout->addWidget(line_edit, 1, 0); | |
266 | |
267 QCheckBox* checkbox = new QCheckBox(tr("Use the first alternative title to search for torrents")); | |
268 layout->addWidget(checkbox, 2, 0); | |
269 }); | |
270 | |
271 settings_layout->addWidget(sg_local_content); | |
272 } | |
273 */ | |
274 | |
275 settings_layout->addStretch(); | |
276 | |
277 tabbed_widget->addTab(settings_widget, tr("My list and settings")); | |
278 } | |
279 main_layout->addWidget(tabbed_widget); | |
280 main_layout->setContentsMargins(0, 0, 0, 0); | |
281 main_layout->setSpacing(12); | |
282 } | |
283 | |
284 layout->addWidget(main_widget); | |
285 } | |
286 layout->setSpacing(12); | |
287 full_layout->addWidget(widget); | |
288 } | |
289 | |
290 { | |
291 /* Dialog box buttons */ | |
292 QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); | |
293 connect(button_box, &QDialogButtonBox::accepted, this, [this, accept, &anime] { | |
294 SaveData(anime); | |
295 accept(); | |
296 QDialog::accept(); | |
135 }); | 297 }); |
136 /* this should NEVER, EVER, be NOT_IN_LIST */ | 298 connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject); |
137 combo_box->setCurrentIndex(static_cast<int>(_status = anime.GetUserStatus()) - 1); | 299 full_layout->addWidget(button_box, 0, Qt::AlignBottom); |
138 combo_box->setFixedWidth(LAYOUT_ITEM_WIDTH); | 300 } |
139 layout->addWidget(combo_box, 1, 0); | |
140 | |
141 /* Score */ | |
142 layout->addWidget(new QLabel(tr("Score:"), section), 0, 1); | |
143 | |
144 QSpinBox* spin_box = new QSpinBox(section); | |
145 connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int i) { | |
146 _score = i; | |
147 }); | |
148 spin_box->setRange(0, 100); | |
149 spin_box->setSingleStep(5); | |
150 spin_box->setValue(_score = anime.GetUserScore()); | |
151 spin_box->setFixedWidth(LAYOUT_ITEM_WIDTH); | |
152 layout->addWidget(spin_box, 1, 1); | |
153 layout->setColumnStretch(layout->columnCount(), 1); | |
154 }); | |
155 | |
156 CREATE_SECTION(sg_anime_list_content, [this, &anime](QWidget* section, QGridLayout* layout){ | |
157 layout->addWidget(new QLabel(tr("Notes:"), section), 0, 0); | |
158 | |
159 QLineEdit* line_edit = new QLineEdit(section); | |
160 connect(line_edit, &QLineEdit::textChanged, this, [this](const QString& text) { | |
161 /* this sucks but I don't really want to implement anything smarter :) */ | |
162 _notes = Strings::ToUtf8String(text); | |
163 }); | |
164 line_edit->setText(Strings::ToQString(_notes = anime.GetUserNotes())); | |
165 line_edit->setPlaceholderText(tr("Enter your notes about this anime")); | |
166 layout->addWidget(line_edit, 1, 0); | |
167 }); | |
168 | |
169 CREATE_SECTION(sg_anime_list_content, [this, &anime](QWidget* section, QGridLayout* layout){ | |
170 /* Started */ | |
171 layout->addWidget(new QLabel(tr("Date started:"), section), 0, 0); | |
172 | |
173 OptionalDate* date = new OptionalDate(true, section); | |
174 connect(date, &OptionalDate::DataChanged, this, | |
175 [this](bool enabled, Date date) { _started = enabled ? date : Date(); }); | |
176 date->setFixedWidth(LAYOUT_ITEM_WIDTH); | |
177 _started = anime.GetUserDateStarted(); | |
178 if (!_started.IsValid()) { | |
179 date->SetEnabled(false); | |
180 _started = anime.GetAirDate(); | |
181 } | |
182 date->SetDate(_started); | |
183 layout->addWidget(date, 1, 0); | |
184 | |
185 /* Completed */ | |
186 layout->addWidget(new QLabel(tr("Date completed:"), section), 0, 1); | |
187 | |
188 date = new OptionalDate(true, section); | |
189 connect(date, &OptionalDate::DataChanged, this, | |
190 [this](bool enabled, Date date) { _completed = enabled ? date : Date(); }); | |
191 date->setFixedWidth(LAYOUT_ITEM_WIDTH); | |
192 _completed = anime.GetUserDateCompleted(); | |
193 if (!_completed.IsValid()) { | |
194 date->SetEnabled(false); | |
195 _completed = anime.GetAirDate(); | |
196 } | |
197 date->SetDate(_completed); | |
198 layout->addWidget(date, 1, 1); | |
199 layout->setColumnStretch(layout->columnCount(), 1); | |
200 }); | |
201 | |
202 settings_layout->addWidget(sg_anime_list_content); | |
203 | |
204 /* | |
205 // commenting this out until it actually gets implemented :) | |
206 | |
207 settings_layout->addWidget(new TextWidgets::Header(tr("Local settings"), settings_widget)); | |
208 | |
209 QWidget* sg_local_content = new QWidget(settings_widget); | |
210 QVBoxLayout* sg_local_layout = new QVBoxLayout(sg_local_content); | |
211 sg_local_layout->setSpacing(5); | |
212 sg_local_layout->setContentsMargins(12, 0, 0, 0); | |
213 | |
214 CREATE_SECTION(sg_local_content, [this, &anime](QWidget* section, QGridLayout* layout){ | |
215 layout->addWidget(new QLabel(tr("Alternative titles:"), section), 0, 0); | |
216 | |
217 QLineEdit* line_edit = new QLineEdit("", section); | |
218 line_edit->setPlaceholderText( | |
219 tr("Enter alternative titles here, separated by a semicolon (i.e. Title 1; Title 2)")); | |
220 layout->addWidget(line_edit, 1, 0); | |
221 | |
222 QCheckBox* checkbox = new QCheckBox(tr("Use the first alternative title to search for torrents")); | |
223 layout->addWidget(checkbox, 2, 0); | |
224 }); | |
225 | |
226 settings_layout->addWidget(sg_local_content); | |
227 */ | |
228 #undef CREATE_SECTION | |
229 #undef CREATE_FULL_WIDTH_SECTION | |
230 | |
231 settings_layout->addStretch(); | |
232 | |
233 tabbed_widget->addTab(main_information_widget, tr("Main information")); | |
234 tabbed_widget->addTab(settings_widget, tr("My list and settings")); | |
235 | |
236 QVBoxLayout* main_layout = new QVBoxLayout(main_widget); | |
237 main_layout->addWidget(anime_title); | |
238 main_layout->addWidget(tabbed_widget); | |
239 main_layout->setContentsMargins(0, 0, 0, 0); | |
240 main_layout->setSpacing(12); | |
241 | |
242 QHBoxLayout* layout = new QHBoxLayout(widget); | |
243 layout->addWidget(sidebar); | |
244 layout->addWidget(main_widget); | |
245 layout->setSpacing(12); | |
246 | |
247 QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); | |
248 connect(button_box, &QDialogButtonBox::accepted, this, [this, accept, &anime] { | |
249 SaveData(anime); | |
250 accept(); | |
251 QDialog::accept(); | |
252 }); | |
253 connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject); | |
254 | |
255 QVBoxLayout* buttons_layout = new QVBoxLayout(this); | |
256 buttons_layout->addWidget(widget); | |
257 buttons_layout->addWidget(button_box, 0, Qt::AlignBottom); | |
258 } | 301 } |
259 | 302 |
303 void InformationDialog::showEvent(QShowEvent* event) { | |
304 QDialog::showEvent(event); | |
305 #ifdef WIN32 | |
306 win32::SetTitleBarsToBlack(session.config.theme.IsInDarkTheme()); | |
307 #endif | |
308 } | |
309 | |
260 #include "gui/dialog/moc_information.cpp" | 310 #include "gui/dialog/moc_information.cpp" |