Mercurial > minori
diff 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 |
line wrap: on
line diff
--- a/src/gui/dialog/settings.cc Sun Nov 05 17:44:49 2023 -0500 +++ b/src/gui/dialog/settings.cc Sun Nov 05 23:31:49 2023 -0500 @@ -1,4 +1,5 @@ #include "gui/dialog/settings.h" +#include "core/session.h" #include "gui/widgets/sidebar.h" #include "gui/widgets/text.h" #include <QDialogButtonBox> @@ -7,6 +8,9 @@ #include <QStackedWidget> #include <QVBoxLayout> #include <QWidget> +#ifdef WIN32 +#include "sys/win32/dark_theme.h" +#endif SettingsPage::SettingsPage(QWidget* parent, QString title) : QWidget(parent) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); @@ -60,48 +64,68 @@ QDialog::accept(); } +void SettingsDialog::showEvent(QShowEvent* event) { + QDialog::showEvent(event); +#ifdef WIN32 + win32::SetTitleBarsToBlack(session.config.theme.IsInDarkTheme()); +#endif +} + SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent) { setFixedSize(755, 566); setWindowTitle(tr("Settings")); setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); - QWidget* widget = new QWidget(this); - widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); - sidebar = new SideBar(widget); - sidebar->setCurrentItem(sidebar->AddItem(tr("Services"), SideBar::CreateIcon(":/icons/24x24/globe.png"))); - // sidebar->AddItem(tr("Library"), SideBar::CreateIcon(":/icons/24x24/inbox-film.png")); - sidebar->AddItem(tr("Application"), SideBar::CreateIcon(":/icons/24x24/application-sidebar-list.png")); - // sidebar->AddItem(tr("Recognition"), SideBar::CreateIcon(":/icons/24x24/question.png")); - // sidebar->AddItem(tr("Sharing"), SideBar::CreateIcon(":/icons/24x24/megaphone.png")); - // sidebar->AddItem(tr("Torrents"), SideBar::CreateIcon(":/icons/24x24/feed.png")); - // sidebar->AddItem(tr("Advanced"), SideBar::CreateIcon(":/icons/24x24/gear.png")); - sidebar->setIconSize(QSize(24, 24)); - sidebar->setFrameShape(QFrame::Box); + + QVBoxLayout* full_layout = new QVBoxLayout(this); + + { + QWidget* widget = new QWidget(this); + widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); + QHBoxLayout* layout = new QHBoxLayout(widget); + + { + sidebar = new SideBar(widget); - QPalette pal(sidebar->palette()); - sidebar->SetBackgroundColor(pal.color(QPalette::Base)); + sidebar->setCurrentItem(sidebar->AddItem(tr("Services"), SideBar::CreateIcon(":/icons/24x24/globe.png"))); + // sidebar->AddItem(tr("Library"), SideBar::CreateIcon(":/icons/24x24/inbox-film.png")); + sidebar->AddItem(tr("Application"), SideBar::CreateIcon(":/icons/24x24/application-sidebar-list.png")); + // sidebar->AddItem(tr("Recognition"), SideBar::CreateIcon(":/icons/24x24/question.png")); + // sidebar->AddItem(tr("Sharing"), SideBar::CreateIcon(":/icons/24x24/megaphone.png")); + // sidebar->AddItem(tr("Torrents"), SideBar::CreateIcon(":/icons/24x24/feed.png")); + // sidebar->AddItem(tr("Advanced"), SideBar::CreateIcon(":/icons/24x24/gear.png")); - sidebar->setFixedWidth(158); - sidebar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); + sidebar->setIconSize(QSize(24, 24)); + sidebar->setFrameShape(QFrame::Box); + + QPalette pal(sidebar->palette()); + sidebar->SetBackgroundColor(pal.color(QPalette::Base)); - stacked = new QStackedWidget(this); - stacked->addWidget(new SettingsPageServices(stacked)); - stacked->addWidget(new SettingsPageApplication(stacked)); - stacked->setCurrentIndex(0); + sidebar->setFixedWidth(158); + sidebar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); + layout->addWidget(sidebar); + } - connect(sidebar, &QListWidget::currentRowChanged, stacked, &QStackedWidget::setCurrentIndex); + { + stacked = new QStackedWidget(widget); + stacked->addWidget(new SettingsPageServices(stacked)); + stacked->addWidget(new SettingsPageApplication(stacked)); + stacked->setCurrentIndex(0); + + connect(sidebar, &QListWidget::currentRowChanged, stacked, &QStackedWidget::setCurrentIndex); - QHBoxLayout* layout = new QHBoxLayout(widget); - layout->addWidget(sidebar); - layout->addWidget(stacked); - layout->setContentsMargins(0, 0, 0, 0); + layout->addWidget(stacked); + } + + layout->setContentsMargins(0, 0, 0, 0); + full_layout->addWidget(widget); + } - QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); - connect(button_box, &QDialogButtonBox::accepted, this, &SettingsDialog::OnOK); - connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject); - - QVBoxLayout* buttons_layout = new QVBoxLayout(this); - buttons_layout->addWidget(widget); - buttons_layout->addWidget(button_box); + { + QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); + connect(button_box, &QDialogButtonBox::accepted, this, &SettingsDialog::OnOK); + connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject); + full_layout->addWidget(button_box); + } } #include "gui/dialog/moc_settings.cpp"