Bring back configuration options for Decorations
* Border Sizes * Close menu double click Both are added to the Settings and exposed in the decoration kcm. As it started to no longer scale the kcm uses a ui file. Still missing: * buttons * custom decoration configuration * GHNS * search
This commit is contained in:
parent
b5a626c2d7
commit
39f9581d4f
9 changed files with 305 additions and 20 deletions
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// KWin
|
// KWin
|
||||||
#include "composite.h"
|
#include "composite.h"
|
||||||
#include "virtualdesktops.h"
|
#include "virtualdesktops.h"
|
||||||
|
#include "workspace.h"
|
||||||
|
|
||||||
#include <config-kwin.h>
|
#include <config-kwin.h>
|
||||||
|
|
||||||
|
@ -55,6 +56,7 @@ SettingsImpl::SettingsImpl(KDecoration2::DecorationSettings *parent)
|
||||||
disconnect(c);
|
disconnect(c);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
connect(Workspace::self(), &Workspace::configChanged, this, &SettingsImpl::readSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsImpl::~SettingsImpl() = default;
|
SettingsImpl::~SettingsImpl() = default;
|
||||||
|
@ -71,7 +73,7 @@ bool SettingsImpl::isOnAllDesktopsAvailable() const
|
||||||
|
|
||||||
bool SettingsImpl::isCloseOnDoubleClickOnMenu() const
|
bool SettingsImpl::isCloseOnDoubleClickOnMenu() const
|
||||||
{
|
{
|
||||||
return false;
|
return m_closeDoubleClickMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QHash<KDecoration2::DecorationButtonType, QChar> s_buttonNames;
|
static QHash<KDecoration2::DecorationButtonType, QChar> s_buttonNames;
|
||||||
|
@ -127,18 +129,57 @@ QVector< KDecoration2::DecorationButtonType > SettingsImpl::readDecorationButton
|
||||||
return buttonsFromString(config.readEntry(key, buttonsToString(defaultValue)));
|
return buttonsFromString(config.readEntry(key, buttonsToString(defaultValue)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static KDecoration2::BorderSize stringToSize(const QString &name)
|
||||||
|
{
|
||||||
|
static const QMap<QString, KDecoration2::BorderSize> s_sizes = QMap<QString, KDecoration2::BorderSize>({
|
||||||
|
{QStringLiteral("None"), KDecoration2::BorderSize::None},
|
||||||
|
{QStringLiteral("NoSides"), KDecoration2::BorderSize::NoSides},
|
||||||
|
{QStringLiteral("Tiny"), KDecoration2::BorderSize::Tiny},
|
||||||
|
{QStringLiteral("Normal"), KDecoration2::BorderSize::Normal},
|
||||||
|
{QStringLiteral("Large"), KDecoration2::BorderSize::Large},
|
||||||
|
{QStringLiteral("VeryLarge"), KDecoration2::BorderSize::VeryLarge},
|
||||||
|
{QStringLiteral("Huge"), KDecoration2::BorderSize::Huge},
|
||||||
|
{QStringLiteral("VeryHuge"), KDecoration2::BorderSize::VeryHuge},
|
||||||
|
{QStringLiteral("Oversized"), KDecoration2::BorderSize::Oversized}
|
||||||
|
});
|
||||||
|
auto it = s_sizes.constFind(name);
|
||||||
|
if (it == s_sizes.constEnd()) {
|
||||||
|
// non sense values are interpreted just like normal
|
||||||
|
return KDecoration2::BorderSize::Normal;
|
||||||
|
}
|
||||||
|
return it.value();
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsImpl::readSettings()
|
void SettingsImpl::readSettings()
|
||||||
{
|
{
|
||||||
KConfigGroup config = KSharedConfig::openConfig(KWIN_CONFIG)->group(QStringLiteral("org.kde.kdecoration2"));
|
KConfigGroup config = KSharedConfig::openConfig(KWIN_CONFIG)->group(QStringLiteral("org.kde.kdecoration2"));
|
||||||
m_leftButtons = readDecorationButtons(config, "ButtonsOnLeft", QVector<KDecoration2::DecorationButtonType >({
|
const auto &left = readDecorationButtons(config, "ButtonsOnLeft", QVector<KDecoration2::DecorationButtonType >({
|
||||||
KDecoration2::DecorationButtonType::Menu,
|
KDecoration2::DecorationButtonType::Menu,
|
||||||
KDecoration2::DecorationButtonType::OnAllDesktops
|
KDecoration2::DecorationButtonType::OnAllDesktops
|
||||||
}));
|
}));
|
||||||
m_rightButtons = readDecorationButtons(config, "ButtonsOnRight", QVector<KDecoration2::DecorationButtonType >({
|
if (left != m_leftButtons) {
|
||||||
|
m_leftButtons = left;
|
||||||
|
emit decorationSettings()->decorationButtonsLeftChanged(m_leftButtons);
|
||||||
|
}
|
||||||
|
const auto &right = readDecorationButtons(config, "ButtonsOnRight", QVector<KDecoration2::DecorationButtonType >({
|
||||||
KDecoration2::DecorationButtonType::Minimize,
|
KDecoration2::DecorationButtonType::Minimize,
|
||||||
KDecoration2::DecorationButtonType::Maximize,
|
KDecoration2::DecorationButtonType::Maximize,
|
||||||
KDecoration2::DecorationButtonType::Close
|
KDecoration2::DecorationButtonType::Close
|
||||||
}));
|
}));
|
||||||
|
if (right != m_rightButtons) {
|
||||||
|
m_rightButtons = right;
|
||||||
|
emit decorationSettings()->decorationButtonsRightChanged(m_rightButtons);
|
||||||
|
}
|
||||||
|
const bool close = config.readEntry("CloseOnDoubleClickOnMenu", false);
|
||||||
|
if (close != m_closeDoubleClickMenu) {
|
||||||
|
m_closeDoubleClickMenu = close;
|
||||||
|
emit decorationSettings()->closeOnDoubleClickOnMenuChanged(m_closeDoubleClickMenu);
|
||||||
|
}
|
||||||
|
const auto size = stringToSize(config.readEntry("BorderSize", QStringLiteral("Normal")));
|
||||||
|
if (size != m_borderSize) {
|
||||||
|
m_borderSize = size;
|
||||||
|
emit decorationSettings()->borderSizeChanged(m_borderSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ private:
|
||||||
QVector< KDecoration2::DecorationButtonType > m_leftButtons;
|
QVector< KDecoration2::DecorationButtonType > m_leftButtons;
|
||||||
QVector< KDecoration2::DecorationButtonType > m_rightButtons;
|
QVector< KDecoration2::DecorationButtonType > m_rightButtons;
|
||||||
KDecoration2::BorderSize m_borderSize;
|
KDecoration2::BorderSize m_borderSize;
|
||||||
|
bool m_closeDoubleClickMenu = false;
|
||||||
};
|
};
|
||||||
} // Decoration
|
} // Decoration
|
||||||
} // KWin
|
} // KWin
|
||||||
|
|
|
@ -16,6 +16,7 @@ ki18n_wrap_ui(kcm_kwindecoration_PART_SRCS
|
||||||
buttons.ui
|
buttons.ui
|
||||||
config.ui
|
config.ui
|
||||||
decoration.ui
|
decoration.ui
|
||||||
|
kcm.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(kcm_kwindecoration MODULE ${kcm_kwindecoration_PART_SRCS})
|
add_library(kcm_kwindecoration MODULE ${kcm_kwindecoration_PART_SRCS})
|
||||||
|
|
|
@ -354,6 +354,9 @@ void Settings::createSettings()
|
||||||
m_settings.clear();
|
m_settings.clear();
|
||||||
} else {
|
} else {
|
||||||
m_settings = QSharedPointer<KDecoration2::DecorationSettings>::create(m_bridge.data());
|
m_settings = QSharedPointer<KDecoration2::DecorationSettings>::create(m_bridge.data());
|
||||||
|
m_previewSettings = m_bridge->lastCreatedSettings();
|
||||||
|
m_previewSettings->setBorderSizesIndex(m_borderSize);
|
||||||
|
connect(this, &Settings::borderSizesIndexChanged, m_previewSettings, &PreviewSettings::setBorderSizesIndex);
|
||||||
}
|
}
|
||||||
emit settingsChanged();
|
emit settingsChanged();
|
||||||
}
|
}
|
||||||
|
@ -368,5 +371,14 @@ DecorationSettings *Settings::settingsPointer() const
|
||||||
return m_settings.data();
|
return m_settings.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::setBorderSizesIndex(int index)
|
||||||
|
{
|
||||||
|
if (m_borderSize == index) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_borderSize = index;
|
||||||
|
emit borderSizesIndexChanged(m_borderSize);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,7 @@ class Settings : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(KDecoration2::Preview::PreviewBridge *bridge READ bridge WRITE setBridge NOTIFY bridgeChanged)
|
Q_PROPERTY(KDecoration2::Preview::PreviewBridge *bridge READ bridge WRITE setBridge NOTIFY bridgeChanged)
|
||||||
Q_PROPERTY(KDecoration2::DecorationSettings *settings READ settingsPointer NOTIFY settingsChanged)
|
Q_PROPERTY(KDecoration2::DecorationSettings *settings READ settingsPointer NOTIFY settingsChanged)
|
||||||
|
Q_PROPERTY(int borderSizesIndex READ borderSizesIndex WRITE setBorderSizesIndex NOTIFY borderSizesIndexChanged)
|
||||||
public:
|
public:
|
||||||
explicit Settings(QObject *parent = nullptr);
|
explicit Settings(QObject *parent = nullptr);
|
||||||
virtual ~Settings();
|
virtual ~Settings();
|
||||||
|
@ -168,15 +169,22 @@ public:
|
||||||
|
|
||||||
QSharedPointer<DecorationSettings> settings() const;
|
QSharedPointer<DecorationSettings> settings() const;
|
||||||
DecorationSettings *settingsPointer() const;
|
DecorationSettings *settingsPointer() const;
|
||||||
|
int borderSizesIndex() const {
|
||||||
|
return m_borderSize;
|
||||||
|
}
|
||||||
|
void setBorderSizesIndex(int index);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void bridgeChanged();
|
void bridgeChanged();
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
|
void borderSizesIndexChanged(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createSettings();
|
void createSettings();
|
||||||
QPointer<PreviewBridge> m_bridge;
|
QPointer<PreviewBridge> m_bridge;
|
||||||
QSharedPointer<KDecoration2::DecorationSettings> m_settings;
|
QSharedPointer<KDecoration2::DecorationSettings> m_settings;
|
||||||
|
PreviewSettings *m_previewSettings = nullptr;
|
||||||
|
int m_borderSize = 3;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,13 +24,13 @@
|
||||||
#include <KConfigGroup>
|
#include <KConfigGroup>
|
||||||
#include <KPluginFactory>
|
#include <KPluginFactory>
|
||||||
#include <KSharedConfig>
|
#include <KSharedConfig>
|
||||||
|
#include <KDecoration2/DecorationButton>
|
||||||
// Qt
|
// Qt
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include <QDBusMessage>
|
#include <QDBusMessage>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QQuickWidget>
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ K_PLUGIN_FACTORY(KDecorationFactory,
|
||||||
registerPlugin<KDecoration2::Configuration::ConfigurationModule>();
|
registerPlugin<KDecoration2::Configuration::ConfigurationModule>();
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(KDecoration2::BorderSize)
|
||||||
|
|
||||||
namespace KDecoration2
|
namespace KDecoration2
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -46,24 +48,65 @@ namespace Configuration
|
||||||
static const QString s_pluginName = QStringLiteral("org.kde.kdecoration2");
|
static const QString s_pluginName = QStringLiteral("org.kde.kdecoration2");
|
||||||
static const QString s_defaultPlugin = QStringLiteral("org.kde.breeze");
|
static const QString s_defaultPlugin = QStringLiteral("org.kde.breeze");
|
||||||
|
|
||||||
|
ConfigurationForm::ConfigurationForm(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool s_loading = false;
|
||||||
|
|
||||||
ConfigurationModule::ConfigurationModule(QWidget *parent, const QVariantList &args)
|
ConfigurationModule::ConfigurationModule(QWidget *parent, const QVariantList &args)
|
||||||
: KCModule(parent, args)
|
: KCModule(parent, args)
|
||||||
, m_view(new QQuickWidget(this))
|
|
||||||
, m_model(new DecorationsModel(this))
|
, m_model(new DecorationsModel(this))
|
||||||
|
, m_ui(new ConfigurationForm(this))
|
||||||
{
|
{
|
||||||
m_view->rootContext()->setContextProperty(QStringLiteral("decorationsModel"), m_model);
|
m_ui->view->rootContext()->setContextProperty(QStringLiteral("decorationsModel"), m_model);
|
||||||
m_view->rootContext()->setContextProperty("highlightColor", QPalette().color(QPalette::Highlight));
|
m_ui->view->rootContext()->setContextProperty("highlightColor", QPalette().color(QPalette::Highlight));
|
||||||
m_view->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
m_ui->view->rootContext()->setContextProperty("_borderSizesIndex", 3); // 3 is normal
|
||||||
m_view->setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/kcm_kwindecoration/main.qml"))));
|
m_ui->view->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||||
if (m_view->status() == QQuickWidget::Ready) {
|
m_ui->view->setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/kcm_kwindecoration/main.qml"))));
|
||||||
auto listView = m_view->rootObject()->findChild<QQuickItem*>("listView");
|
if (m_ui->view->status() == QQuickWidget::Ready) {
|
||||||
|
auto listView = m_ui->view->rootObject()->findChild<QQuickItem*>("listView");
|
||||||
if (listView) {
|
if (listView) {
|
||||||
connect(listView, SIGNAL(currentIndexChanged()), this, SLOT(changed()));
|
connect(listView, SIGNAL(currentIndexChanged()), this, SLOT(changed()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_ui->doubleClickMessage->setVisible(false);
|
||||||
|
m_ui->doubleClickMessage->setText(i18n("Close by double clicking:\n To open the menu, keep the button pressed until it appears."));
|
||||||
|
m_ui->doubleClickMessage->setCloseButtonVisible(true);
|
||||||
|
m_ui->borderSizesCombo->setItemData(0, QVariant::fromValue(BorderSize::None));
|
||||||
|
m_ui->borderSizesCombo->setItemData(1, QVariant::fromValue(BorderSize::NoSides));
|
||||||
|
m_ui->borderSizesCombo->setItemData(2, QVariant::fromValue(BorderSize::Tiny));
|
||||||
|
m_ui->borderSizesCombo->setItemData(3, QVariant::fromValue(BorderSize::Normal));
|
||||||
|
m_ui->borderSizesCombo->setItemData(4, QVariant::fromValue(BorderSize::Large));
|
||||||
|
m_ui->borderSizesCombo->setItemData(5, QVariant::fromValue(BorderSize::VeryLarge));
|
||||||
|
m_ui->borderSizesCombo->setItemData(6, QVariant::fromValue(BorderSize::Huge));
|
||||||
|
m_ui->borderSizesCombo->setItemData(7, QVariant::fromValue(BorderSize::VeryHuge));
|
||||||
|
m_ui->borderSizesCombo->setItemData(8, QVariant::fromValue(BorderSize::Oversized));
|
||||||
|
|
||||||
|
connect(m_ui->closeWindowsDoubleClick, &QCheckBox::stateChanged, this,
|
||||||
|
static_cast<void (ConfigurationModule::*)()>(&ConfigurationModule::changed));
|
||||||
|
connect(m_ui->closeWindowsDoubleClick, &QCheckBox::toggled, this,
|
||||||
|
[this] (bool toggled) {
|
||||||
|
if (!toggled || s_loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_ui->doubleClickMessage->animatedShow();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
connect(m_ui->borderSizesCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
|
this, [this] (int index) {
|
||||||
|
auto listView = m_ui->view->rootObject()->findChild<QQuickItem*>("listView");
|
||||||
|
if (listView) {
|
||||||
|
listView->setProperty("borderSizesIndex", index);
|
||||||
|
}
|
||||||
|
changed();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
QVBoxLayout *l = new QVBoxLayout(this);
|
QVBoxLayout *l = new QVBoxLayout(this);
|
||||||
l->addWidget(m_view);
|
l->addWidget(m_ui);
|
||||||
QMetaObject::invokeMethod(m_model, "init", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(m_model, "init", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,26 +117,60 @@ void ConfigurationModule::showEvent(QShowEvent *ev)
|
||||||
KCModule::showEvent(ev);
|
KCModule::showEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const QMap<QString, KDecoration2::BorderSize> s_sizes = QMap<QString, KDecoration2::BorderSize>({
|
||||||
|
{QStringLiteral("None"), BorderSize::None},
|
||||||
|
{QStringLiteral("NoSides"), BorderSize::NoSides},
|
||||||
|
{QStringLiteral("Tiny"), BorderSize::Tiny},
|
||||||
|
{QStringLiteral("Normal"), BorderSize::Normal},
|
||||||
|
{QStringLiteral("Large"), BorderSize::Large},
|
||||||
|
{QStringLiteral("VeryLarge"), BorderSize::VeryLarge},
|
||||||
|
{QStringLiteral("Huge"), BorderSize::Huge},
|
||||||
|
{QStringLiteral("VeryHuge"), BorderSize::VeryHuge},
|
||||||
|
{QStringLiteral("Oversized"), BorderSize::Oversized}
|
||||||
|
});
|
||||||
|
|
||||||
|
static BorderSize stringToSize(const QString &name)
|
||||||
|
{
|
||||||
|
auto it = s_sizes.constFind(name);
|
||||||
|
if (it == s_sizes.constEnd()) {
|
||||||
|
// non sense values are interpreted just like normal
|
||||||
|
return BorderSize::Normal;
|
||||||
|
}
|
||||||
|
return it.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
static QString sizeToString(BorderSize size)
|
||||||
|
{
|
||||||
|
return s_sizes.key(size, QStringLiteral("Normal"));
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigurationModule::load()
|
void ConfigurationModule::load()
|
||||||
{
|
{
|
||||||
|
s_loading = true;
|
||||||
const KConfigGroup config = KSharedConfig::openConfig("kwinrc")->group(s_pluginName);
|
const KConfigGroup config = KSharedConfig::openConfig("kwinrc")->group(s_pluginName);
|
||||||
const QString plugin = config.readEntry("library", s_defaultPlugin);
|
const QString plugin = config.readEntry("library", s_defaultPlugin);
|
||||||
const QString theme = config.readEntry("theme", QString());
|
const QString theme = config.readEntry("theme", QString());
|
||||||
const QModelIndex index = m_model->findDecoration(plugin, theme);
|
const QModelIndex index = m_model->findDecoration(plugin, theme);
|
||||||
if (auto listView = m_view->rootObject()->findChild<QQuickItem*>("listView")) {
|
if (auto listView = m_ui->view->rootObject()->findChild<QQuickItem*>("listView")) {
|
||||||
listView->setProperty("currentIndex", index.isValid() ? index.row() : -1);
|
listView->setProperty("currentIndex", index.isValid() ? index.row() : -1);
|
||||||
}
|
}
|
||||||
|
m_ui->closeWindowsDoubleClick->setChecked(config.readEntry("CloseOnDoubleClickOnMenu", false));
|
||||||
|
const QVariant border = QVariant::fromValue(stringToSize(config.readEntry("BorderSize", QStringLiteral("Normal"))));
|
||||||
|
m_ui->borderSizesCombo->setCurrentIndex(m_ui->borderSizesCombo->findData(border));
|
||||||
KCModule::load();
|
KCModule::load();
|
||||||
|
s_loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigurationModule::save()
|
void ConfigurationModule::save()
|
||||||
{
|
{
|
||||||
if (auto listView = m_view->rootObject()->findChild<QQuickItem*>("listView")) {
|
KConfigGroup config = KSharedConfig::openConfig("kwinrc")->group(s_pluginName);
|
||||||
|
config.writeEntry("CloseOnDoubleClickOnMenu", m_ui->closeWindowsDoubleClick->isChecked());
|
||||||
|
config.writeEntry("BorderSize", sizeToString(m_ui->borderSizesCombo->currentData().value<BorderSize>()));
|
||||||
|
if (auto listView = m_ui->view->rootObject()->findChild<QQuickItem*>("listView")) {
|
||||||
const int currentIndex = listView->property("currentIndex").toInt();
|
const int currentIndex = listView->property("currentIndex").toInt();
|
||||||
if (currentIndex != -1) {
|
if (currentIndex != -1) {
|
||||||
const QModelIndex index = m_model->index(currentIndex, 0);
|
const QModelIndex index = m_model->index(currentIndex, 0);
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
KConfigGroup config = KSharedConfig::openConfig("kwinrc")->group(s_pluginName);
|
|
||||||
config.writeEntry("library", index.data(Qt::UserRole + 4).toString());
|
config.writeEntry("library", index.data(Qt::UserRole + 4).toString());
|
||||||
const QString theme = index.data(Qt::UserRole +5).toString();
|
const QString theme = index.data(Qt::UserRole +5).toString();
|
||||||
if (theme.isEmpty()) {
|
if (theme.isEmpty()) {
|
||||||
|
@ -101,10 +178,10 @@ void ConfigurationModule::save()
|
||||||
} else {
|
} else {
|
||||||
config.writeEntry("theme", theme);
|
config.writeEntry("theme", theme);
|
||||||
}
|
}
|
||||||
config.sync();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
config.sync();
|
||||||
KCModule::save();
|
KCModule::save();
|
||||||
// Send signal to all kwin instances
|
// Send signal to all kwin instances
|
||||||
QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"),
|
QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"),
|
||||||
|
@ -115,7 +192,7 @@ void ConfigurationModule::save()
|
||||||
|
|
||||||
void ConfigurationModule::defaults()
|
void ConfigurationModule::defaults()
|
||||||
{
|
{
|
||||||
if (auto listView = m_view->rootObject()->findChild<QQuickItem*>("listView")) {
|
if (auto listView = m_ui->view->rootObject()->findChild<QQuickItem*>("listView")) {
|
||||||
const QModelIndex index = m_model->findDecoration(s_defaultPlugin);
|
const QModelIndex index = m_model->findDecoration(s_defaultPlugin);
|
||||||
listView->setProperty("currentIndex", index.isValid() ? index.row() : -1);
|
listView->setProperty("currentIndex", index.isValid() ? index.row() : -1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
#define KDECORATIONS_KCM_H
|
#define KDECORATIONS_KCM_H
|
||||||
|
|
||||||
#include <kcmodule.h>
|
#include <kcmodule.h>
|
||||||
|
#include <ui_kcm.h>
|
||||||
class QQuickWidget;
|
|
||||||
|
|
||||||
namespace KDecoration2
|
namespace KDecoration2
|
||||||
{
|
{
|
||||||
|
@ -34,6 +33,12 @@ namespace Configuration
|
||||||
{
|
{
|
||||||
class DecorationsModel;
|
class DecorationsModel;
|
||||||
|
|
||||||
|
class ConfigurationForm : public QWidget, public Ui::KCMForm
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ConfigurationForm(QWidget* parent);
|
||||||
|
};
|
||||||
|
|
||||||
class ConfigurationModule : public KCModule
|
class ConfigurationModule : public KCModule
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -50,8 +55,8 @@ protected:
|
||||||
void showEvent(QShowEvent *ev) override;
|
void showEvent(QShowEvent *ev) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QQuickWidget *m_view;
|
|
||||||
DecorationsModel *m_model;
|
DecorationsModel *m_model;
|
||||||
|
ConfigurationForm *m_ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
138
kcmkwin/kwindecoration/kcm.ui
Normal file
138
kcmkwin/kwindecoration/kcm.ui
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>KCMForm</class>
|
||||||
|
<widget class="QWidget" name="KCMForm">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="KMessageWidget" name="doubleClickMessage"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QQuickWidget" name="view">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="resizeMode">
|
||||||
|
<enum>QQuickWidget::SizeRootObjectToView</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Border si&ze:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>borderSizesCombo</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="KComboBox" name="borderSizesCombo">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">No Borders</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">No Side Borders</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Tiny</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Normal</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Large</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Very Large</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Huge</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Very Huge</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Oversized</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QCheckBox" name="closeWindowsDoubleClick">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string extracomment="Check this option if you want windows to be closed when you double click the menu button."/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string extracomment="Check this option if you want windows to be closed when you double click the menu button."/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Close windows by double clicking &the menu button:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>closeWindowsDoubleClick</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>QQuickWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>QQuickWidget</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>KComboBox</class>
|
||||||
|
<extends>QComboBox</extends>
|
||||||
|
<header>kcombobox.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>KMessageWidget</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header location="global">kmessagewidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -34,6 +34,7 @@ ScrollView {
|
||||||
}
|
}
|
||||||
highlightMoveDuration: 250
|
highlightMoveDuration: 250
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
property int borderSizesIndex: 3 // 3 == Normal
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
width: listView.width
|
width: listView.width
|
||||||
height: 150
|
height: 150
|
||||||
|
@ -45,6 +46,7 @@ ScrollView {
|
||||||
KDecoration.Settings {
|
KDecoration.Settings {
|
||||||
id: settingsItem
|
id: settingsItem
|
||||||
bridge: bridgeItem
|
bridge: bridgeItem
|
||||||
|
borderSizesIndex: listView.borderSizesIndex
|
||||||
}
|
}
|
||||||
KDecoration.Decoration {
|
KDecoration.Decoration {
|
||||||
id: inactivePreview
|
id: inactivePreview
|
||||||
|
|
Loading…
Reference in a new issue