aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastiangottfried@web.de>2015-07-20 08:01:46 (GMT)
committerSebastian Gottfried <sebastiangottfried@web.de>2015-07-20 08:01:46 (GMT)
commit21572d960420523e4ca8e19bb7600cd6b553c16d (patch)
tree2f1b422aca53a73800499c31eb864f578e63505a
parent8d0c4fc8ef114ed47badd63e0b76d37dc55dce15 (diff)
Qt5: Port TrainingScreenMenuOverlay
Training screen completed.
-rw-r--r--src/qml/TrainingScreen.qml4
-rw-r--r--src/qml/TrainingScreenMenuOverlay.qml101
2 files changed, 45 insertions, 60 deletions
diff --git a/src/qml/TrainingScreen.qml b/src/qml/TrainingScreen.qml
index db0b4e7..19c80b4 100644
--- a/src/qml/TrainingScreen.qml
+++ b/src/qml/TrainingScreen.qml
@@ -123,6 +123,7 @@ FocusScope {
ColumnLayout {
+ id: screenContent
anchors.fill: parent
spacing: 0
BorderImage {
@@ -302,9 +303,9 @@ FocusScope {
anchors.fill: parent
}
- /*
TrainingScreenMenuOverlay {
id: menuOverlay
+ blurSource: screenContent
anchors.fill: parent
onVisibleChanged: {
if (!visible) {
@@ -314,5 +315,4 @@ FocusScope {
onRestartRequested: screen.restartRequested()
onAbortRequested: screen.abortRequested()
}
- */
}
diff --git a/src/qml/TrainingScreenMenuOverlay.qml b/src/qml/TrainingScreenMenuOverlay.qml
index 2aaacfb..84d77f1 100644
--- a/src/qml/TrainingScreenMenuOverlay.qml
+++ b/src/qml/TrainingScreenMenuOverlay.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,26 +16,48 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
+import QtGraphicalEffects 1.0
+import ktouch 1.0
Item {
id: item
+ property alias blurSource: effectSource.sourceItem
+
signal restartRequested()
signal abortRequested()
- visible: false
opacity: 0
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 300
+ easing.type: Easing.InOutQuad
+ }
+ }
+
function show() {
- focusScope.forceActiveFocus()
- fadeInAnimation.start()
+ item.opacity = 1
+ groupBox.forceActiveFocus()
}
function hide() {
- fadeOutAnimation.start()
+ item.opacity = 0
+ }
+
+ ShaderEffectSource {
+ id: effectSource
+ anchors.fill: parent
+ hideSource: false
+ }
+
+ FastBlur {
+ anchors.fill: parent
+ source: effectSource
+ radius: 25
}
Rectangle {
@@ -45,41 +68,35 @@ Item {
/* swallow all mouse events */
MouseArea {
anchors.fill: parent
+ enabled: item.opacity > 0
hoverEnabled: true
}
- FocusScope {
- id: focusScope
- anchors.centerIn: parent
-
- PlasmaCore.FrameSvgItem {
- id: frame
- anchors.centerIn: parent
- imagePath: "widgets/frame"
- prefix: "raised"
- width: column.width + frame.margins.left + frame.margins.right + 30
- height: column.height + frame.margins.top + frame.margins.bottom + 30
- }
+ GroupBox {
+ id: groupBox
+ anchors.centerIn: parent
+ width: column.width + 30
+ height: column.height + 30
Column {
id: column
+ focus: true
anchors.centerIn: parent
spacing: 15
width: Math.max(resumeButton.implicitWidth, restartButton.implicitWidth, returnButton.implicitWidth)
- PlasmaComponents.Button {
- focus: true
+ Button {
id: resumeButton
- iconSource: "go-next-view"
+ iconName: "go-next-view"
text: i18n("Resume Training")
width: parent.width
onClicked: hide()
}
- PlasmaComponents.Button {
+ Button {
id: restartButton
- iconSource: "view-refresh"
+ iconName: "view-refresh"
text: i18n("Restart Lesson")
width: parent.width
onClicked: {
@@ -88,9 +105,9 @@ Item {
}
}
- PlasmaComponents.Button {
+ Button {
id: returnButton
- iconSource: "go-home"
+ iconName: "go-home"
text: i18n("Return to Home Screen")
width: parent.width
onClicked: {
@@ -118,36 +135,4 @@ Item {
}
}
}
-
- SequentialAnimation {
- id: fadeInAnimation
- PropertyAction {
- target: item
- property: "visible"
- value: true
- }
- NumberAnimation {
- target: item
- property: "opacity"
- to: 1
- duration: 300
- easing.type: Easing.InOutQuad
- }
- }
-
- SequentialAnimation {
- id: fadeOutAnimation
- NumberAnimation {
- target: item
- property: "opacity"
- to: 0
- duration: 300
- easing.type: Easing.InOutQuad
- }
- PropertyAction {
- target: item
- property: "visible"
- value: false
- }
- }
}