diff --git a/kcmkwin/kwindecoration/CMakeLists.txt b/kcmkwin/kwindecoration/CMakeLists.txt
index 4762bb983b..da02993ce9 100644
--- a/kcmkwin/kwindecoration/CMakeLists.txt
+++ b/kcmkwin/kwindecoration/CMakeLists.txt
@@ -30,5 +30,4 @@ install(TARGETS kcm_kwindecoration DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES kwindecoration.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
-install( FILES qml/main.qml qml/AuroraeDecoration.qml qml/AuroraePreview.qml qml/OxygenScrollbar.qml DESTINATION ${DATA_INSTALL_DIR}/kwin/kcm_kwindecoration)
-install( DIRECTORY qml/images/ DESTINATION ${DATA_INSTALL_DIR}/kwin/kcm_kwindecoration/images)
+install( FILES qml/main.qml qml/AuroraeDecoration.qml qml/AuroraePreview.qml DESTINATION ${DATA_INSTALL_DIR}/kwin/kcm_kwindecoration)
diff --git a/kcmkwin/kwindecoration/decoration.ui b/kcmkwin/kwindecoration/decoration.ui
index 34cdcc3bc3..6451586d7b 100644
--- a/kcmkwin/kwindecoration/decoration.ui
+++ b/kcmkwin/kwindecoration/decoration.ui
@@ -7,10 +7,10 @@
0
0
681
- 515
+ 595
-
+
-
@@ -26,6 +26,15 @@
Select the window decoration. This is the look and feel of both the window borders and the window handle.
+
+ QFrame::StyledPanel
+
+
+ QFrame::Sunken
+
+
+ Qt::ScrollBarAlwaysOn
+
-
@@ -70,15 +79,20 @@
- KPushButton
- QPushButton
-
+ QDeclarativeView
+ QGraphicsView
+ QtDeclarative/QDeclarativeView
KLineEdit
QLineEdit
+
+ KPushButton
+ QPushButton
+
+
searchEdit
diff --git a/kcmkwin/kwindecoration/kwindecoration.cpp b/kcmkwin/kwindecoration/kwindecoration.cpp
index 3445ea7d87..6d9e729670 100644
--- a/kcmkwin/kwindecoration/kwindecoration.cpp
+++ b/kcmkwin/kwindecoration/kwindecoration.cpp
@@ -34,12 +34,15 @@
#include "decorationmodel.h"
#include "auroraetheme.h"
// Qt
+#include
#include
#include
#include
+#include
#include
#include
#include
+#include
// KDE
#include
#include
@@ -89,10 +92,6 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const QVariantList &
m_proxyModel->setSourceModel(m_model);
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
m_ui->decorationList->setResizeMode(QDeclarativeView::SizeRootObjectToView);
- m_ui->decorationList->setAttribute(Qt::WA_TranslucentBackground);
- QPalette pal = m_ui->decorationList->palette();
- pal.setColor(m_ui->decorationList->backgroundRole(), Qt::transparent);
- m_ui->decorationList->setPalette(pal);
foreach (const QString &importPath, KGlobal::dirs()->findDirs("module", "imports")) {
m_ui->decorationList->engine()->addImportPath(importPath);
}
@@ -106,11 +105,20 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const QVariantList &
connect(m_ui->decorationList->rootObject(), SIGNAL(currentIndexChanged()), SLOT(slotSelectionChanged()));
connect(m_ui->decorationList->rootObject(), SIGNAL(widthChanged()), m_model, SLOT(regeneratePreviews()));
+ connect(m_ui->decorationList->rootObject(), SIGNAL(contentYChanged()), SLOT(updateScrollbarValue()));
+ connect(m_ui->decorationList->rootObject(), SIGNAL(contentHeightChanged()), SLOT(updateScrollbarRange()));
connect(m_ui->configureButtonsButton, SIGNAL(clicked(bool)), this, SLOT(slotConfigureButtons()));
connect(m_ui->ghnsButton, SIGNAL(clicked(bool)), SLOT(slotGHNSClicked()));
connect(m_ui->searchEdit, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString)));
connect(m_ui->configureDecorationButton, SIGNAL(clicked(bool)), SLOT(slotConfigureDecoration()));
+ m_ui->decorationList->disconnect(m_ui->decorationList->verticalScrollBar());
+ m_ui->decorationList->verticalScrollBar()->disconnect(m_ui->decorationList);
+ connect(m_ui->decorationList->verticalScrollBar(), SIGNAL(rangeChanged(int, int )), SLOT(updateScrollbarRange()));
+ connect(m_ui->decorationList->verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(updateViewPosition(int)));
+
+ m_ui->decorationList->installEventFilter(this);
+
KAboutData *about =
new KAboutData(I18N_NOOP("kcmkwindecoration"), 0,
ki18n("Window Decoration Control Module"),
@@ -119,6 +127,7 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const QVariantList &
about->addAuthor(ki18n("Karol Szwed"), KLocalizedString(), "gallium@kde.org");
setAboutData(about);
m_model->regeneratePreviews();
+ QMetaObject::invokeMethod(this, "setSliderWidth", Qt::QueuedConnection);
}
@@ -349,6 +358,40 @@ void KWinDecorationModule::slotConfigureDecoration()
}
}
+bool KWinDecorationModule::eventFilter(QObject *o, QEvent *e)
+{
+ if (o == m_ui->decorationList && e->type() == QEvent::Resize)
+ updateScrollbarRange();
+ return KCModule::eventFilter(o, e);
+}
+void KWinDecorationModule::setSliderWidth()
+{
+ m_ui->decorationList->rootContext()->setContextProperty("sliderWidth", m_ui->decorationList->verticalScrollBar()->width());
+}
+
+void KWinDecorationModule::updateScrollbarRange()
+{
+ m_ui->decorationList->verticalScrollBar()->blockSignals(true);
+ const int h = m_ui->decorationList->rootObject()->property("contentHeight").toInt();
+ m_ui->decorationList->verticalScrollBar()->setRange(0, h - m_ui->decorationList->height());
+ m_ui->decorationList->verticalScrollBar()->setPageStep(m_ui->decorationList->verticalScrollBar()->maximum()/m_model->rowCount());
+ m_ui->decorationList->verticalScrollBar()->blockSignals(false);
+}
+
+void KWinDecorationModule::updateScrollbarValue()
+{
+ const int v = m_ui->decorationList->rootObject()->property("contentY").toInt();
+ m_ui->decorationList->verticalScrollBar()->blockSignals(true); // skippig this will kill kinetic scrolling but the scrollwidth is too low
+ m_ui->decorationList->verticalScrollBar()->setValue(v);
+ m_ui->decorationList->verticalScrollBar()->blockSignals(false);
+}
+
+void KWinDecorationModule::updateViewPosition(int v)
+{
+ QGraphicsObject *list = m_ui->decorationList->rootObject();
+ list->setProperty("contentY", v);
+}
+
DecorationButtons::DecorationButtons(QObject *parent)
: QObject(parent)
, m_customPositions(false)
diff --git a/kcmkwin/kwindecoration/kwindecoration.h b/kcmkwin/kwindecoration/kwindecoration.h
index a78a56a69f..e1d7556daa 100644
--- a/kcmkwin/kwindecoration/kwindecoration.h
+++ b/kcmkwin/kwindecoration/kwindecoration.h
@@ -105,6 +105,9 @@ signals:
void pluginSave(KConfigGroup &conf);
void pluginDefaults();
+protected:
+ bool eventFilter(QObject *o, QEvent *e);
+
protected slots:
// Allows us to turn "save" on
void slotSelectionChanged();
@@ -115,7 +118,12 @@ protected slots:
private:
void readConfig(const KConfigGroup& conf);
void writeConfig(KConfigGroup &conf);
-
+private slots:
+ void setSliderWidth();
+ void updateScrollbarRange();
+ void updateScrollbarValue();
+ void updateViewPosition(int v);
+private:
KSharedConfigPtr kwinConfig;
KWinDecorationForm* m_ui;
diff --git a/kcmkwin/kwindecoration/qml/OxygenScrollbar.qml b/kcmkwin/kwindecoration/qml/OxygenScrollbar.qml
deleted file mode 100644
index a089fd7383..0000000000
--- a/kcmkwin/kwindecoration/qml/OxygenScrollbar.qml
+++ /dev/null
@@ -1,158 +0,0 @@
-/********************************************************************
-Copyright (C) 2012 Nuno Pinheiro
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-*********************************************************************/
-import QtQuick 1.0
-
-Item {
- property variant list
- property int itemHeight: 1
- id: verticalScroolbar
- width:19
- height: parent.height-1
- anchors.right: parent.right
- anchors.rightMargin: 2
- clip:true
-
- Item {
- id: scroolerArea
- width: parent.width
- height: parent.height-uparrow.height*2
- y:uparrow.height
- opacity: scroolerAreaOver.containsMouse? 1:list.moving?1:dragarea.containsMouse? 1:dragarea.pressed?1: 0.3
- Behavior on opacity {
- NumberAnimation { duration: 600 }
- }
- MouseArea {
- id: scroolerAreaOver
- anchors.bottomMargin:-uparrow.height
- anchors.topMargin: -uparrow.height
- anchors.fill: parent
- hoverEnabled: true
-
- }
- BorderImage {
- id: scroller
- source: "images/scrool.png"
- width:parent.width
- height:Math.max (14,parent.height*list.height/list.contentHeight)
- y:parent.height*list.contentY/list.contentHeight
- border.left: 7; border.top: 7
- border.right: 7; border.bottom: 8
- opacity: 1
- }
-
- BorderImage {
- id: scrolleractive
- source: "images/scroolactive.png"
- width:parent.width
- height:Math.max (14,parent.height*list.height/list.contentHeight)
- y:parent.height*list.contentY/list.contentHeight
- border.left: 7; border.top: 7
- border.right: 7; border.bottom: 8
- opacity:scroolerAreaOver.containsMouse? 1:dragarea.containsMouse?1:dragarea.pressed?1:0.01
- Behavior on opacity {
- NumberAnimation { duration: 400 }
- }
- MouseArea{
- id:dragarea
- anchors.fill:parent
- hoverEnabled: true
- drag.target: scrolleractive
- drag.axis: Drag.YAxis
- drag.minimumY: 0
- drag.maximumY: scroolerArea.height-scrolleractive.height
- onPositionChanged: list.contentY=scrolleractive.y*list.contentHeight/(scroolerArea.height)
- }
- }
- }
-
- Item{
- id:uparrow
- width:parent.width
- height: parent.width-4
- Image{
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- source:"images/arrowup.png"
- opacity:uparrowOver.containsMouse? 0:1
-
- Behavior on opacity {
- NumberAnimation { duration: 300 }
- }
- }
- Image{
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- source:"images/arrowupactive.png"
- opacity: uparrowOver.containsMouse? 1:0
- Behavior on opacity {
- NumberAnimation { duration: 300 }
- }
- }
- MouseArea {
- id: uparrowOver
- anchors.fill: parent
- hoverEnabled: true
- onClicked: {
- if (!list.atYBeginning) {
- list.contentY -= itemHeight;
- if (list.contentY < 0) {
- list.contentY = 0;
- }
- }
- }
- }
- }
-
- Item{
- id:downarrow
- width:parent.width
- height: parent.width-4
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 0
- Image{
- rotation: 180
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- source:"images/arrowup.png"
- opacity:downarrowOver.containsMouse? 0:1
-
- Behavior on opacity {
- NumberAnimation { duration: 300 }
- }
- }
- Image{
- rotation: 180
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- source:"images/arrowupactive.png"
- opacity: downarrowOver.containsMouse? 1:0
- Behavior on opacity {
- NumberAnimation { duration: 300 }
- }
- }
- MouseArea {
- id: downarrowOver
- anchors.fill: parent
- hoverEnabled: true
- onClicked: {
- if (!list.atYEnd) {
- list.contentY += itemHeight;
- }
- }
- }
- }
-}
diff --git a/kcmkwin/kwindecoration/qml/images/arrowup.png b/kcmkwin/kwindecoration/qml/images/arrowup.png
deleted file mode 100644
index ebb1d58912..0000000000
Binary files a/kcmkwin/kwindecoration/qml/images/arrowup.png and /dev/null differ
diff --git a/kcmkwin/kwindecoration/qml/images/arrowupactive.png b/kcmkwin/kwindecoration/qml/images/arrowupactive.png
deleted file mode 100644
index a92e3dbcc7..0000000000
Binary files a/kcmkwin/kwindecoration/qml/images/arrowupactive.png and /dev/null differ
diff --git a/kcmkwin/kwindecoration/qml/images/bg.png b/kcmkwin/kwindecoration/qml/images/bg.png
deleted file mode 100644
index 5aa56957dc..0000000000
Binary files a/kcmkwin/kwindecoration/qml/images/bg.png and /dev/null differ
diff --git a/kcmkwin/kwindecoration/qml/images/glow.png b/kcmkwin/kwindecoration/qml/images/glow.png
deleted file mode 100644
index ec173b4745..0000000000
Binary files a/kcmkwin/kwindecoration/qml/images/glow.png and /dev/null differ
diff --git a/kcmkwin/kwindecoration/qml/images/scrool.png b/kcmkwin/kwindecoration/qml/images/scrool.png
deleted file mode 100644
index 6fe848e790..0000000000
Binary files a/kcmkwin/kwindecoration/qml/images/scrool.png and /dev/null differ
diff --git a/kcmkwin/kwindecoration/qml/images/scroolactive.png b/kcmkwin/kwindecoration/qml/images/scroolactive.png
deleted file mode 100644
index 8664282949..0000000000
Binary files a/kcmkwin/kwindecoration/qml/images/scroolactive.png and /dev/null differ
diff --git a/kcmkwin/kwindecoration/qml/images/shadow.png b/kcmkwin/kwindecoration/qml/images/shadow.png
deleted file mode 100644
index ee8dcfa530..0000000000
Binary files a/kcmkwin/kwindecoration/qml/images/shadow.png and /dev/null differ
diff --git a/kcmkwin/kwindecoration/qml/main.qml b/kcmkwin/kwindecoration/qml/main.qml
index fd04c3d6b2..e82e00b184 100644
--- a/kcmkwin/kwindecoration/qml/main.qml
+++ b/kcmkwin/kwindecoration/qml/main.qml
@@ -18,85 +18,37 @@ along with this program. If not, see .
import QtQuick 1.1
import org.kde.qtextracomponents 0.1 as QtExtra
-BorderImage {
- property alias currentIndex: listView.currentIndex
- source: "images/bg.png"
- border {
- left: 4
- top: 4
- right: 4
- bottom: 4
+ListView {
+ id: listView
+ x: 0
+ y: 0
+ model: decorationModel
+ highlight: Rectangle {
+ width: listView.width - sliderWidth
+ height: 150
+ color: highlightColor
+ opacity: 0.5
}
-
- MouseArea {
- id: focusOver
- anchors.fill: parent
- hoverEnabled: true
- }
-
- ListView {
- id: listView
- x: 3
- height: parent.height - 1 // -1 on the account of the last pixel being a glow pixel
- width: parent.width - 6 - scrollbar.width
- model: decorationModel
- highlight: Rectangle {
- width: listView.width
- height: 150
- color: highlightColor
- opacity: 0.5
+ highlightMoveDuration: 250
+ boundsBehavior: Flickable.StopAtBounds
+ delegate: Item {
+ width: listView.width - sliderWidth
+ height: 150
+ QtExtra.QPixmapItem {
+ pixmap: preview
+ anchors.fill: parent
+ visible: type == 0
}
- highlightMoveDuration: 250
- boundsBehavior: Flickable.StopAtBounds
- delegate: Item {
- width: listView.width
- height: 150
- QtExtra.QPixmapItem {
- pixmap: preview
- anchors.fill: parent
- visible: type == 0
- }
- Loader {
- source: type == 1 ? "AuroraePreview.qml" : ""
- anchors.fill: parent
- }
- MouseArea {
- hoverEnabled: false
- anchors.fill: parent
- onClicked: {
- listView.currentIndex = index;
- }
- }
+ Loader {
+ source: type == 1 ? "AuroraePreview.qml" : ""
+ anchors.fill: parent
}
- }
- OxygenScrollbar {
- id: scrollbar
- list: listView
- itemHeight: 150
- }
-
- BorderImage {
- id: shadow
- source: "images/shadow.png"
- anchors.fill:parent
- border.left: 4; border.top: 4
- border.right: 4; border.bottom: 5
- opacity:focusOver.containsMouse? 0.01:1 //insert here a proper focus mechanism
- Behavior on opacity {
- NumberAnimation { duration: 300 }
- }
-
- }
-
- BorderImage {
- id: glow
- source: "images/glow.png"
- anchors.fill:parent
- border.left: 4; border.top: 4
- border.right: 4; border.bottom: 5
- opacity:focusOver.containsMouse? 1:0 //insert here a proper focus mechanism
- Behavior on opacity {
- NumberAnimation { duration: 300 }
+ MouseArea {
+ hoverEnabled: false
+ anchors.fill: parent
+ onClicked: {
+ listView.currentIndex = index;
+ }
}
}
}