annotate src/gui/dialog/information.cc @ 355:83e6ba09338f

gui/pages/seasons: fix function disambiguation on win32
author Paper <paper@paper.us.eu.org>
date Sun, 14 Jul 2024 23:46:18 -0400
parents 6b0768158dcd
children
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"
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
4 #include "core/session.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"
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
8 #include "gui/widgets/anime_info.h"
76
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
9 #include "gui/widgets/optional_date.h"
66
6481c5aed3e1 posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents: 65
diff changeset
10 #include "gui/widgets/poster.h"
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
11 #include "gui/widgets/text.h"
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 #include "gui/window.h"
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
13
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
14 #include <QCheckBox>
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
15 #include <QComboBox>
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
16 #include <QDateEdit>
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 #include <QDebug>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18 #include <QDialogButtonBox>
76
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
19 #include <QLabel>
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
20 #include <QLineEdit>
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 #include <QPlainTextEdit>
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
22 #include <QSpinBox>
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
23 #include <QStringList>
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24 #include <QTextStream>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 #include <QVBoxLayout>
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
26
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 #include <functional>
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
28 #include <iostream>
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
29 #ifdef WIN32
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
30 # include "sys/win32/dark_theme.h"
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
31 #endif
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
33 /* 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
34 which sucks. Think of a better way to implement this later. */
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
35 void InformationDialog::SaveData(Anime::Anime* anime) {
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
36 if (!anime->IsInUserList())
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
37 return;
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
38
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
39 anime->SetUserProgress(_progress);
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
40 anime->SetUserScore(_score);
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
41 anime->SetUserIsRewatching(_rewatching);
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
42 anime->SetUserStatus(_status);
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
43 anime->SetUserNotes(_notes);
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
44 anime->SetUserDateStarted(_started);
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
45 anime->SetUserDateCompleted(_completed);
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
46 }
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
47
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
48 InformationDialog::InformationDialog(Anime::Anime* anime, std::function<void(Anime::Anime*)> accept, enum Pages page,
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
49 QWidget* parent)
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
50 : QDialog(parent) {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
51 /* ack. lots of brackets here, but MUCH, MUCH MUCH better than what it used to be */
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
52 setFixedSize(842, 613);
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
53 setWindowTitle(tr("Anime Information"));
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
54 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
36
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
55
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
56 {
105
6d8da6e64d61 theme: add dark stylesheet, make it actually usable
Paper <mrpapersonic@gmail.com>
parents: 89
diff changeset
57 QPalette pal;
69
27a19dd6cba1 *: fix up some stuff
Paper <mrpapersonic@gmail.com>
parents: 68
diff changeset
58 pal.setColor(QPalette::Window, pal.color(QPalette::Base));
36
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
59 setPalette(pal);
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
60 }
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
61
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
62 QVBoxLayout* full_layout = new QVBoxLayout(this);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
63
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
64 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
65 /* this handles the actual page. */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
66 QWidget* widget = new QWidget(this);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
67 QHBoxLayout* layout = new QHBoxLayout(widget);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
68
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
69 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
70 /* Sidebar */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
71 QWidget* sidebar = new QWidget(widget);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
72 QVBoxLayout* sidebar_layout = new QVBoxLayout(sidebar);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
73 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
74 /* Poster */
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
75 Poster* poster = new Poster(*anime, sidebar);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
76 sidebar_layout->addWidget(poster);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
77 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
78 sidebar_layout->setContentsMargins(0, 0, 0, 0);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
79 sidebar_layout->addStretch();
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
80 layout->addWidget(sidebar);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
81 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
82
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
83 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
84 /* ... everything else. */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
85 QWidget* main_widget = new QWidget(widget);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
86 QVBoxLayout* main_layout = new QVBoxLayout(main_widget);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
87
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
88 main_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
89
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
90 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
91 /* Anime title */
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
92 TextWidgets::Title* anime_title = new TextWidgets::Title(main_widget);
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
93 anime_title->SetText(anime->GetUserPreferredTitle());
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
94 main_layout->addWidget(anime_title);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
95 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
96
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
97 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
98 /* Tab widget, contains main info and settings */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
99 QTabWidget* tabbed_widget = new QTabWidget(main_widget);
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
100 tabbed_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
101
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
102 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
103 /* Main information */
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
104 AnimeInfoWidget* main_information_widget = new AnimeInfoWidget(*anime, tabbed_widget);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
105 tabbed_widget->addTab(main_information_widget, tr("Main information"));
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
106 }
36
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
107
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
108 if (anime->IsInUserList()) {
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
109 /* My list and settings */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
110 QWidget* settings_widget = new QWidget(tabbed_widget);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
111 settings_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
112
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
113 QVBoxLayout* settings_layout = new QVBoxLayout(settings_widget);
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
114
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
115 TextWidgets::Header* header = new TextWidgets::Header(settings_widget);
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
116 header->SetText(Strings::Translate("Anime list"));
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
117 settings_layout->addWidget(header);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
118
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
119 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
120 /* Anime List */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
121 QWidget* sg_anime_list_content = new QWidget(settings_widget);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
122
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
123 constexpr int LAYOUT_HORIZ_SPACING = 25;
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
124 constexpr int LAYOUT_VERT_SPACING = 5;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
125 constexpr int LAYOUT_ITEM_WIDTH = 175;
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
126
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
127 QVBoxLayout* al_layout = new QVBoxLayout(sg_anime_list_content);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
128 al_layout->setSpacing(LAYOUT_VERT_SPACING);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
129 al_layout->setContentsMargins(12, 0, 0, 0);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
130
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
131 /* Helper function for creating sections, reduces clutter. */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
132 const auto CREATE_SECTION = [](QWidget* parent, std::function<void(QWidget*, QGridLayout*)> x) {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
133 QWidget* section = new QWidget(parent);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
134 QGridLayout* layout = new QGridLayout(section);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
135 layout->setHorizontalSpacing(LAYOUT_HORIZ_SPACING);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
136 layout->setVerticalSpacing(LAYOUT_VERT_SPACING);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
137 layout->setContentsMargins(0, 0, 0, 0);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
138 x(section, layout);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
139 parent->layout()->addWidget(section);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
140 };
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
141
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
142 CREATE_SECTION(sg_anime_list_content, [this, &anime](QWidget* section, QGridLayout* layout) {
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
143 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
144 /* Episodes watched... */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
145 layout->addWidget(new QLabel(tr("Episodes watched:"), section), 0, 0);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
146
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
147 QSpinBox* spin_box = new QSpinBox(section);
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
148 connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this,
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
149 [this](int i) { _progress = i; });
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
150 spin_box->setRange(0, anime->GetEpisodes());
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
151 spin_box->setSingleStep(1);
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
152 spin_box->setValue(_progress = anime->GetUserProgress());
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
153 spin_box->setFixedWidth(LAYOUT_ITEM_WIDTH);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
154 layout->addWidget(spin_box, 1, 0);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
155 }
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
156
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
157 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
158 /* Rewatching? */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
159 QCheckBox* checkbox = new QCheckBox(tr("Rewatching"));
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
160 connect(checkbox, QOverload<int>::of(&QCheckBox::stateChanged), this,
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
161 [this](int state) { _rewatching = (state == Qt::Checked); });
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
162 checkbox->setCheckState((_rewatching = anime->GetUserIsRewatching()) ? Qt::Checked
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
163 : Qt::Unchecked);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
164 checkbox->setFixedWidth(LAYOUT_ITEM_WIDTH);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
165 layout->addWidget(checkbox, 1, 1);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
166 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
167 layout->setColumnStretch(layout->columnCount(), 1);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
168 });
88
1b19d80b3f8c dialog/information.cc: fix QGridLayout :)
Paper <mrpapersonic@gmail.com>
parents: 87
diff changeset
169
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
170 CREATE_SECTION(sg_anime_list_content, [this, &anime](QWidget* section, QGridLayout* layout) {
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
171 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
172 /* Status */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
173 layout->addWidget(new QLabel(tr("Status:"), section), 0, 0);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
174
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
175 QComboBox* combo_box = new QComboBox(section);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
176
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
177 _status = anime->GetUserStatus();
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
178 for (unsigned int i = 0; i < Anime::ListStatuses.size(); i++) {
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
179 combo_box->addItem(Strings::ToQString(Translate::ToLocalString(Anime::ListStatuses[i])),
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
180 static_cast<int>(Anime::ListStatuses[i]));
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
181 if (Anime::ListStatuses[i] == _status)
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
182 combo_box->setCurrentIndex(i);
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
183 }
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
184
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
185 connect(combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
186 [this, combo_box](int) {
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
187 _status = static_cast<Anime::ListStatus>(combo_box->currentData().toInt());
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
188 });
68
2417121d894e *: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents: 66
diff changeset
189
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
190 /* this should NEVER, EVER, be NOT_IN_LIST */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
191 combo_box->setFixedWidth(LAYOUT_ITEM_WIDTH);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
192 layout->addWidget(combo_box, 1, 0);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
193 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
194
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
195 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
196 /* Score */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
197 layout->addWidget(new QLabel(tr("Score:"), section), 0, 1);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
198
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
199 QSpinBox* spin_box = new QSpinBox(section);
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
200 connect(spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this,
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
201 [this](int i) { _score = i; });
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
202 spin_box->setRange(0, 100);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
203 spin_box->setSingleStep(5);
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
204 spin_box->setValue(_score = anime->GetUserScore());
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
205 spin_box->setFixedWidth(LAYOUT_ITEM_WIDTH);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
206 layout->addWidget(spin_box, 1, 1);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
207 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
208 layout->setColumnStretch(layout->columnCount(), 1);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
209 });
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
210
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
211 CREATE_SECTION(sg_anime_list_content, [this, &anime](QWidget* section, QGridLayout* layout) {
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
212 layout->addWidget(new QLabel(tr("Notes:"), section), 0, 0);
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
213
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
214 QLineEdit* line_edit = new QLineEdit(section);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
215 connect(line_edit, &QLineEdit::textChanged, this, [this](const QString& text) {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
216 /* this sucks but I don't really want to implement anything smarter :) */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
217 _notes = Strings::ToUtf8String(text);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
218 });
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
219 line_edit->setText(Strings::ToQString(_notes = anime->GetUserNotes()));
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
220 line_edit->setPlaceholderText(tr("Enter your notes about this anime"));
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
221 layout->addWidget(line_edit, 1, 0);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
222 });
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
223
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
224 CREATE_SECTION(sg_anime_list_content, [this, &anime](QWidget* section, QGridLayout* layout) {
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
225 /* Started */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
226 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
227 layout->addWidget(new QLabel(tr("Date started:"), section), 0, 0);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
228
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
229 OptionalDate* date = new OptionalDate(true, section);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
230 connect(date, &OptionalDate::DataChanged, this,
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
231 [this](bool enabled, Date date) { _started = enabled ? date : Date(); });
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
232 date->setFixedWidth(LAYOUT_ITEM_WIDTH);
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
233 _started = anime->GetUserDateStarted();
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
234 if (!_started.IsValid()) {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
235 date->SetEnabled(false);
324
5d3c9b31aa6e anime: add completed date member
Paper <paper@paper.us.eu.org>
parents: 305
diff changeset
236 _started = anime->GetStartedDate();
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
237 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
238 date->SetDate(_started);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
239 layout->addWidget(date, 1, 0);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
240 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
241
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
242 /* Completed */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
243 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
244 layout->addWidget(new QLabel(tr("Date completed:"), section), 0, 1);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
245
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
246 OptionalDate* date = new OptionalDate(true, section);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
247 connect(date, &OptionalDate::DataChanged, this,
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
248 [this](bool enabled, Date date) { _completed = enabled ? date : Date(); });
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
249 date->setFixedWidth(LAYOUT_ITEM_WIDTH);
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
250 _completed = anime->GetUserDateCompleted();
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
251 if (!_completed.IsValid()) {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
252 date->SetEnabled(false);
324
5d3c9b31aa6e anime: add completed date member
Paper <paper@paper.us.eu.org>
parents: 305
diff changeset
253 _completed = anime->GetCompletedDate();
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
254 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
255 date->SetDate(_completed);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
256 layout->addWidget(date, 1, 1);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
257 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
258 layout->setColumnStretch(layout->columnCount(), 1);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
259 });
88
1b19d80b3f8c dialog/information.cc: fix QGridLayout :)
Paper <mrpapersonic@gmail.com>
parents: 87
diff changeset
260
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
261 settings_layout->addWidget(sg_anime_list_content);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
262 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
263
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
264 /*
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
265 {
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
266 // commenting this out until it actually gets implemented :)
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
267
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
268 settings_layout->addWidget(new TextWidgets::Header(tr("Local settings"), settings_widget));
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
269
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
270 QWidget* sg_local_content = new QWidget(settings_widget);
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
271 QVBoxLayout* sg_local_layout = new QVBoxLayout(sg_local_content);
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
272 sg_local_layout->setSpacing(5);
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
273 sg_local_layout->setContentsMargins(12, 0, 0, 0);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
274
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
275 CREATE_SECTION(sg_local_content, [this, &anime](QWidget* section, QGridLayout* layout){
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
276 layout->addWidget(new QLabel(tr("Alternative titles:"), section), 0, 0);
89
e6fab256ddc4 dialog/info: make some stuff more sane
Paper <mrpapersonic@gmail.com>
parents: 88
diff changeset
277
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
278 QLineEdit* line_edit = new QLineEdit("", section);
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
279 line_edit->setPlaceholderText(
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
280 tr("Enter alternative titles here, separated by a semicolon (i.e. Title 1; Title 2)"));
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
281 layout->addWidget(line_edit, 1, 0);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
282
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
283 QCheckBox* checkbox = new QCheckBox(tr("Use the first alternative title to search for
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 253
diff changeset
284 torrents")); layout->addWidget(checkbox, 2, 0);
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
285 });
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
286
348
6b0768158dcd text: redesign almost every widget
Paper <paper@paper.us.eu.org>
parents: 324
diff changeset
287 settings_layout->addWidget(sg_local_content);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
288 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
289 */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
290
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
291 settings_layout->addStretch();
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
292
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
293 tabbed_widget->addTab(settings_widget, tr("My list and settings"));
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
294 }
118
39521c47c7a3 *: another huge megacommit, SORRY
Paper <mrpapersonic@gmail.com>
parents: 108
diff changeset
295 tabbed_widget->setCurrentIndex(static_cast<int>(page));
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
296 main_layout->addWidget(tabbed_widget);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
297 main_layout->setContentsMargins(0, 0, 0, 0);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
298 main_layout->setSpacing(12);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
299 }
89
e6fab256ddc4 dialog/info: make some stuff more sane
Paper <mrpapersonic@gmail.com>
parents: 88
diff changeset
300
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
301 layout->addWidget(main_widget);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
302 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
303 layout->setSpacing(12);
294
99cbc51433e4 *: cleanup uses of QPalette
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
304 layout->setContentsMargins(0, 0, 0, 0);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
305 full_layout->addWidget(widget);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
306 }
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
307
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
308 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
309 /* Dialog box buttons */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
310 QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
311 connect(button_box, &QDialogButtonBox::accepted, this, [this, accept, anime] {
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
312 SaveData(anime);
305
91ac90a34003 core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents: 294
diff changeset
313 accept(anime);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
314 QDialog::accept();
89
e6fab256ddc4 dialog/info: make some stuff more sane
Paper <mrpapersonic@gmail.com>
parents: 88
diff changeset
315 });
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
316 connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
317 full_layout->addWidget(button_box, 0, Qt::AlignBottom);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
318 }
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
319 }
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
320
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
321 void InformationDialog::showEvent(QShowEvent* event) {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
322 QDialog::showEvent(event);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
323 #ifdef WIN32
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
324 win32::SetTitleBarsToBlack(session.config.theme.IsInDarkTheme());
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 105
diff changeset
325 #endif
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
326 }