Commit e72c789f authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

Functioning homescreen from Glacier components.

parent bf053389
...@@ -37,7 +37,7 @@ import QtQuick.Window 2.1 ...@@ -37,7 +37,7 @@ import QtQuick.Window 2.1
import org.nemomobile.time 1.0 import org.nemomobile.time 1.0
import org.nemomobile.configuration 1.0 import org.nemomobile.configuration 1.0
ApplicationWindow { Page {
// This is used in the favorites page and in the lock screen // This is used in the favorites page and in the lock screen
WallClock { WallClock {
...@@ -51,9 +51,7 @@ ApplicationWindow { ...@@ -51,9 +51,7 @@ ApplicationWindow {
key: desktop.isPortrait ? "/desktop/meego/background/portrait/picture_filename" : "/desktop/meego/background/landscape/picture_filename" key: desktop.isPortrait ? "/desktop/meego/background/portrait/picture_filename" : "/desktop/meego/background/landscape/picture_filename"
defaultValue: "images/graphics-wallpaper-home.jpg" defaultValue: "images/graphics-wallpaper-home.jpg"
} }
id: appWindow id: desktop
contentOrientation: Screen.orientation
// Implements back key navigation // Implements back key navigation
Keys.onReleased: { Keys.onReleased: {
...@@ -64,112 +62,49 @@ ApplicationWindow { ...@@ -64,112 +62,49 @@ ApplicationWindow {
} else { Qt.quit(); } } else { Qt.quit(); }
} }
} }
initialPage: Page { Pager {
Item { id: pager
id: desktop
property bool isPortrait: width < height
anchors.fill: parent
// Pager for swiping between different pages of the home screen
Pager {
id: pager
scale: 0.7 + 0.3 * lockScreen.openingState scale: 0.7 + 0.3 * lockScreen.openingState
opacity: lockScreen.openingState opacity: lockScreen.openingState
anchors.fill: parent anchors.fill: parent
model: VisualItemModel { model: VisualItemModel {
AppLauncher { AppLauncher {
id: launcher id: launcher
height: pager.height height: pager.height
}
AppSwitcher {
id: switcher
width: pager.width
height: pager.height
visibleInHome: x > -width && x < desktop.width
}
}
// Initial view should be the AppLauncher
currentIndex: 1
} }
Lockscreen { AppSwitcher {
id: lockScreen id: switcher
width: pager.width
width: parent.width height: pager.height
height: parent.height visibleInHome: x > -width && x < desktop.width
z: 200
onOpeningStateChanged: {
// When fully closed, reset the current page
if (openingState !== 0)
return
// Focus the switcher if any applications are running, otherwise the launcher
if (switcher.runningAppsCount > 0) {
pager.currentIndex = 2
} else {
pager.currentIndex = 1
}
}
} }
} }
tools: Item {
id: toolsLayoutItem
anchors.fill: parent // Initial view should be the AppLauncher
currentIndex: 1
}
Lockscreen {
id: lockScreen
property string title: "Glacier UI" width: parent.width
property StackView pageStack: findStackView(toolsLayoutItem) height: parent.height
//XXX: TEMPORARY CODE, MIGHT CAUSE LAG WHEN PUSHING A PAGE ON THE STACK z: 200
function findStackView(startingItem) {
var myStack = startingItem
while (myStack) {
if (myStack.hasOwnProperty("currentItem") && myStack.hasOwnProperty("initialItem"))
return myStack
myStack = myStack.parent
}
return null
}
Rectangle { onOpeningStateChanged: {
id: backButton // When fully closed, reset the current page
width: opacity ? 60 : 0 if (openingState !== 0)
anchors.left: parent.left return
anchors.leftMargin: 20
//check if Stack.view has already been initialized as well
opacity: (pageStack && (pageStack.depth > 1)) ? 1 : 0
anchors.verticalCenter: parent.verticalCenter
antialiasing: true
height: 60
radius: 4
color: backmouse.pressed ? "#222" : "transparent"
Behavior on opacity { NumberAnimation{} }
Image {
anchors.verticalCenter: parent.verticalCenter
source: "images/navigation_previous_item.png"
}
MouseArea {
id: backmouse
anchors.fill: parent
anchors.margins: -10
onClicked: pageStack.pop()
}
}
Label { // Focus the switcher if any applications are running, otherwise the launcher
font.pixelSize: 42 if (switcher.runningAppsCount > 0) {
Behavior on x { NumberAnimation { easing.type: Easing.OutCubic } } pager.currentIndex = 2
x: backButton.x + backButton.width + 20 } else {
anchors.verticalCenter: parent.verticalCenter pager.currentIndex = 1
text: parent.title
} }
} }
} }
} }
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