Commit 575c68d5 authored by eekkelund's avatar eekkelund

[AppSwitcher] Improvements for appswitcher

parent fd55bad4
...@@ -74,11 +74,12 @@ Item { ...@@ -74,11 +74,12 @@ Item {
Flickable { Flickable {
id: flickable id: flickable
contentHeight: gridview.height contentHeight: gridview.height
width: closeMode ? parent.width - 20 : parent.width // see comment re right anchor below width: closeMode ? parent.width - Theme.itemSpacingLarge : parent.width // see comment re right anchor below
MouseArea { MouseArea {
height: flickable.contentHeight > flickable.height ? flickable.contentHeight : flickable.height height: flickable.contentHeight > flickable.height ? flickable.contentHeight : flickable.height
width: flickable.width width: flickable.width
onPressAndHold: closeMode = !closeMode onPressAndHold: closeMode = !closeMode
enabled: gridRepeater.count > 0
onClicked: { onClicked: {
if (closeMode) if (closeMode)
closeMode = false closeMode = false
...@@ -87,17 +88,17 @@ Item { ...@@ -87,17 +88,17 @@ Item {
anchors { anchors {
top: parent.top top: parent.top
topMargin: closeMode ? 20 : 0 topMargin: closeMode ? Theme.itemSpacingLarge : 0
bottom: toolBar.top bottom: toolBar.top
left: parent.left left: parent.left
// no right anchor to avoid double margin (complicated math) // no right anchor to avoid double margin (complicated math)
leftMargin: closeMode ? 20 : 0 leftMargin: closeMode ? Theme.itemSpacingLarge : 0
} }
Grid { Grid {
id: gridview id: gridview
columns: 2 columns: 2
spacing: closeMode ? 20 : 0 spacing: closeMode ? Theme.itemSpacingLarge : 0
move: Transition { move: Transition {
NumberAnimation { NumberAnimation {
properties: "x,y" properties: "x,y"
...@@ -130,76 +131,118 @@ Item { ...@@ -130,76 +131,118 @@ Item {
} }
} }
Connections {
target:gridRepeater
onCountChanged: {
if(gridRepeater.count < 1) {
closeMode = false
}
}
}
Connections {
target: Lipstick.compositor
onDisplayOff: {
closeMode = false
}
}
Connections {
target: lockScreen
onVisibleChanged: {
if(lockscreenVisible()) {
closeMode = false
}
}
}
Connections {
target: pager
onFlickEnded: {
closeMode = false
}
}
Rectangle { Rectangle {
id: toolBar id: toolBar
color: 'black' color: Theme.backgroundColor
border { border {
width: 1 width: 1
color: '#333333' color: Theme.fillDarkColor
} }
z: 202 z: 202
height: toolBarDone.height + 2*padding height:Theme.itemHeightExtraLarge + 2*padding
property int padding: 9 property int padding: Theme.itemSpacingSmall
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
bottom: parent.bottom bottom: parent.bottom
margins: -1 margins: -1
bottomMargin: switcherRoot.closeMode ? 48 : -height bottomMargin: switcherRoot.closeMode ? statusbar.height : -height
} }
Behavior on anchors.bottomMargin { PropertyAnimation { duration: 100 } } Behavior on anchors.bottomMargin { PropertyAnimation { duration: 100 } }
Row {
anchors {
top: parent.top
margins: toolBar.padding
right: parent.right
left: parent.left
bottom: parent.bottom
}
spacing: toolBar.padding*2
Button { Button {
id: toolBarDone id: toolBarDone
width: parent.width / 3
height: width
anchors { anchors {
top: parent.top top: parent.top
topMargin: toolBar.padding bottom: parent.bottom
right: parent.horizontalCenter
rightMargin: toolBar.padding
} }
width: parent.width / 2 - toolBar.padding
onClicked: { onClicked: {
switcherRoot.closeMode = false; switcherRoot.closeMode = false;
} }
text: qsTr("Done")
//Untill fontSizes are fixed
style: ButtonStyle { style: ButtonStyle {
label: Label { label: Text {
text: "Done" renderType: Text.NativeRendering
anchors.fill: parent
anchors.margins: 10
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
fontSizeMode: Text.HorizontalFit horizontalAlignment: Text.AlignHCenter
anchors.centerIn: parent text: control.text
color: Theme.textColor
font.family: Theme.fontFamily
font.pixelSize: Theme.fontSizeMedium
font.weight: control.primary ? Theme.fontWeightLarge : Theme.fontWeightMedium
opacity: control.enabled ? 1.0 : 0.3
} }
} }
} }
Button { Button {
id: toolBarCloseAll id: toolBarCloseAll
width: toolBarDone.width
height: width
anchors { anchors {
top: parent.top top: parent.top
topMargin: toolBar.padding bottom: parent.bottom
left: parent.horizontalCenter
leftMargin: toolBar.padding
} }
width: parent.width / 2 - toolBar.padding
onClicked: { onClicked: {
// TODO: use close animation inside item // TODO: use close animation inside item
for (var i = gridRepeater.count - 1; i >= 0; i--) { for (var i = gridRepeater.count - 1; i >= 0; i--) {
gridRepeater.itemAt(i).close() gridRepeater.itemAt(i).close()
} }
} }
text: qsTr("Close All")
//Untill fontSizes are fixed
style: ButtonStyle { style: ButtonStyle {
label: Label { label: Text {
text: qsTr("Close\nAll") renderType: Text.NativeRendering
anchors.margins: 10
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
fontSizeMode: Text.Fit horizontalAlignment: Text.AlignHCenter
anchors.centerIn: parent text: control.text
color: Theme.textColor
font.family: Theme.fontFamily
font.pixelSize: Theme.fontSizeMedium
font.weight: control.primary ? Theme.fontWeightLarge : Theme.fontWeightMedium
opacity: control.enabled ? 1.0 : 0.3
}
} }
} }
} }
......
...@@ -166,7 +166,7 @@ Item { ...@@ -166,7 +166,7 @@ Item {
//searchableProperty: root.searchableProperty //searchableProperty: root.searchableProperty
} }
//Orginal function ** Copyright (C) 2013 Jolla Ltd. ** Contact: Joona Petrell <joona.petrell@jollamobile.com> //Orginal function ** Copyright (C) 2013 Jolla Ltd. ** Contact: Joona Petrell <joona.petrell@jollamobile.com> **BSD
//Function has been modified //Function has been modified
function update() { function update() {
if(searchString.length<1) { if(searchString.length<1) {
......
...@@ -67,6 +67,8 @@ MouseArea { ...@@ -67,6 +67,8 @@ MouseArea {
onClicked: { onClicked: {
if (!switcherRoot.closeMode) { if (!switcherRoot.closeMode) {
Lipstick.compositor.windowToFront(model.window); Lipstick.compositor.windowToFront(model.window);
} else {
switcherRoot.closeMode = false
} }
} }
...@@ -95,15 +97,15 @@ MouseArea { ...@@ -95,15 +97,15 @@ MouseArea {
script: switcherItemRoot.close() script: switcherItemRoot.close()
} }
} }
Label { /* Label {
anchors { anchors {
top: parent.top top: parent.top
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
topMargin: 30 topMargin: Theme.itemSpacingHuge
} }
font.pointSize: 8 font.pointSize: Theme.fontSizeTiny
text: Lipstick.compositor.windowForId(model.window).title text: Lipstick.compositor.windowForId(model.window).title
} }*/
CloseButton { CloseButton {
id: closeButton id: closeButton
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment