From b3476f1c2debc23411a66b1498065ab575879e22 Mon Sep 17 00:00:00 2001 From: wang_zhiqiang Date: Tue, 13 Nov 2018 15:54:13 +0800 Subject: add fullscreen¬ification&information function Change-Id: I33b355c78d5abe6bf4a8a60350cf6e7f4f78e0f7 --- homescreen/qml/main.qml | 183 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) (limited to 'homescreen/qml/main.qml') diff --git a/homescreen/qml/main.qml b/homescreen/qml/main.qml index 96a1950..164cbf7 100644 --- a/homescreen/qml/main.qml +++ b/homescreen/qml/main.qml @@ -26,6 +26,7 @@ Window { width: container.width * container.scale height: container.height * container.scale title: 'HomeScreen' + color: "#00000000" Image { id: container @@ -60,5 +61,187 @@ Window { Layout.preferredHeight: 215 } } + + states: [ + State { + name: "normal" + PropertyChanges { + target: topArea + y: 0 + } + PropertyChanges { + target: applicationArea + y: 218 + } + PropertyChanges { + target: mediaArea + y: 1705 + } + }, + State { + name: "fullscreen" + PropertyChanges { + target: topArea + y: -220 + } + PropertyChanges { + target: applicationArea + y: -1490 + } + PropertyChanges { + target: mediaArea + y: 2135 + } + } + ] + transitions: Transition { + NumberAnimation { + target: topArea + property: "y" + easing.type: "OutQuad" + duration: 250 + } + NumberAnimation { + target: mediaArea + property: "y" + easing.type: "OutQuad" + duration: 250 + } + } + } + + Item { + id: switchBtn + anchors.right: parent.right + anchors.rightMargin: 20 + anchors.top: parent.top + anchors.topMargin: 25 + width: 35 + height: 35 + z: 1 + + MouseArea { + anchors.fill: parent + property string btnState: 'normal' + Image { + id: image + anchors.fill: parent + source: './images/normal.png' + } + onClicked: { + var appName = homescreenHandler.getCurrentApplication() + if (btnState === 'normal') { + image.source = './images/fullscreen.png' + btnState = 'fullscreen' + container.state = 'fullscreen' + touchArea.switchArea(1) + homescreenHandler.tapShortcut(appName, true) + if (appName === 'navigation' || appName === 'browser') { + container.opacity = 0.0 + } + } else { + image.source = './images/normal.png' + btnState = 'normal' + container.state = 'normal' + touchArea.switchArea(0) + homescreenHandler.tapShortcut(appName, false) + if (appName === 'navigation' || appName === 'browser') { + container.opacity = 1.0 + } + } + } + } + } + + Timer { + id:informationTimer + interval: 3000 + running: false + repeat: true + onTriggered: { + bottomInformation.visible = false + } + } + + Item { + id: bottomInformation + width: parent.width + height: 215 + anchors.bottom: parent.bottom + visible: false + Text { + id: bottomText + anchors.centerIn: parent + font.pixelSize: 25 + font.letterSpacing: 5 + horizontalAlignment: Text.AlignHCenter + color: "white" + text: "" + z:1 + } + } + + Connections { + target: homescreenHandler + onShowInformation: { + bottomText.text = info + bottomInformation.visible = true + informationTimer.restart() + } + } + + Timer { + id:notificationTimer + interval: 3000 + running: false + repeat: true + onTriggered: notificationItem.visible = false + } + + Item { + id: notificationItem + x: 0 + y: 0 + z: 1 + width: 1280 + height: 100 + opacity: 0.8 + visible: false + + Rectangle { + width: parent.width + height: parent.height + anchors.fill: parent + color: "gray" + Image { + id: notificationIcon + width: 70 + height: 70 + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.verticalCenter: parent.verticalCenter + source: "" + } + + Text { + id: notificationtext + font.pixelSize: 25 + anchors.left: notificationIcon.right + anchors.leftMargin: 5 + anchors.verticalCenter: parent.verticalCenter + color: "white" + text: qsTr("") + } + } + } + + Connections { + target: homescreenHandler + onShowNotification: { + notificationIcon.source = icon_path + notificationtext.text = text + notificationItem.visible = true + notificationTimer.restart() + } } } -- cgit 1.2.3-korg