overhaul of deco kcm

- tab theme and button items
- move menubutton close hint below checkbox (moved on top)
- use proper background palette on palette updates

REVIEW: 125393
This commit is contained in:
Thomas Lübking 2015-09-24 14:21:52 +02:00
parent be7e9249cf
commit ed2314dfbe
5 changed files with 188 additions and 129 deletions

View file

@ -87,6 +87,7 @@ ConfigurationModule::ConfigurationModule(QWidget *parent, const QVariantList &ar
qmlRegisterType<QAbstractItemModel>();
QWidget *widget = QWidget::createWindowContainer(m_quickView, this);
QVBoxLayout* layout = new QVBoxLayout(m_ui->view);
layout->setContentsMargins(0,0,0,0);
layout->addWidget(widget);
m_quickView->rootContext()->setContextProperty(QStringLiteral("decorationsModel"), m_proxyModel);
@ -102,6 +103,27 @@ ConfigurationModule::ConfigurationModule(QWidget *parent, const QVariantList &ar
connect(listView, SIGNAL(currentIndexChanged()), this, SLOT(changed()));
}
}
m_ui->tabWidget->tabBar()->disconnect();
auto setCurrentTab = [this](int index) {
if (index == 0)
m_ui->doubleClickMessage->hide();
m_ui->filter->setVisible(index == 0);
m_ui->knsButton->setVisible(index == 0);
if (auto themeList = m_quickView->rootObject()->findChild<QQuickItem*>("themeList")) {
themeList->setVisible(index == 0);
}
m_ui->borderSizesLabel->setVisible(index == 0);
m_ui->borderSizesCombo->setVisible(index == 0);
m_ui->closeWindowsDoubleClick->setVisible(index == 1);
if (auto buttonLayout = m_quickView->rootObject()->findChild<QQuickItem*>("buttonLayout")) {
buttonLayout->setVisible(index == 1);
}
};
connect(m_ui->tabWidget->tabBar(), &QTabBar::currentChanged, this, setCurrentTab);
setCurrentTab(0);
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);
@ -120,10 +142,13 @@ ConfigurationModule::ConfigurationModule(QWidget *parent, const QVariantList &ar
connect(m_ui->closeWindowsDoubleClick, &QCheckBox::stateChanged, this, changedSlot);
connect(m_ui->closeWindowsDoubleClick, &QCheckBox::toggled, this,
[this] (bool toggled) {
if (!toggled || s_loading) {
if (s_loading) {
return;
}
m_ui->doubleClickMessage->animatedShow();
if (toggled)
m_ui->doubleClickMessage->animatedShow();
else
m_ui->doubleClickMessage->animatedHide();
}
);
connect(m_ui->borderSizesCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
@ -402,8 +427,9 @@ bool ConfigurationModule::eventFilter(QObject *watched, QEvent *e)
void ConfigurationModule::updateColors()
{
m_quickView->rootContext()->setContextProperty("backgroundColor", QPalette().color(QPalette::Window));
m_quickView->rootContext()->setContextProperty("highlightColor", QPalette().color(QPalette::Highlight));
m_quickView->rootContext()->setContextProperty("backgroundColor", m_ui->palette().color(QPalette::Active, QPalette::Window));
m_quickView->rootContext()->setContextProperty("highlightColor", m_ui->palette().color(QPalette::Active, QPalette::Highlight));
m_quickView->rootContext()->setContextProperty("baseColor", m_ui->palette().color(QPalette::Active, QPalette::Base));
}
}

View file

@ -6,139 +6,165 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>386</width>
<height>272</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="KMessageWidget" name="doubleClickMessage"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="filter">
<property name="placeholderText">
<string>Search</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="knsButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Get New Decorations...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="view">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="theTab">
<attribute name="title">
<string>Theme</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="filter">
<property name="placeholderText">
<string>Search</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="knsButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Get New Decorations...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<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>
<property name="text">
<string>Close windows by double clicking &amp;the menu button</string>
</property>
</widget>
</item>
<item>
<widget class="KMessageWidget" name="doubleClickMessage"/>
</item>
<item>
<widget class="QWidget" name="view">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="borderSizesSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="borderSizesLabel">
<property name="text">
<string>Border si&amp;ze:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>borderSizesCombo</cstring>
</property>
</widget>
</item>
<item>
<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>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Buttons</string>
</attribute>
</widget>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Border si&amp;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 &amp;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>

View file

@ -25,6 +25,7 @@ import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons;
import org.kde.plasma.core 2.0 as PlasmaCore;
Item {
objectName: "buttonLayout"
Layout.preferredHeight: layout.height
KDecoration.Bridge {
id: bridgeItem
@ -60,12 +61,14 @@ Item {
height: Math.max(units.iconSizes.small, titlebar.implicitHeight) + units.smallSpacing/2
ButtonGroup {
id: leftButtonsView
anchors.left: parent.left;
height: buttonPreviewRow.height
model: configurationModule.leftButtons
key: "decoButtonLeft"
}
Item {
Layout.fillWidth: true
anchors.centerIn: parent
height: titlebar.implicitHeight
Label {
id: titlebar
@ -76,6 +79,7 @@ Item {
}
ButtonGroup {
id: rightButtonsView
anchors.right: parent.right;
height: buttonPreviewRow.height
model: configurationModule.rightButtons
key: "decoButtonRight"

View file

@ -24,6 +24,8 @@ import org.kde.kwin.private.kdecoration 1.0 as KDecoration
import org.kde.plasma.core 2.0 as PlasmaCore;
ScrollView {
objectName: "themeList"
frameVisible: true
ListView {
id: listView
objectName: "listView"
@ -31,7 +33,7 @@ ScrollView {
Rectangle {
z: -1
anchors.fill: parent
color: SystemPalette.base;
color: baseColor
}
highlight: Rectangle {
width: listView.width

View file

@ -30,6 +30,7 @@ Rectangle {
Layout.fillHeight: true
}
Buttons {
anchors.top: parent.top
Layout.fillWidth: true
}
}