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