commit 6eaf235e94ad018e72573ca20e45a366a04e5e3d Author: Dorian Zedler Date: Tue Jul 17 19:17:25 2018 +0200 Initial commit diff --git a/OFFICAL_IFSC_STARTIGNAL.wav b/OFFICAL_IFSC_STARTIGNAL.wav new file mode 100644 index 0000000..b3aa454 Binary files /dev/null and b/OFFICAL_IFSC_STARTIGNAL.wav differ diff --git a/android-sources/AndroidManifest.xml b/android-sources/AndroidManifest.xml new file mode 100644 index 0000000..dec7ea3 --- /dev/null +++ b/android-sources/AndroidManifest.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android-sources/AndroidManifest_old.xml b/android-sources/AndroidManifest_old.xml new file mode 100644 index 0000000..c9d943e --- /dev/null +++ b/android-sources/AndroidManifest_old.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android-sources/res/drawable-hdpi/icon.png b/android-sources/res/drawable-hdpi/icon.png new file mode 100644 index 0000000..6049370 Binary files /dev/null and b/android-sources/res/drawable-hdpi/icon.png differ diff --git a/android-sources/res/drawable-ldpi/icon.png b/android-sources/res/drawable-ldpi/icon.png new file mode 100644 index 0000000..6049370 Binary files /dev/null and b/android-sources/res/drawable-ldpi/icon.png differ diff --git a/android-sources/res/drawable-mdpi/icon.png b/android-sources/res/drawable-mdpi/icon.png new file mode 100644 index 0000000..6049370 Binary files /dev/null and b/android-sources/res/drawable-mdpi/icon.png differ diff --git a/graphics/Banner.png b/graphics/Banner.png new file mode 100644 index 0000000..7fc4651 Binary files /dev/null and b/graphics/Banner.png differ diff --git a/graphics/Banner.xcf b/graphics/Banner.xcf new file mode 100644 index 0000000..b166863 Binary files /dev/null and b/graphics/Banner.xcf differ diff --git a/graphics/speedclimbing_stopwatch.png b/graphics/speedclimbing_stopwatch.png new file mode 100644 index 0000000..6049370 Binary files /dev/null and b/graphics/speedclimbing_stopwatch.png differ diff --git a/graphics/speedclimbing_stopwatch.xcf b/graphics/speedclimbing_stopwatch.xcf new file mode 100644 index 0000000..05905aa Binary files /dev/null and b/graphics/speedclimbing_stopwatch.xcf differ diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..6333b85 --- /dev/null +++ b/main.cpp @@ -0,0 +1,16 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} diff --git a/main.qml b/main.qml new file mode 100644 index 0000000..a635a5a --- /dev/null +++ b/main.qml @@ -0,0 +1,163 @@ +import QtQuick 2.9 +import QtMultimedia 5.8 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.2 + +Window { + visible: true + width: 540 + height: 960 + title: qsTr("Hello World") + property date currentTime: new Date() + property int millis: 0 + + + Page { + id:root + anchors.fill: parent + + property double startTime: 0 + property double stoppedTime: 0 + property double currTime: new Date().getTime() + + Timer { + running: true + repeat: true + interval: 1 + onTriggered: { + root.currTime = new Date().getTime() + } + } + + Item { + id: time_container + anchors { + top: parent.top + left: parent.left + right: parent.right + } + height: parent.height * 0.15 + + Label { + id: time + text: "Click start to start" + + anchors.centerIn: parent + font.pixelSize: parent.height * 0.3 + } + } + + + Rectangle { + width: parent.width + height: 1 + color: "grey" + anchors.left: parent.left + anchors.top: time_container.bottom + } + + SoundEffect { + id: startSound + source: "OFFICAL_IFSC_STARTIGNAL.wav" + onPlayingChanged: { + if(!playing){ + root.startTime = new Date().getTime() + root.currTime = new Date().getTime() + time.text = ( ( root.currTime - root.startTime ) / 1000 ).toFixed(3) + " sec" + root.state = "RUNNING" + } + } + } + + Rectangle { + id: startButt + + property string text: "start" + anchors { + horizontalCenter: parent.horizontalCenter + bottom: parent.bottom + bottomMargin: parent.height * 0.5 - height * 0.5 + } + + height: parent.height - (parent.height * 0.5) + width: height + color: "white" + border.color: "grey" + border.width: 1 + radius: width / 2 + + Label { + id: startButt_text + text: parent.text + anchors.centerIn: parent + font.pixelSize: parent.height * 0.16 + font.family: "Helvetica" + } + MouseArea { + enabled: startButt.enabled + anchors.fill: parent + onPressed: parent.color = "lightgrey" + onReleased: parent.color = "white" + onClicked: { + switch(root.state) { + case "": + root.state = "IDLE" + case "IDLE": + root.state = "STARTING" + startSound.play() + break + case "RUNNING": + root.stoppedTime = new Date().getTime() - root.startTime + root.state = "STOPPED" + break + case "STOPPED": + root.state = "IDLE" + break + } + + } + } + } + states: [ + State { + name: "IDLE" + //state for the start page + PropertyChanges { target: time; text: "Click start to start"; font.pixelSize: parent.height * 0.3 } + PropertyChanges { target: time_container; height: parent.height * 0.15 } + PropertyChanges { target: startButt; enabled: true; text: "start"; height: parent.height - (parent.height * 0.5); anchors.bottomMargin: parent.height * 0.5 - height * 0.5 } + }, + State { + name: "STARTING" + //state for the start sequence + PropertyChanges { target: startButt; enabled: false; text: "starting..." } + PropertyChanges { target: time; text: "0.000 sec" } + }, + State { + name: "RUNNING" + //state when the timer is running + PropertyChanges { target: time; text: ( ( root.currTime - root.startTime ) / 1000 ).toFixed(3) + " sec" } + PropertyChanges { target: startButt; enabled: true; text: "stop" } + + }, + + State { + name: "STOPPED" + //state when the meassuring is over + PropertyChanges { target: time; text: ( root.stoppedTime / 1000 ).toFixed(3) + " sec"; font.pixelSize: parent.height * 0.1 } + PropertyChanges { target: startButt; enabled: true; text: "reset"; height: parent.height - (parent.height * 0.8); anchors.bottomMargin: parent.height * 0.2 - height * 0.5 } + PropertyChanges { target: time_container; height: parent.height * 0.8 } + } + ] + transitions: [ + Transition { + NumberAnimation { properties: "height"; easing.type: Easing.InOutQuad; duration: 200 } + NumberAnimation { properties: "bottomMargin"; easing.type: Easing.InOutQuad; duration: 200 } + NumberAnimation { properties: "font.pixelSize"; easing.type: Easing.InOutQuad; duration: 200 } + }, + Transition { + to: "moveIn" + NumberAnimation { properties: "height"; easing.type: Easing.InOutQuad; duration: 200 } + } + ] + } +} diff --git a/qml.qrc b/qml.qrc new file mode 100644 index 0000000..5f6483a --- /dev/null +++ b/qml.qrc @@ -0,0 +1,5 @@ + + + main.qml + + diff --git a/shared.qrc b/shared.qrc new file mode 100644 index 0000000..8a7ba26 --- /dev/null +++ b/shared.qrc @@ -0,0 +1,5 @@ + + + OFFICAL_IFSC_STARTIGNAL.wav + + diff --git a/speedclimbing_stopwatch.png b/speedclimbing_stopwatch.png new file mode 100644 index 0000000..ec4b891 Binary files /dev/null and b/speedclimbing_stopwatch.png differ diff --git a/speedclimbing_stopwatch.pro b/speedclimbing_stopwatch.pro new file mode 100644 index 0000000..9bf2c99 --- /dev/null +++ b/speedclimbing_stopwatch.pro @@ -0,0 +1,39 @@ +QT += quick +CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +TARGET = speedclimbing_stw + +SOURCES += \ + main.cpp + +RESOURCES += qml.qrc \ + shared.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = + +# Additional import path used to resolve QML modules just for Qt Quick Designer +QML_DESIGNER_IMPORT_PATH = + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +DISTFILES += \ + android-sources/AndroidManifest.xml + +android { + ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources +} diff --git a/speedclimbing_stopwatch.pro.user b/speedclimbing_stopwatch.pro.user new file mode 100644 index 0000000..a5439a1 --- /dev/null +++ b/speedclimbing_stopwatch.pro.user @@ -0,0 +1,655 @@ + + + + + + EnvironmentId + {21eb7c7e-fe37-4955-bdba-642d7341ba98} + + + ProjectExplorer.Project.ActiveTarget + 1 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.11.1 GCC 64bit + Desktop Qt 5.11.1 GCC 64bit + qt.qt5.5111.gcc_64_kit + 0 + 0 + 0 + + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Desktop_Qt_5_11_1_GCC_64bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Desktop_Qt_5_11_1_GCC_64bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Desktop_Qt_5_11_1_GCC_64bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy Configuration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + speedclimbing_stopwatch + + Qt4ProjectManager.Qt4RunConfiguration:/home/dorian/Documents/climbing_normspeed_stopwatch/climbing_normspeed_stopwatch/speedclimbing_stopwatch.pro + true + + speedclimbing_stopwatch.pro + false + + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Android_for_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Release + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.Target.1 + + Android for armeabi-v7a (GCC 4.9, Qt 5.11.1 for Android armv7) + Android for armeabi-v7a (GCC 4.9, Qt 5.11.1 for Android armv7) + {90080436-d11a-44c6-8604-3a0027d99b29} + 1 + 0 + 0 + + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Android_for_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + + true + Copy application data + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-27 + + true + Build Android APK + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Android_for_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Copy application data + + Qt4ProjectManager.AndroidPackageInstallationStep + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + + android-27 + /home/dorian/Documents/climbing_normspeed_stopwatch/climbing_normspeed_stopwatch/android_release.keystore + true + Build Android APK + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Android_for_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + + true + Copy application data + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-27 + + true + Build Android APK + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + + true + Deploy to Android device + + Qt4ProjectManager.AndroidDeployQtStep + false + + 1 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy to Android device + + Qt4ProjectManager.AndroidDeployConfiguration2 + + 1 + + MWS0216A15001488 + 24 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + + + speedclimbing_stopwatch + speedclimbing_stopwatch + Qt4ProjectManager.AndroidRunConfiguration:/home/dorian/Documents/climbing_normspeed_stopwatch/climbing_normspeed_stopwatch/speedclimbing_stopwatch.pro + speedclimbing_stopwatch.pro + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + +