More predictable behaviour of wallpaper chooser

This commit is contained in:
Sebastian Kügler 2013-03-28 04:29:33 +01:00
parent 41aaa5a904
commit f17e903d7c
3 changed files with 30 additions and 9 deletions

View File

@ -31,7 +31,7 @@ MouseArea {
//BEGIN properties //BEGIN properties
width: childrenRect.width width: childrenRect.width
height: childrenRect.height height: childrenRect.height
property bool current: categoriesView.currentIndex == index property bool current: model.source == main.sourceFile
//END properties //END properties
//BEGIN connections //BEGIN connections
@ -40,18 +40,27 @@ MouseArea {
if (delegate.current) { if (delegate.current) {
return return
} else { } else {
categoriesView.currentIndex = index; if (typeof(categoriesView.currentIndex) != "undefined") {
categoriesView.currentIndex = index;
}
main.sourceFile = model.source main.sourceFile = model.source
root.restoreConfig() root.restoreConfig()
} }
} }
onCurrentChanged: {
if (current) {
categoriesView.currentIndex = index
}
}
//END connections //END connections
//BEGIN UI components //BEGIN UI components
Column { Column {
spacing: 4
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
topMargin: _m
} }
PlasmaCore.IconItem { PlasmaCore.IconItem {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter

View File

@ -27,6 +27,8 @@ import org.kde.plasma.configuration 2.0
Rectangle { Rectangle {
id: root id: root
property int _m: theme.defaultFont.pointSize
//BEGIN properties //BEGIN properties
color: "lightgray" color: "lightgray"
width: 640 width: 640
@ -135,8 +137,8 @@ Rectangle {
Rectangle { Rectangle {
color: theme.highlightColor color: theme.highlightColor
width: parent.width width: parent.width
height: categoriesView.currentItem.height height: theme.iconSizes.IconSizeHuge
y: categoriesView.currentItem.y y: index * height
Behavior on y { Behavior on y {
NumberAnimation { NumberAnimation {
duration: 250 duration: 250
@ -149,7 +151,10 @@ Rectangle {
width: parent.width width: parent.width
Repeater { Repeater {
model: configDialog.configModel model: configDialog.configModel
delegate: ConfigCategoryDelegate {} delegate: ConfigCategoryDelegate {
onClicked: categoriesView.currentIndex = index
}
} }
Repeater { Repeater {
model: globalConfigModel model: globalConfigModel
@ -178,6 +183,7 @@ Rectangle {
PlasmaComponents.PageStack { PlasmaComponents.PageStack {
id: main id: main
anchors.fill: parent anchors.fill: parent
anchors.margins: 12
property string sourceFile property string sourceFile
Timer { Timer {
id: pageSizeSync id: pageSizeSync

View File

@ -23,6 +23,8 @@ import org.kde.plasma.configuration 2.0
Column { Column {
id: root id: root
spacing: _m
PlasmaExtras.Title { PlasmaExtras.Title {
text: "Plugins" text: "Plugins"
} }
@ -59,6 +61,7 @@ Column {
model: configDialog.wallpaperConfigModel model: configDialog.wallpaperConfigModel
delegate: ConfigCategoryDelegate { delegate: ConfigCategoryDelegate {
id: delegate id: delegate
current: categoriesView.currentIndex == index
anchors { anchors {
top: parent.top top: parent.top
bottom: parent.bottom bottom: parent.bottom
@ -97,7 +100,7 @@ Column {
interval: 100 interval: 100
property variant pendingCurrent property variant pendingCurrent
onTriggered: { onTriggered: {
if (pendingCurrent && pen) { if (pendingCurrent) {
categoriesView.currentIndex = pendingCurrent.index categoriesView.currentIndex = pendingCurrent.index
main.sourceFile = pendingCurrent.source main.sourceFile = pendingCurrent.source
root.restoreConfig() root.restoreConfig()
@ -107,7 +110,10 @@ Column {
} }
PlasmaComponents.PageStack { PlasmaComponents.PageStack {
id: main id: main
anchors.horizontalCenter: parent.horizontalCenter anchors {
left: categoriesView.left;
right: parent.right;
}
width: implicitWidth width: implicitWidth
height: implicitHeight height: implicitHeight
property string sourceFile property string sourceFile
@ -115,8 +121,8 @@ Column {
if (sourceFile != "") { if (sourceFile != "") {
main.opacity = 1; main.opacity = 1;
replace(Qt.resolvedUrl(sourceFile)) replace(Qt.resolvedUrl(sourceFile))
root.width = mainColumn.implicitWidth //main.width = mainColumn.implicitWidth
root.height = mainColumn.implicitHeight main.height = mainColumn.implicitHeight
} else { } else {
main.opacity = 0 main.opacity = 0
} }