diff --git a/src/appearance.cpp b/src/appearance.cpp index 94c2d0f..ae5259a 100644 --- a/src/appearance.cpp +++ b/src/appearance.cpp @@ -2,6 +2,7 @@ #include "find-themes.h" #include "macros.h" #include "settings.h" +#include "pair.h" #include "./ui_appearance.h" Appearance::Appearance(QWidget *parent) : QWidget(parent), ui(new Ui::pageAppearance) @@ -23,14 +24,60 @@ void Appearance::activate() /* Corner Radius */ ui->cornerRadius->setValue(getInt("/labwc_config/theme/cornerRadius")); + ui->cornerRadius->setToolTip(tr("Radius of server side decoration top corners")); /* Drop Shadows */ ui->dropShadows->setChecked(getBool("/labwc_config/theme/dropShadows")); + ui->dropShadows->setToolTip(tr("Render drop-shadows behind windows")); + + /* Drop Shadows On Tiled */ + ui->dropShadowsOnTiled->setChecked(getBool("/labwc_config/theme/dropShadowsOnTiled")); + ui->dropShadowsOnTiled->setToolTip(tr("Render drop-shadows behind tiled windows")); + + // Disable it when Drop Shadows is unchecked + ui->dropShadowsOnTiled->setEnabled(ui->dropShadows->isChecked()); + connect(ui->dropShadows, &QCheckBox::toggled, ui->dropShadowsOnTiled, &QWidget::setEnabled); /* Icon Theme */ QStringList themes = findIconThemes(LAB_ICON_THEME_TYPE_ICON); ui->iconTheme->addItems(themes); ui->iconTheme->setCurrentIndex(themes.indexOf(getStr("/labwc_config/theme/icon"))); + + /* Decoration */ + ui->decoration->clear(); // remove 2 empty values created for some reason + ui->decoration->setToolTip(tr("Specify decorations for xdg-shell windows")); + + QVector> decorations; + decorations.append(QSharedPointer(new Pair("server", tr("Server")))); + decorations.append(QSharedPointer(new Pair("client", tr("Client")))); + + QString current_decoration = getStr("/labwc_config/core/decoration"); + int decoration_index = -1; + foreach (auto decoration, decorations) { + ui->decoration->addItem(decoration.get()->description(), QVariant(decoration.get()->value())); + ++decoration_index; + if (current_decoration == decoration.get()->value()) { + ui->decoration->setCurrentIndex(decoration_index); + } + } + + /* Maximized Decoration */ + ui->maximizedDecoration->clear(); // remove 2 empty values created for some reason + ui->maximizedDecoration->setToolTip(tr("Specify if server side decorations are shown for maximized windows.")); + + QVector> maximized_decorations; + maximized_decorations.append(QSharedPointer(new Pair("titlebar", tr("Titlebar")))); + maximized_decorations.append(QSharedPointer(new Pair("none", tr("None")))); + + QString current_maximized_decoration = getStr("/labwc_config/theme/maximizedDecoration"); + int maximized_decoration_index = -1; + foreach (auto maximized_decoration, maximized_decorations) { + ui->maximizedDecoration->addItem(maximized_decoration.get()->description(), QVariant(maximized_decoration.get()->value())); + ++maximized_decoration_index; + if (current_maximized_decoration == maximized_decoration.get()->value()) { + ui->maximizedDecoration->setCurrentIndex(maximized_decoration_index); + } + } } void Appearance::onApply() @@ -38,5 +85,8 @@ void Appearance::onApply() setInt("/labwc_config/theme/cornerRadius", ui->cornerRadius->value()); setStr("/labwc_config/theme/name", TEXT(ui->openboxTheme)); setBool("/labwc_config/theme/dropShadows", ui->dropShadows->isChecked()); + setBool("/labwc_config/theme/dropShadowsOnTiled", ui->dropShadowsOnTiled->isChecked()); setStr("/labwc_config/theme/icon", TEXT(ui->iconTheme)); + setStr("/labwc_config/core/decoration", DATA(ui->decoration)); + setStr("/labwc_config/theme/maximizedDecoration", DATA(ui->maximizedDecoration)); } diff --git a/src/appearance.ui b/src/appearance.ui index 0218520..fd0e7ac 100644 --- a/src/appearance.ui +++ b/src/appearance.ui @@ -6,76 +6,213 @@ 0 0 - 232 - 153 + 581 + 596 - - - 6 + + + + 0 + 0 + 659 + 287 + - - 6 - - - 6 - - - 6 - - - - - Labwc Theme - - - - - - - - - - Corner Radius - - - - - - - 16 - - - - - - - Drop Shadows - - - - - - - - 0 - 33 - - - - - - - - Icon Theme - - - - - - - + + + + + + Labwc Theme + + + + + + + + + + Qt::Orientation::Horizontal + + + + 118 + 20 + + + + + + + + + + Icon Theme + + + + + + + + + + Qt::Orientation::Horizontal + + + + 118 + 20 + + + + + + + + + + Enable shadows + + + + + + + Enable on tiled windows + + + + + + + Qt::Orientation::Horizontal + + + + 118 + 20 + + + + + + + + + + Corner Radius + + + + + + + + + + Qt::Orientation::Horizontal + + + + 418 + 20 + + + + + + + + + + Decoration + + + + + + + + Server + + + + + Client + + + + + + + + Qt::Orientation::Horizontal + + + + 188 + 20 + + + + + + + + + + Maximized Decoration + + + + + + + + Titlebar + + + + + None + + + + + + + + Qt::Orientation::Horizontal + + + + 198 + 20 + + + + + + + + + + Qt::Orientation::Vertical + + + + 20 + 13 + + + + + + - + \ No newline at end of file diff --git a/src/settings.cpp b/src/settings.cpp index 5251cc8..0035a20 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -22,8 +22,16 @@ void initSettings(std::vector> *settings) LAB_FILE_TYPE_RCXML, LAB_VALUE_TYPE_INT, 8)); settings->push_back(std::make_shared("/labwc_config/theme/dropShadows", LAB_FILE_TYPE_RCXML, LAB_VALUE_TYPE_BOOL, 0)); + settings->push_back(std::make_shared("/labwc_config/theme/dropShadowsOnTiled", + LAB_FILE_TYPE_RCXML, LAB_VALUE_TYPE_BOOL, 0)); settings->push_back(std::make_shared("/labwc_config/theme/icon", LAB_FILE_TYPE_RCXML, LAB_VALUE_TYPE_STRING, "")); + settings->push_back(std::make_shared("/labwc_config/theme/maximizedDecoration", + LAB_FILE_TYPE_RCXML, LAB_VALUE_TYPE_STRING, + "titlebar")); + settings->push_back(std::make_shared("/labwc_config/core/decoration", + LAB_FILE_TYPE_RCXML, LAB_VALUE_TYPE_STRING, + "Server")); // Behaviour settings->push_back(std::make_shared("/labwc_config/placement/policy",