annotate src/gui/dialog/information.cpp @ 63:3d2decf093bb

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