Mercurial > minori
comparison src/gui/dialog/settings.cc @ 108:2004b41d4a59
*: huge commit
1. WORKING LOCALIZATION + translation for Spanish and British English
2. idk like 2 changes for the dark theme :)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 05 Nov 2023 23:31:49 -0500 |
parents | b315f3759c56 |
children | 254b1d2b7096 |
comparison
equal
deleted
inserted
replaced
107:49c8d1976869 | 108:2004b41d4a59 |
---|---|
1 #include "gui/dialog/settings.h" | 1 #include "gui/dialog/settings.h" |
2 #include "core/session.h" | |
2 #include "gui/widgets/sidebar.h" | 3 #include "gui/widgets/sidebar.h" |
3 #include "gui/widgets/text.h" | 4 #include "gui/widgets/text.h" |
4 #include <QDialogButtonBox> | 5 #include <QDialogButtonBox> |
5 #include <QHBoxLayout> | 6 #include <QHBoxLayout> |
6 #include <QLabel> | 7 #include <QLabel> |
7 #include <QStackedWidget> | 8 #include <QStackedWidget> |
8 #include <QVBoxLayout> | 9 #include <QVBoxLayout> |
9 #include <QWidget> | 10 #include <QWidget> |
11 #ifdef WIN32 | |
12 #include "sys/win32/dark_theme.h" | |
13 #endif | |
10 | 14 |
11 SettingsPage::SettingsPage(QWidget* parent, QString title) : QWidget(parent) { | 15 SettingsPage::SettingsPage(QWidget* parent, QString title) : QWidget(parent) { |
12 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); | 16 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); |
13 page_title = new QLabel(title, this); | 17 page_title = new QLabel(title, this); |
14 page_title->setWordWrap(false); | 18 page_title->setWordWrap(false); |
58 reinterpret_cast<SettingsPage*>(stacked->widget(i))->SaveInfo(); | 62 reinterpret_cast<SettingsPage*>(stacked->widget(i))->SaveInfo(); |
59 } | 63 } |
60 QDialog::accept(); | 64 QDialog::accept(); |
61 } | 65 } |
62 | 66 |
67 void SettingsDialog::showEvent(QShowEvent* event) { | |
68 QDialog::showEvent(event); | |
69 #ifdef WIN32 | |
70 win32::SetTitleBarsToBlack(session.config.theme.IsInDarkTheme()); | |
71 #endif | |
72 } | |
73 | |
63 SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent) { | 74 SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent) { |
64 setFixedSize(755, 566); | 75 setFixedSize(755, 566); |
65 setWindowTitle(tr("Settings")); | 76 setWindowTitle(tr("Settings")); |
66 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); | 77 setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); |
67 QWidget* widget = new QWidget(this); | |
68 widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); | |
69 sidebar = new SideBar(widget); | |
70 sidebar->setCurrentItem(sidebar->AddItem(tr("Services"), SideBar::CreateIcon(":/icons/24x24/globe.png"))); | |
71 // sidebar->AddItem(tr("Library"), SideBar::CreateIcon(":/icons/24x24/inbox-film.png")); | |
72 sidebar->AddItem(tr("Application"), SideBar::CreateIcon(":/icons/24x24/application-sidebar-list.png")); | |
73 // sidebar->AddItem(tr("Recognition"), SideBar::CreateIcon(":/icons/24x24/question.png")); | |
74 // sidebar->AddItem(tr("Sharing"), SideBar::CreateIcon(":/icons/24x24/megaphone.png")); | |
75 // sidebar->AddItem(tr("Torrents"), SideBar::CreateIcon(":/icons/24x24/feed.png")); | |
76 // sidebar->AddItem(tr("Advanced"), SideBar::CreateIcon(":/icons/24x24/gear.png")); | |
77 sidebar->setIconSize(QSize(24, 24)); | |
78 sidebar->setFrameShape(QFrame::Box); | |
79 | 78 |
80 QPalette pal(sidebar->palette()); | 79 QVBoxLayout* full_layout = new QVBoxLayout(this); |
81 sidebar->SetBackgroundColor(pal.color(QPalette::Base)); | |
82 | 80 |
83 sidebar->setFixedWidth(158); | 81 { |
84 sidebar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); | 82 QWidget* widget = new QWidget(this); |
83 widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); | |
84 QHBoxLayout* layout = new QHBoxLayout(widget); | |
85 | 85 |
86 stacked = new QStackedWidget(this); | 86 { |
87 stacked->addWidget(new SettingsPageServices(stacked)); | 87 sidebar = new SideBar(widget); |
88 stacked->addWidget(new SettingsPageApplication(stacked)); | |
89 stacked->setCurrentIndex(0); | |
90 | 88 |
91 connect(sidebar, &QListWidget::currentRowChanged, stacked, &QStackedWidget::setCurrentIndex); | 89 sidebar->setCurrentItem(sidebar->AddItem(tr("Services"), SideBar::CreateIcon(":/icons/24x24/globe.png"))); |
90 // sidebar->AddItem(tr("Library"), SideBar::CreateIcon(":/icons/24x24/inbox-film.png")); | |
91 sidebar->AddItem(tr("Application"), SideBar::CreateIcon(":/icons/24x24/application-sidebar-list.png")); | |
92 // sidebar->AddItem(tr("Recognition"), SideBar::CreateIcon(":/icons/24x24/question.png")); | |
93 // sidebar->AddItem(tr("Sharing"), SideBar::CreateIcon(":/icons/24x24/megaphone.png")); | |
94 // sidebar->AddItem(tr("Torrents"), SideBar::CreateIcon(":/icons/24x24/feed.png")); | |
95 // sidebar->AddItem(tr("Advanced"), SideBar::CreateIcon(":/icons/24x24/gear.png")); | |
92 | 96 |
93 QHBoxLayout* layout = new QHBoxLayout(widget); | 97 sidebar->setIconSize(QSize(24, 24)); |
94 layout->addWidget(sidebar); | 98 sidebar->setFrameShape(QFrame::Box); |
95 layout->addWidget(stacked); | |
96 layout->setContentsMargins(0, 0, 0, 0); | |
97 | 99 |
98 QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); | 100 QPalette pal(sidebar->palette()); |
99 connect(button_box, &QDialogButtonBox::accepted, this, &SettingsDialog::OnOK); | 101 sidebar->SetBackgroundColor(pal.color(QPalette::Base)); |
100 connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject); | |
101 | 102 |
102 QVBoxLayout* buttons_layout = new QVBoxLayout(this); | 103 sidebar->setFixedWidth(158); |
103 buttons_layout->addWidget(widget); | 104 sidebar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); |
104 buttons_layout->addWidget(button_box); | 105 layout->addWidget(sidebar); |
106 } | |
107 | |
108 { | |
109 stacked = new QStackedWidget(widget); | |
110 stacked->addWidget(new SettingsPageServices(stacked)); | |
111 stacked->addWidget(new SettingsPageApplication(stacked)); | |
112 stacked->setCurrentIndex(0); | |
113 | |
114 connect(sidebar, &QListWidget::currentRowChanged, stacked, &QStackedWidget::setCurrentIndex); | |
115 | |
116 layout->addWidget(stacked); | |
117 } | |
118 | |
119 layout->setContentsMargins(0, 0, 0, 0); | |
120 full_layout->addWidget(widget); | |
121 } | |
122 | |
123 { | |
124 QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); | |
125 connect(button_box, &QDialogButtonBox::accepted, this, &SettingsDialog::OnOK); | |
126 connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject); | |
127 full_layout->addWidget(button_box); | |
128 } | |
105 } | 129 } |
106 | 130 |
107 #include "gui/dialog/moc_settings.cpp" | 131 #include "gui/dialog/moc_settings.cpp" |