summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastiangottfried@web.de>2015-07-15 07:16:18 (GMT)
committerSebastian Gottfried <sebastiangottfried@web.de>2015-07-15 07:16:18 (GMT)
commiteabbca36b73508d8394d0e4c51b9d59fc34be4b3 (patch)
treeb0e2b70c34179f23492c7305242e97f824b3bb97
parent69db84d929577877a25035ad01e4a6c8c565bbc2 (diff)
Qt5: Port StatBox and friends
-rw-r--r--images/CMakeLists.txt16
-rw-r--r--images/accuracymeter-background.pngbin0 -> 1611 bytes
-rw-r--r--images/accuracymeter-hand.pngbin0 -> 666 bytes
-rw-r--r--images/accuracymeter-scale.pngbin0 -> 892 bytes
-rw-r--r--images/accuracymeter.svgzbin3907 -> 3754 bytes
-rw-r--r--images/charactersperminutemeter-background.pngbin0 -> 1611 bytes
-rw-r--r--images/charactersperminutemeter-hand.pngbin0 -> 666 bytes
-rw-r--r--images/charactersperminutemeter-scale.pngbin0 -> 1063 bytes
-rw-r--r--images/charactersperminutemeter.svgzbin4128 -> 3954 bytes
-rw-r--r--images/elapsedtimemeter-background.pngbin0 -> 3838 bytes
-rw-r--r--images/elapsedtimemeter-minute-hand.pngbin0 -> 349 bytes
-rw-r--r--images/elapsedtimemeter-second-hand.pngbin0 -> 454 bytes
-rw-r--r--images/elapsedtimemeter.svgzbin4319 -> 4036 bytes
-rw-r--r--images/meterbox-left.pngbin0 -> 362 bytes
-rw-r--r--images/meterbox-right.pngbin0 -> 326 bytes
-rw-r--r--images/meterbox.svgzbin2374 -> 1528 bytes
-rw-r--r--src/qml/AccuracyMeter.qml43
-rw-r--r--src/qml/CharactersPerMinuteMeter.qml41
-rw-r--r--src/qml/ElapsedTimeMeter.qml56
-rw-r--r--src/qml/Meter.qml56
-rw-r--r--src/qml/StatBox.qml12
-rw-r--r--src/qml/TrainingScreen.qml2
22 files changed, 86 insertions, 140 deletions
diff --git a/images/CMakeLists.txt b/images/CMakeLists.txt
index d08dd75..99bf298 100644
--- a/images/CMakeLists.txt
+++ b/images/CMakeLists.txt
@@ -1,8 +1,16 @@
set(image_files
- accuracymeter.svgz
- charactersperminutemeter.svgz
- elapsedtimemeter.svgz
+ accuracymeter-background.png
+ accuracymeter-scale.png
+ accuracymeter-hand.png
+ charactersperminutemeter-background.png
+ charactersperminutemeter-scale.png
+ charactersperminutemeter-hand.png
+ elapsedtimemeter-background.png
+ elapsedtimemeter-minute-hand.png
+ elapsedtimemeter-second-hand.png
meterbox.svgz
+ meterbox-left.png
+ meterbox-right.png
resizegrip.svgz
statusled.svgz
trainingscreen.svgz
@@ -13,4 +21,4 @@ set(image_files
trainingscreen-viewport-shadow.png
)
-install( FILES ${image_files} DESTINATION ${DATA_INSTALL_DIR}/ktouch/images)
+install(FILES ${image_files} DESTINATION ${DATA_INSTALL_DIR}/ktouch/images)
diff --git a/images/accuracymeter-background.png b/images/accuracymeter-background.png
new file mode 100644
index 0000000..8beef10
--- /dev/null
+++ b/images/accuracymeter-background.png
Binary files differ
diff --git a/images/accuracymeter-hand.png b/images/accuracymeter-hand.png
new file mode 100644
index 0000000..7c43b8c
--- /dev/null
+++ b/images/accuracymeter-hand.png
Binary files differ
diff --git a/images/accuracymeter-scale.png b/images/accuracymeter-scale.png
new file mode 100644
index 0000000..f7d7738
--- /dev/null
+++ b/images/accuracymeter-scale.png
Binary files differ
diff --git a/images/accuracymeter.svgz b/images/accuracymeter.svgz
index 1644563..fa9f5ec 100644
--- a/images/accuracymeter.svgz
+++ b/images/accuracymeter.svgz
Binary files differ
diff --git a/images/charactersperminutemeter-background.png b/images/charactersperminutemeter-background.png
new file mode 100644
index 0000000..8beef10
--- /dev/null
+++ b/images/charactersperminutemeter-background.png
Binary files differ
diff --git a/images/charactersperminutemeter-hand.png b/images/charactersperminutemeter-hand.png
new file mode 100644
index 0000000..7c43b8c
--- /dev/null
+++ b/images/charactersperminutemeter-hand.png
Binary files differ
diff --git a/images/charactersperminutemeter-scale.png b/images/charactersperminutemeter-scale.png
new file mode 100644
index 0000000..8027961
--- /dev/null
+++ b/images/charactersperminutemeter-scale.png
Binary files differ
diff --git a/images/charactersperminutemeter.svgz b/images/charactersperminutemeter.svgz
index c38cfde..3022909 100644
--- a/images/charactersperminutemeter.svgz
+++ b/images/charactersperminutemeter.svgz
Binary files differ
diff --git a/images/elapsedtimemeter-background.png b/images/elapsedtimemeter-background.png
new file mode 100644
index 0000000..446601b
--- /dev/null
+++ b/images/elapsedtimemeter-background.png
Binary files differ
diff --git a/images/elapsedtimemeter-minute-hand.png b/images/elapsedtimemeter-minute-hand.png
new file mode 100644
index 0000000..f97d436
--- /dev/null
+++ b/images/elapsedtimemeter-minute-hand.png
Binary files differ
diff --git a/images/elapsedtimemeter-second-hand.png b/images/elapsedtimemeter-second-hand.png
new file mode 100644
index 0000000..902ef9b
--- /dev/null
+++ b/images/elapsedtimemeter-second-hand.png
Binary files differ
diff --git a/images/elapsedtimemeter.svgz b/images/elapsedtimemeter.svgz
index da9d7fe..13809e5 100644
--- a/images/elapsedtimemeter.svgz
+++ b/images/elapsedtimemeter.svgz
Binary files differ
diff --git a/images/meterbox-left.png b/images/meterbox-left.png
new file mode 100644
index 0000000..fa315b6
--- /dev/null
+++ b/images/meterbox-left.png
Binary files differ
diff --git a/images/meterbox-right.png b/images/meterbox-right.png
new file mode 100644
index 0000000..eae2aeb
--- /dev/null
+++ b/images/meterbox-right.png
Binary files differ
diff --git a/images/meterbox.svgz b/images/meterbox.svgz
index ed63cdc..e41a303 100644
--- a/images/meterbox.svgz
+++ b/images/meterbox.svgz
Binary files differ
diff --git a/src/qml/AccuracyMeter.qml b/src/qml/AccuracyMeter.qml
index d4e7f44..e3658df 100644
--- a/src/qml/AccuracyMeter.qml
+++ b/src/qml/AccuracyMeter.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,9 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.0
-import org.kde.plasma.core 0.1 as PlasmaCore
-import Effects 1.0
+import QtQuick 2.4
import ktouch 1.0
Meter {
@@ -31,12 +30,10 @@ Meter {
referenceValue: strFormatter.formatAccuracyDiff(meter.referenceAccuracy, meter.accuracy)
valueStatus: Math.round(1000 * meter.accuracy) >= Math.round(10 * preferences.requiredAccuracy)? "good": "bad"
- analogPartContent: PlasmaCore.SvgItem {
+ analogPartContent: Image {
anchors.centerIn: parent
- svg: clockSvg
- elementId: "background"
- width: naturalSize.width
- height: naturalSize.height
+ source: utils.findImage("accuracymeter-background.png")
+
ScaleBackgroundItem {
anchors.centerIn: parent
anchors.verticalCenterOffset: 25
@@ -48,14 +45,11 @@ Meter {
color: "#88ff00";
}
- PlasmaCore.SvgItem {
+ Image {
id: scale
anchors.centerIn: parent
anchors.verticalCenterOffset: 25
- svg: clockSvg
- elementId: "scale"
- width: naturalSize.width
- height: naturalSize.height
+ source: utils.findImage("accuracymeter-scale.png")
}
Text {
@@ -78,24 +72,14 @@ Meter {
font.pixelSize: 10
}
- PlasmaCore.SvgItem {
+ Image {
id: hand
anchors.centerIn: parent
anchors.verticalCenterOffset: 25
- svg: clockSvg
- elementId: "hand"
- width: naturalSize.width
- height: naturalSize.height
- smooth: true
- effect: DropShadow {
- color: "#000000"
- blurRadius: 5
- xOffset: 0
- yOffset: 0
- }
+ source: utils.findImage("accuracymeter-hand.png")
transform: Rotation {
- origin.x: hand.naturalSize.width / 2
- origin.y: hand.naturalSize.height / 2
+ origin.x: hand.width / 2
+ origin.y: hand.height / 2
angle: Math.min(90, Math.max(0, accuracy - 0.9) * 900)
Behavior on angle {
SpringAnimation { spring: 2; damping: 0.2; modulus: 360; mass: 0.75}
@@ -103,9 +87,4 @@ Meter {
}
}
}
-
- PlasmaCore.Svg {
- id: clockSvg
- imagePath: findImage("accuracymeter.svgz")
- }
}
diff --git a/src/qml/CharactersPerMinuteMeter.qml b/src/qml/CharactersPerMinuteMeter.qml
index 801cf9d..df01d41 100644
--- a/src/qml/CharactersPerMinuteMeter.qml
+++ b/src/qml/CharactersPerMinuteMeter.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,9 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.0
-import org.kde.plasma.core 0.1 as PlasmaCore
-import Effects 1.0
+import QtQuick 2.4
import ktouch 1.0
Meter {
@@ -34,12 +33,9 @@ Meter {
referenceValue: strFormatter.formatSign(diff) + " " + (diff > 0? diff: -diff)
valueStatus: meter.charactersPerMinute >= minimumCharactersPerMinute? "good": "bad"
- analogPartContent: PlasmaCore.SvgItem {
+ analogPartContent: Image {
anchors.centerIn: parent
- svg: meterSvg
- elementId: "background"
- width: naturalSize.width
- height: naturalSize.height
+ source: utils.findImage("charactersperminutemeter-background.png")
ScaleBackgroundItem {
anchors.centerIn: parent
@@ -52,14 +48,11 @@ Meter {
color: "#88ff00";
}
- PlasmaCore.SvgItem {
+ Image {
id: scale
anchors.centerIn: parent
anchors.verticalCenterOffset: 25
- svg: meterSvg
- elementId: "scale"
- width: naturalSize.width
- height: naturalSize.height
+ source: utils.findImage("charactersperminutemeter-scale.png")
}
Text {
@@ -82,24 +75,15 @@ Meter {
font.pixelSize: 10
}
- PlasmaCore.SvgItem {
+ Image {
id: hand
anchors.centerIn: parent
anchors.verticalCenterOffset: 25
- svg: meterSvg
- elementId: "hand"
- width: naturalSize.width
- height: naturalSize.height
+ source: utils.findImage("charactersperminutemeter-hand.png")
smooth: true
- effect: DropShadow {
- color: "#000000"
- blurRadius: 5
- xOffset: 0
- yOffset: 0
- }
transform: Rotation {
- origin.x: hand.naturalSize.width / 2
- origin.y: hand.naturalSize.height / 2
+ origin.x: hand.width / 2
+ origin.y: hand.height / 2
angle: Math.min(90, charactersPerMinute * 90 / 360)
Behavior on angle {
SpringAnimation { spring: 2; damping: 0.2; modulus: 360; mass: 0.75}
@@ -107,9 +91,4 @@ Meter {
}
}
}
-
- PlasmaCore.Svg {
- id: meterSvg
- imagePath: findImage("charactersperminutemeter.svgz")
- }
}
diff --git a/src/qml/ElapsedTimeMeter.qml b/src/qml/ElapsedTimeMeter.qml
index 71c3fbd..052a717 100644
--- a/src/qml/ElapsedTimeMeter.qml
+++ b/src/qml/ElapsedTimeMeter.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,9 +16,7 @@
* 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 Effects 1.0
+import QtQuick 2.4
import ktouch 1.0
Meter {
@@ -31,64 +30,37 @@ Meter {
referenceValue: strFormatter.formatTimeDiff(meter.referenceElapsedTime, meter.elapsedTime)
positiveDiffIsGood: false
- analogPartContent: PlasmaCore.SvgItem {
+ analogPartContent: Image {
anchors.centerIn: parent
- svg: clockSvg
- elementId: "background"
- width: naturalSize.width
- height: naturalSize.height
+ source: utils.findImage("elapsedtimemeter-background.png")
- PlasmaCore.SvgItem {
+ Image {
id: minuteHand
anchors.centerIn: parent
- svg: clockSvg
- elementId: "minute-hand"
- width: naturalSize.width
- height: naturalSize.height
+ source: utils.findImage("elapsedtimemeter-minute-hand.png")
smooth: true
- effect: DropShadow {
- color: "#000000"
- blurRadius: 5
- xOffset: 0
- yOffset: 0
- }
transform: Rotation {
- origin.x: minuteHand.naturalSize.width / 2
- origin.y: minuteHand.naturalSize.height / 2
- angle: elapsedTime? 6 * getMinutesOfQTime(elapsedTime): 0
+ origin.x: minuteHand.width / 2
+ origin.y: minuteHand.height / 2
+ angle: elapsedTime? 6 * utils.getMinutesOfQTime(elapsedTime): 0
Behavior on angle {
SpringAnimation { spring: 2; damping: 0.2; modulus: 360; mass: 0.75}
}
}
}
- PlasmaCore.SvgItem {
+ Image {
id: secondHand
anchors.centerIn: parent
- svg: clockSvg
- elementId: "second-hand"
- width: naturalSize.width
- height: naturalSize.height
- smooth: true
- effect: DropShadow {
- color: "#000000"
- blurRadius: 5
- xOffset: 0
- yOffset: 0
- }
+ source: utils.findImage("elapsedtimemeter-second-hand.png")
transform: Rotation {
- origin.x: secondHand.naturalSize.width / 2
- origin.y: secondHand.naturalSize.height / 2
- angle: elapsedTime? 6 * getSecondsOfQTime(elapsedTime): 0
+ origin.x: secondHand.width / 2
+ origin.y: secondHand.height / 2
+ angle: elapsedTime? 6 * utils.getSecondsOfQTime(elapsedTime): 0
Behavior on angle {
SpringAnimation { spring: 2; damping: 0.2; modulus: 360; mass: 0.75}
}
}
}
}
-
- PlasmaCore.Svg {
- id: clockSvg
- imagePath: findImage("elapsedtimemeter.svgz")
- }
}
diff --git a/src/qml/Meter.qml b/src/qml/Meter.qml
index ba5156e..5b197e1 100644
--- a/src/qml/Meter.qml
+++ b/src/qml/Meter.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,10 +16,10 @@
* 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.Layouts 1.1
-Row {
+RowLayout {
id: meter
property alias label: label.text
@@ -30,21 +31,32 @@ Row {
height: 112
width: 304
+ spacing: 0
- PlasmaCore.FrameSvgItem {
+ BorderImage {
id: analogPart
- width: height
- height: parent.height
- imagePath: findImage("meterbox.svgz")
- prefix: "analog"
+ Layout.preferredWidth: height
+ Layout.fillHeight: true
+ border {
+ left: 6
+ top: 6
+ right:6
+ bottom: 6
+ }
+ source: utils.findImage("meterbox-left.png")
}
- PlasmaCore.FrameSvgItem {
+ BorderImage {
id: digitalPart
- width: parent.width - analogPart.width
- height: parent.height
- imagePath: findImage("meterbox.svgz")
- prefix: "digital"
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ border {
+ left: 6
+ top: 6
+ right:6
+ bottom: 6
+ }
+ source: utils.findImage("meterbox-right.png")
Column {
anchors {
@@ -55,7 +67,7 @@ Row {
rightMargin: 12
}
- spacing: 8
+ spacing: 0
Row {
width: parent.width
@@ -69,19 +81,15 @@ Row {
elide: Text.ElideRight
}
- PlasmaCore.SvgItem {
+ Rectangle {
id: statusLed
- anchors.verticalCenter: parent.verticalCenter
- height: naturalSize.height
- width: naturalSize.width
+ height: 15
+ width: 15
+ radius: height / 2
visible: valueStatus !== "none"
- elementId: valueStatus === "good"? "led-good": "led-bad"
- svg: PlasmaCore.Svg {
- imagePath: findImage("statusled.svgz")
- }
- smooth: true
+ color: valueStatus === "good"? "#88ff00": "#424b35"
- onElementIdChanged: statusLedAnimaton.restart()
+ onColorChanged: statusLedAnimaton.restart()
SequentialAnimation {
id: statusLedAnimaton
diff --git a/src/qml/StatBox.qml b/src/qml/StatBox.qml
index e982733..d5277da 100644
--- a/src/qml/StatBox.qml
+++ b/src/qml/StatBox.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,10 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
+import QtQuick 2.4
+import QtQuick.Layouts 1.1
import ktouch 1.0
-Row {
+RowLayout {
property TrainingStats stats
property TrainingStats referenceStats
@@ -27,21 +29,21 @@ Row {
ElapsedTimeMeter {
id: elapsedTimeMeter
- width: Math.floor((parent.width - 2 * parent.spacing) / 3)
+ Layout.fillWidth: true
elapsedTime: stats.elapsedTime
referenceElapsedTime: referenceStats.isValid? referenceStats.elapsedTime: stats.elapsedTime
}
CharactersPerMinuteMeter {
id: charactersPerMinuteMeter
- width: elapsedTimeMeter.width
+ Layout.fillWidth: true
charactersPerMinute: stats.charactersPerMinute
referenceCharactersPerMinute: referenceStats.isValid? referenceStats.charactersPerMinute: stats.charactersPerMinute
}
AccuracyMeter {
id: accuracyMeter
- width: parent.width - 2 * (elapsedTimeMeter.width + parent.spacing)
+ Layout.fillWidth: true
accuracy: stats.accuracy
referenceAccuracy: referenceStats.isValid? referenceStats.accuracy: stats.accuracy
}
diff --git a/src/qml/TrainingScreen.qml b/src/qml/TrainingScreen.qml
index 997ee69..db0b4e7 100644
--- a/src/qml/TrainingScreen.qml
+++ b/src/qml/TrainingScreen.qml
@@ -159,14 +159,12 @@ FocusScope {
source: utils.findImage("trainingscreen-header.png")
cache: false
- /*
StatBox {
anchors.centerIn: parent
width: parent.width - 60
stats: stats
referenceStats: referenceStats
}
- */
}