sync with mobilecomponents 9d8bf6d77d

- Fixes interactivity in context drawer.

- These are mostly cleanups that have been done pre-merge of these
components. This now is the state of master in plasma-mobile.

- makes navigation a bit more intuitive

Signed-off-by: Sebastian Kügler <sebas@kde.org>
This commit is contained in:
Sebastian Kügler 2015-12-04 00:27:35 +01:00
parent 72411eee63
commit b6f5f235f0
9 changed files with 74 additions and 62 deletions

View file

@ -28,11 +28,11 @@ Item {
property Component delegate
property QtObject model
property int pageSize: Math.floor(iconView.width/main.delegateWidth)*Math.floor(iconView.height/main.delegateHeight)
property int delegateWidth: Units.iconSizes.huge + Units.gridUnit*2
property int delegateHeight: Units.iconSizes.huge + Units.gridUnit*2
property int pageSize: Math.floor(iconView.width / main.delegateWidth) * Math.floor(iconView.height / main.delegateHeight)
property int delegateWidth: Units.iconSizes.huge + Units.gridUnit * 2
property int delegateHeight: Units.iconSizes.huge + Units.gridUnit * 2
property alias currentPage: iconView.currentIndex
property int pagesCount: Math.ceil(model.count/pageSize)
property int pagesCount: Math.ceil(model.count / pageSize)
property int count: model.count
property alias contentX: iconView.contentX
clip: true
@ -47,7 +47,7 @@ Item {
running: true
interval: 100
onTriggered: {
main.pageSize = Math.floor(iconView.width/main.delegateWidth)*Math.floor(iconView.height/main.delegateHeight)
main.pageSize = Math.floor(iconView.width / main.delegateWidth) * Math.floor(iconView.height / main.delegateHeight)
if (iconView.currentItem) {
iconView.currentItem.width = iconView.width
iconView.currentItem.height = iconView.height
@ -59,8 +59,8 @@ Item {
id: iconView
objectName: "iconView"
pressDelay: 200
cacheBuffer: 100
highlightMoveDuration: 250
cacheBuffer: Units.gridUnit * 8
highlightMoveDuration: Units.shortDuration
anchors.fill: parent
onWidthChanged: resizeTimer.restart()
onHeightChanged: resizeTimer.restart()
@ -103,8 +103,8 @@ Item {
Repeater {
id: iconRepeater
model: pagedProxyModel
property int columns: Math.min(count, Math.floor(delegatePage.width/main.delegateWidth))
property int suggestedWidth: main.delegateWidth*columns
property int columns: Math.min(count, Math.floor(delegatePage.width / main.delegateWidth))
property int suggestedWidth: main.delegateWidth * columns
//property int suggestedHeight: main.delegateHeight*Math.floor(count/columns)
delegate: main.delegate
@ -123,7 +123,7 @@ Item {
right: parent.right
bottom: parent.bottom
}
height: Math.max( 16, iconView.height - Math.floor(iconView.height/delegateHeight)*delegateHeight)
height: Math.max(16, iconView.height - Math.floor(iconView.height / delegateHeight) * delegateHeight)
property int pageCount: main.model ? Math.ceil(main.model.count/main.pageSize) : 0
@ -145,15 +145,14 @@ Item {
Rectangle {
id: barRectangle
color: Theme.textColor
opacity: 2.05
height: 4
radius: 2
anchors {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
leftMargin: (parent.width/pageCount/2)
rightMargin: (parent.width/pageCount/2)
leftMargin: (parent.width / pageCount / 2)
rightMargin: (parent.width / pageCount / 2)
}
}
Rectangle {
@ -162,10 +161,10 @@ Item {
width: height
radius: 4
anchors.verticalCenter: parent.verticalCenter
x: parent.width/(pageCount/(iconView.currentIndex+1)) - (parent.width/pageCount/2) - 4
x: parent.width / (pageCount / (iconView.currentIndex+1)) - (parent.width / pageCount / 2) - 4
Behavior on x {
NumberAnimation {
duration: 250
duration: Units.shortDuration
easing.type: Easing.InOutQuad
}
}
@ -192,7 +191,7 @@ Item {
Item {
Row {
anchors.centerIn: parent
spacing: 20
spacing: units.gridUnit
Repeater {
model: scrollArea.pageCount
@ -209,13 +208,13 @@ Item {
Behavior on scale {
NumberAnimation {
duration: 250
duration: units.shortDuration
easing.type: Easing.InOutQuad
}
}
Behavior on opacity {
NumberAnimation {
duration: 250
duration: units.shortDuration
easing.type: Easing.InOutQuad
}
}
@ -223,7 +222,7 @@ Item {
MouseArea {
anchors {
fill: parent
margins: -10
margins: Units.gridUnit / 2
}
onClicked: {