aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastiangottfried@web.de>2015-06-30 08:20:16 (GMT)
committerSebastian Gottfried <sebastiangottfried@web.de>2015-06-30 08:20:16 (GMT)
commit8e0bf167200ae4de8716e21b7f7f3ba1d2e8b244 (patch)
treeb3db8c6341d62c417016e63deafec961245c4916
parent9d52d514099709568f72929b692b4d5dec58f198 (diff)
Qt5: Port TrainingScreen.qml
To get rid of the Plasma Components dependency here, it was necessary to convert the SVG background to a set of small PNG files. With them it is possible to use BorderImage instead of FrameSvgItem.
-rw-r--r--images/CMakeLists.txt5
-rw-r--r--images/trainingscreen-footer.pngbin0 -> 80 bytes
-rw-r--r--images/trainingscreen-header.pngbin0 -> 80 bytes
-rw-r--r--images/trainingscreen-toolbar.pngbin0 -> 84 bytes
-rw-r--r--images/trainingscreen-viewport-shadow.pngbin0 -> 92 bytes
-rw-r--r--images/trainingscreen-viewport.pngbin0 -> 80 bytes
-rw-r--r--src/qml/TrainingScreen.qml108
-rw-r--r--src/qml/main.qml8
8 files changed, 80 insertions, 41 deletions
diff --git a/images/CMakeLists.txt b/images/CMakeLists.txt
index 20b89b1..d08dd75 100644
--- a/images/CMakeLists.txt
+++ b/images/CMakeLists.txt
@@ -6,6 +6,11 @@ set(image_files
resizegrip.svgz
statusled.svgz
trainingscreen.svgz
+ trainingscreen-footer.png
+ trainingscreen-header.png
+ trainingscreen-toolbar.png
+ trainingscreen-viewport.png
+ trainingscreen-viewport-shadow.png
)
install( FILES ${image_files} DESTINATION ${DATA_INSTALL_DIR}/ktouch/images)
diff --git a/images/trainingscreen-footer.png b/images/trainingscreen-footer.png
new file mode 100644
index 0000000..bbd9b0d
--- /dev/null
+++ b/images/trainingscreen-footer.png
Binary files differ
diff --git a/images/trainingscreen-header.png b/images/trainingscreen-header.png
new file mode 100644
index 0000000..bbd9b0d
--- /dev/null
+++ b/images/trainingscreen-header.png
Binary files differ
diff --git a/images/trainingscreen-toolbar.png b/images/trainingscreen-toolbar.png
new file mode 100644
index 0000000..5e056e2
--- /dev/null
+++ b/images/trainingscreen-toolbar.png
Binary files differ
diff --git a/images/trainingscreen-viewport-shadow.png b/images/trainingscreen-viewport-shadow.png
new file mode 100644
index 0000000..15850ba
--- /dev/null
+++ b/images/trainingscreen-viewport-shadow.png
Binary files differ
diff --git a/images/trainingscreen-viewport.png b/images/trainingscreen-viewport.png
new file mode 100644
index 0000000..45bd642
--- /dev/null
+++ b/images/trainingscreen-viewport.png
Binary files differ
diff --git a/src/qml/TrainingScreen.qml b/src/qml/TrainingScreen.qml
index 8628dee..4b2597b 100644
--- a/src/qml/TrainingScreen.qml
+++ b/src/qml/TrainingScreen.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2013 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,8 +16,9 @@
* 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 QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
import ktouch 1.0
FocusScope {
@@ -119,48 +121,67 @@ FocusScope {
id: referenceStats
}
- PlasmaCore.Svg {
- id: screenSvg
- imagePath: findImage("trainingscreen.svgz")
- usingRenderingCache: false
- }
- Column {
+ ColumnLayout {
anchors.fill: parent
-
- TrainingScreenToolbar {
- id: toolbar
- height: 29
- width: parent.width
- trainingStarted: screen.trainingStarted
- trainingFinished: screen.trainingFinished
- stats: stats
- menuOverlayItem: menuOverlay
+ spacing: 0
+ BorderImage {
+ Layout.fillWidth: true
+ Layout.preferredHeight: 29
+ border {
+ top: 1
+ bottom: 1
+ }
+ cache: false
+ source: utils.findImage("trainingscreen-toolbar.png")
+ horizontalTileMode: BorderImage.Repeat
+ verticalTileMode: BorderImage.Repeat
+ /*
+ TrainingScreenToolbar {
+ id: toolbar
+ trainingStarted: screen.trainingStarted
+ trainingFinished: screen.trainingFinished
+ stats: stats
+ menuOverlayItem: menuOverlay
+ }
+ */
}
- PlasmaCore.SvgItem {
+ BorderImage {
id: header
- svg: screenSvg
- elementId: "header"
- width: parent.width
+ Layout.fillWidth: true
+ Layout.preferredHeight: visible? 130: 0
visible: preferences.showStatistics
- height: visible? 130: 0
+ border {
+ top: 1
+ bottom: 1
+ }
+ source: utils.findImage("trainingscreen-header.png")
+ cache: false
+ /*
StatBox {
anchors.centerIn: parent
width: parent.width - 60
stats: stats
referenceStats: referenceStats
}
+ */
}
- PlasmaCore.SvgItem {
+
+ BorderImage {
id: body
- width: parent.width
- height: parent.height - toolbar.height - header.height - footer.height
- svg: screenSvg
- elementId: "content"
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ border {
+ top: 1
+ bottom: 1
+ }
+ source: utils.findImage("trainingscreen-viewport.png")
+ cache: false
+ /*
TrainingWidget {
id: trainingWidget
anchors.fill: parent
@@ -178,26 +199,40 @@ FocusScope {
screen.trainingFinished = true
}
}
+ */
- PlasmaCore.FrameSvgItem {
+ BorderImage {
anchors.fill: parent
- imagePath: findImage("trainingscreen.svgz")
- prefix: "content-shadow"
+ border {
+ top: 3
+ bottom: 3
+ }
+ source: utils.findImage("trainingscreen-viewport-shadow.png")
+ cache: false
+
}
+
}
- PlasmaCore.SvgItem {
+ BorderImage {
id: footer
- width: parent.width
visible: preferences.showKeyboard
+ Layout.fillWidth: true
+ Layout.preferredHeight: 100
+ /*
height: visible?
screen.keyboardLayout.isValid?
Math.round(Math.min((parent.height - toolbar.height - header.height) / 2, parent.width / keyboard.aspectRatio)):
keyboardUnavailableNotice.height:
0
- svg: screenSvg
- elementId: "footer"
-
+ */
+ border {
+ top: 1
+ bottom: 1
+ }
+ source: utils.findImage("trainingscreen-footer.png")
+ cache: false
+ /*
Keyboard {
id: keyboard
@@ -267,6 +302,7 @@ FocusScope {
id: keyboardUnavailableNotice
visible: !screen.keyboardLayout.isValid
}
+ */
}
}
@@ -275,6 +311,7 @@ FocusScope {
anchors.fill: parent
}
+ /*
TrainingScreenMenuOverlay {
id: menuOverlay
anchors.fill: parent
@@ -286,4 +323,5 @@ FocusScope {
onRestartRequested: screen.restartRequested()
onAbortRequested: screen.abortRequested()
}
+ */
}
diff --git a/src/qml/main.qml b/src/qml/main.qml
index 69e4537..13aef59 100644
--- a/src/qml/main.qml
+++ b/src/qml/main.qml
@@ -38,10 +38,6 @@ Rectangle {
id: dataAccess
}
- Text {
- text: ktouch.globalDataIndex.courseCount
- }
-
QtObject {
id: helper
property string name: ktouch.keyboardLayoutName
@@ -134,7 +130,6 @@ Rectangle {
focus: true
onLessonSelected: {
trainingScreen.profile = profile
- scoreScreen.profile = profile
var lessonIndex = -1;
for (var i = 0; i < course.lessonCount; i++) {
if (lesson === course.lesson(i)) {
@@ -160,7 +155,6 @@ Rectangle {
}
}
- /*
TrainingScreen {
id: trainingScreen
anchors.fill: parent
@@ -172,6 +166,7 @@ Rectangle {
onAbortRequested: main.switchScreen(trainingScreen, homeScreen)
onFinished: main.switchScreen(trainingScreen, scoreScreen)
}
+ /*
ScoreScreen {
id: scoreScreen
@@ -180,6 +175,7 @@ Rectangle {
course: trainingScreen.course
lesson: trainingScreen.lesson
stats: trainingScreen.stats
+ profile: trainingScreen.profile
referenceStats: trainingScreen.referenceStats
onHomeScreenRequested: main.switchScreen(scoreScreen, homeScreen)
onLessonRepetionRequested: main.switchScreen(scoreScreen, trainingScreen)