annotate src/dialog/settings/application.cpp @ 6:1d82f6e04d7d

Update: add first parts to the settings dialog
author Paper <mrpapersonic@gmail.com>
date Wed, 16 Aug 2023 00:49:17 -0400
parents
children 07a9095eaeed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "settings.h"
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #include "anilist.h"
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3 #include "window.h"
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 #include <QGroupBox>
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 #include <QComboBox>
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 #include <QCheckBox>
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7 #include <QPushButton>
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8 #include <QSizePolicy>
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 QWidget* SettingsPageApplication::CreateAnimeListPage() {
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11 QWidget* result = new QWidget(this);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 QGroupBox* actions_group_box = new QGroupBox(tr("Actions"), result);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 actions_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 /* Actions/Double click */
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18 QWidget* double_click_widget = new QWidget(actions_group_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19 QLabel* dc_combo_box_label = new QLabel(tr("Double click:"), double_click_widget);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 QComboBox* dc_combo_box = new QComboBox(double_click_widget);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 dc_combo_box->addItem(tr("View anime info"));
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 QVBoxLayout* double_click_layout = new QVBoxLayout;
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24 double_click_layout->addWidget(dc_combo_box_label);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 double_click_layout->addWidget(dc_combo_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26 double_click_widget->setLayout(double_click_layout);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 /* Actions/Middle click */
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29 QWidget* middle_click_widget = new QWidget(actions_group_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30 QLabel* mc_combo_box_label = new QLabel(tr("Middle click:"), middle_click_widget);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
31 QComboBox* mc_combo_box = new QComboBox(middle_click_widget);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32 mc_combo_box->addItem(tr("Play next episode"));
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
33
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34 QVBoxLayout* middle_click_layout = new QVBoxLayout;
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
35 middle_click_layout->addWidget(mc_combo_box_label);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
36 middle_click_layout->addWidget(mc_combo_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
37 middle_click_widget->setLayout(middle_click_layout);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
38
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
39 /* Actions */
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
40 QHBoxLayout* actions_layout = new QHBoxLayout;
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
41 actions_layout->addWidget(double_click_widget);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
42 actions_layout->addWidget(middle_click_widget);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
43 actions_group_box->setLayout(actions_layout);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
44
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
45 QGroupBox* appearance_group_box = new QGroupBox(tr("Appearance"), result);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
46 appearance_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
47
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
48 QLabel* lang_combo_box_label = new QLabel(tr("Title language preference:"), appearance_group_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
49 QComboBox* lang_combo_box = new QComboBox(appearance_group_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
50 lang_combo_box->addItem(tr("English"));
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
51 QCheckBox* hl_anime_box = new QCheckBox(tr("Highlight anime if next episode is available in library folders"), appearance_group_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
52 QCheckBox* hl_above_anime_box = new QCheckBox(tr("Display highlighted anime above others"), appearance_group_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
53 hl_above_anime_box->setEnabled((hl_anime_box->checkState() == Qt::Unchecked) ? 0 : 1);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
54 hl_above_anime_box->setStyleSheet("margin-left: 10px;");
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
55
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
56 connect(hl_anime_box, &QCheckBox::stateChanged, this, [hl_above_anime_box](int state){
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
57 hl_above_anime_box->setEnabled(state);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
58 });
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
59
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
60 /* Appearance */
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
61 QVBoxLayout* appearance_layout = new QVBoxLayout;
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
62 appearance_layout->addWidget(lang_combo_box_label);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
63 appearance_layout->addWidget(lang_combo_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
64 appearance_layout->addWidget(hl_anime_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
65 appearance_layout->addWidget(hl_above_anime_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
66 appearance_group_box->setLayout(appearance_layout);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
67
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
68 QGroupBox* progress_group_box = new QGroupBox(tr("Progress"), result);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
69 progress_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
70
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
71 QCheckBox* display_aired_episodes = new QCheckBox(tr("Display aired episodes (estimated)"), progress_group_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
72 QCheckBox* display_available_episodes = new QCheckBox(tr("Display available episodes in library folders"), progress_group_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
73
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
74 QVBoxLayout* progress_layout = new QVBoxLayout;
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
75 progress_layout->addWidget(display_aired_episodes);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
76 progress_layout->addWidget(display_available_episodes);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
77 progress_group_box->setLayout(progress_layout);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
78
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
79 QVBoxLayout* full_layout = new QVBoxLayout;
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
80 full_layout->addWidget(actions_group_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
81 full_layout->addWidget(appearance_group_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
82 full_layout->addWidget(progress_group_box);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
83 full_layout->addStretch();
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
84 result->setLayout(full_layout);
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
85 return result;
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
86 }
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
87
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
88 void SettingsPageApplication::SaveInfo() {
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
89
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
90 }
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
91
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
92 SettingsPageApplication::SettingsPageApplication(QWidget* parent)
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
93 : SettingsPage(parent, tr("Application")) {
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
94 AddTab(CreateAnimeListPage(), tr("Anime list"));
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
95 }