Mercurial > minori
annotate src/gui/dialog/information.cc @ 86:c912128af0eb
*: various macos fixes
todo: push that bsd thing to upstream
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 31 Oct 2023 13:52:36 -0400 |
parents | d02fdf1d6708 |
children | 4aef97f4d998 |
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" |
9 | 4 #include "core/strings.h" |
5 #include "gui/pages/anime_list.h" | |
6 #include "gui/translate/anime.h" | |
64 | 7 #include "gui/widgets/anime_info.h" |
76 | 8 #include "gui/widgets/optional_date.h" |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
65
diff
changeset
|
9 #include "gui/widgets/poster.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> | |
76 | 17 #include <QLabel> |
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. */ | |
83 | 28 void InformationDialog::SaveData(Anime::Anime& anime) { |
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 |
83 | 38 InformationDialog::InformationDialog(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 { | |
69 | 45 QPalette pal(palette()); |
46 pal.setColor(QPalette::Window, pal.color(QPalette::Base)); | |
36 | 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); | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
65
diff
changeset
|
54 QVBoxLayout* sidebar_layout = new QVBoxLayout(sidebar); |
83 | 55 Poster* poster = new Poster(anime, sidebar); |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
65
diff
changeset
|
56 sidebar_layout->addWidget(poster); |
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
65
diff
changeset
|
57 sidebar_layout->setContentsMargins(0, 0, 0, 0); |
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
65
diff
changeset
|
58 sidebar_layout->addStretch(); |
9 | 59 |
60 /* main widget */ | |
61 QWidget* main_widget = new QWidget(widget); | |
36 | 62 |
9 | 63 main_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
64 | |
65 /* anime title header text */ | |
64 | 66 TextWidgets::Title* anime_title = |
65
26721c28bf22
*: avoid usage of (to|from)StdString
Paper <mrpapersonic@gmail.com>
parents:
64
diff
changeset
|
67 new TextWidgets::Title(Strings::ToQString(anime.GetUserPreferredTitle()), main_widget); |
9 | 68 |
69 /* tabbed widget */ | |
70 QTabWidget* tabbed_widget = new QTabWidget(main_widget); | |
71 tabbed_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); | |
72 | |
73 /* main info tab */ | |
64 | 74 AnimeInfoWidget* main_information_widget = new AnimeInfoWidget(anime, tabbed_widget); |
9 | 75 |
69 | 76 { |
77 QPalette pal(main_information_widget->palette()); | |
78 pal.setColor(QPalette::Base, pal.color(QPalette::Window)); | |
79 main_information_widget->setPalette(pal); | |
80 } | |
81 | |
9 | 82 QWidget* settings_widget = new QWidget(tabbed_widget); |
46 | 83 settings_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); |
84 | |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
85 QVBoxLayout* settings_layout = new QVBoxLayout(settings_widget); |
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
86 settings_layout->addWidget(new TextWidgets::Header(tr("Anime list"), settings_widget)); |
46 | 87 |
88 QWidget* sg_anime_list_content = new QWidget(settings_widget); | |
89 | |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
90 QVBoxLayout* al_layout = new QVBoxLayout(sg_anime_list_content); |
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
91 al_layout->setSpacing(5); |
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
92 al_layout->setContentsMargins(12, 0, 0, 0); |
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
93 |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
94 #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
|
95 #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
|
96 #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
|
97 /* 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
|
98 #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
|
99 { \ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
100 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
|
101 subsection->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); \ |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
102 QVBoxLayout* subsection_layout = new QVBoxLayout(subsection); \ |
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
103 subsection_layout->setSpacing(LAYOUT_VERT_SPACING); \ |
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
104 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
|
105 x; \ |
69 | 106 layout->addWidget(subsection, 0, Qt::AlignBottom); \ |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
107 } |
64 | 108 |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
109 /* 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
|
110 #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
|
111 { \ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
112 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
|
113 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
|
114 layout->setSpacing(LAYOUT_HORIZ_SPACING); \ |
62 | 115 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
|
116 x; \ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
117 a->layout()->addWidget(section); \ |
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 |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
120 /* Creates a subsection with a width of 175 */ |
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
121 #define CREATE_SUBSECTION(x) CREATE_FULL_WIDTH_SUBSECTION(x subsection->setFixedWidth(LAYOUT_ITEM_WIDTH);) |
64 | 122 /* Creates a section in the parent `a` */ |
123 #define CREATE_SECTION(a, x) CREATE_FULL_WIDTH_SECTION(a, x layout->addStretch();) | |
124 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
125 CREATE_SECTION(sg_anime_list_content, { |
46 | 126 /* Episodes watched section */ |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
127 CREATE_SUBSECTION({ |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
128 subsection_layout->addWidget(new QLabel(tr("Episodes watched:"), subsection)); |
46 | 129 |
130 QSpinBox* spin_box = new QSpinBox(subsection); | |
83 | 131 connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int i) { _progress = i; }); |
46 | 132 spin_box->setRange(0, anime.GetEpisodes()); |
133 spin_box->setSingleStep(1); | |
83 | 134 spin_box->setValue(_progress = anime.GetUserProgress()); |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
135 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
|
136 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
137 CREATE_SUBSECTION({ |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
138 subsection_layout->addWidget(new QLabel(tr(" "), subsection)); |
46 | 139 |
51 | 140 QCheckBox* checkbox = new QCheckBox(tr("Rewatching")); |
63 | 141 connect(checkbox, QOverload<int>::of(&QCheckBox::stateChanged), this, |
83 | 142 [this](int state) { _rewatching = (state == Qt::Checked); }); |
143 checkbox->setCheckState((_rewatching = anime.GetUserIsRewatching()) ? Qt::Checked : Qt::Unchecked); | |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
144 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
|
145 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
146 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
147 CREATE_SECTION(sg_anime_list_content, { |
46 | 148 /* Status & score section */ |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
149 CREATE_SUBSECTION({ |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
150 subsection_layout->addWidget(new QLabel(tr("Status:"), subsection)); |
46 | 151 |
86 | 152 /* FIXME: this sucks */ |
46 | 153 QStringList string_list; |
83 | 154 for (unsigned int i = 0; i < Anime::ListStatuses.size(); i++) |
65
26721c28bf22
*: avoid usage of (to|from)StdString
Paper <mrpapersonic@gmail.com>
parents:
64
diff
changeset
|
155 string_list.append(Strings::ToQString(Translate::ToString(Anime::ListStatuses[i]))); |
46 | 156 |
157 QComboBox* combo_box = new QComboBox(subsection); | |
158 combo_box->addItems(string_list); | |
63 | 159 connect(combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, |
83 | 160 [this](int i) { _status = Anime::ListStatuses[i]; }); |
161 combo_box->setCurrentIndex(static_cast<int>(_status = anime.GetUserStatus()) - 1); | |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
162 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
|
163 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
164 CREATE_SUBSECTION({ |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
165 subsection_layout->addWidget(new QLabel(tr("Score:"), subsection)); |
46 | 166 |
167 QSpinBox* spin_box = new QSpinBox(subsection); | |
83 | 168 connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int i) { _score = i; }); |
46 | 169 spin_box->setRange(0, 100); |
170 spin_box->setSingleStep(5); | |
83 | 171 spin_box->setValue(_score = anime.GetUserScore()); |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
172 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
|
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_FULL_WIDTH_SECTION(sg_anime_list_content, { |
46 | 176 /* Notes section */ |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
177 CREATE_FULL_WIDTH_SUBSECTION({ |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
178 subsection_layout->addWidget(new QLabel(tr("Notes:"), subsection)); |
46 | 179 |
51 | 180 QLineEdit* line_edit = new QLineEdit(subsection); |
181 connect(line_edit, &QLineEdit::textChanged, this, [this](const QString& text) { | |
182 /* this sucks but I don't really want to implement anything smarter :) */ | |
83 | 183 _notes = Strings::ToUtf8String(text); |
51 | 184 }); |
83 | 185 line_edit->setText(Strings::ToQString(_notes = anime.GetUserNotes())); |
46 | 186 line_edit->setPlaceholderText(tr("Enter your notes about this anime")); |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
187 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
|
188 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
189 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
190 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
|
191 /* Dates section */ |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
192 CREATE_SUBSECTION({ |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
193 subsection_layout->addWidget(new QLabel(tr("Date started:"), subsection)); |
46 | 194 |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
195 OptionalDate* date = new OptionalDate(true, subsection); |
63 | 196 connect(date, &OptionalDate::DataChanged, this, |
83 | 197 [this](bool enabled, Date date) { _started = (enabled) ? date : Date(); }); |
198 _started = anime.GetUserDateStarted(); | |
199 if (!_started.IsValid()) { | |
51 | 200 date->SetEnabled(false); |
83 | 201 _started = anime.GetAirDate(); |
51 | 202 } |
83 | 203 date->SetDate(_started); |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
204 subsection_layout->addWidget(date); |
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({ |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
207 subsection_layout->addWidget(new QLabel(tr("Date completed:"), subsection)); |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
208 |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
209 OptionalDate* date = new OptionalDate(true, subsection); |
63 | 210 connect(date, &OptionalDate::DataChanged, this, |
83 | 211 [this](bool enabled, Date date) { _completed = (enabled) ? date : Date(); }); |
212 _completed = anime.GetUserDateCompleted(); | |
213 if (!_completed.IsValid()) { | |
51 | 214 date->SetEnabled(false); |
83 | 215 _completed = anime.GetAirDate(); |
51 | 216 } |
83 | 217 date->SetDate(_completed); |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
218 subsection_layout->addWidget(date); |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
219 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
220 }); |
46 | 221 |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
222 settings_layout->addWidget(sg_anime_list_content); |
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
223 |
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
224 settings_layout->addWidget(new TextWidgets::Header(tr("Local settings"), settings_widget)); |
46 | 225 |
226 QWidget* sg_local_content = new QWidget(settings_widget); | |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
227 QVBoxLayout* sg_local_layout = new QVBoxLayout(sg_local_content); |
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
228 sg_local_layout->setSpacing(5); |
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
229 sg_local_layout->setContentsMargins(12, 0, 0, 0); |
46 | 230 |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
231 CREATE_FULL_WIDTH_SECTION(sg_local_content, { |
46 | 232 /* Alternative titles */ |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
233 CREATE_FULL_WIDTH_SUBSECTION({ |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
234 subsection_layout->addWidget(new QLabel(tr("Alternative titles:"), subsection)); |
46 | 235 |
77 | 236 QLineEdit* line_edit = new QLineEdit("", subsection); |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
237 line_edit->setPlaceholderText( |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
238 tr("Enter alternative titles here, separated by a semicolon (i.e. Title 1; Title 2)")); |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
239 subsection_layout->addWidget(line_edit); |
46 | 240 |
51 | 241 QCheckBox* checkbox = new QCheckBox(tr("Use the first alternative title to search for torrents")); |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
242 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
|
243 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
244 }); |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
245 #undef CREATE_SECTION |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
246 #undef CREATE_SUBSECTION |
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
247 #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
|
248 #undef CREATE_FULL_WIDTH_SUBSECTION |
46 | 249 |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
250 settings_layout->addWidget(sg_local_content); |
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
251 settings_layout->addStretch(); |
9 | 252 |
51 | 253 tabbed_widget->addTab(main_information_widget, tr("Main information")); |
254 tabbed_widget->addTab(settings_widget, tr("My list and settings")); | |
9 | 255 |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
256 QVBoxLayout* main_layout = new QVBoxLayout(main_widget); |
9 | 257 main_layout->addWidget(anime_title); |
258 main_layout->addWidget(tabbed_widget); | |
62 | 259 main_layout->setContentsMargins(0, 0, 0, 0); |
86 | 260 main_layout->setSpacing(12); |
9 | 261 |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
262 QHBoxLayout* layout = new QHBoxLayout(widget); |
9 | 263 layout->addWidget(sidebar); |
264 layout->addWidget(main_widget); | |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
265 layout->setSpacing(12); |
9 | 266 |
267 QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); | |
83 | 268 connect(button_box, &QDialogButtonBox::accepted, this, [this, accept, &anime] { |
269 SaveData(anime); | |
9 | 270 accept(); |
271 QDialog::accept(); | |
272 }); | |
273 connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject); | |
274 | |
68
2417121d894e
*: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
275 QVBoxLayout* buttons_layout = new QVBoxLayout(this); |
9 | 276 buttons_layout->addWidget(widget); |
277 buttons_layout->addWidget(button_box, 0, Qt::AlignBottom); | |
278 } | |
279 | |
280 #include "gui/dialog/moc_information.cpp" |