Feat: dual timers and keyboard control

This commit is contained in:
Dorian Zedler 2023-05-14 22:33:44 +02:00
parent c7e7b1c950
commit 41178e76d9
Signed by: dorian
GPG key ID: 989DE36109AFA354
5 changed files with 47 additions and 7 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="com.itsblue.speedclimbing_stopwatch" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto">
<manifest package="com.itsblue.speedclimbing_stopwatch_test" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto">
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->

View file

@ -16,7 +16,8 @@ public:
enum AppInternalSetting {
InvalidSetting = -1,
AppThemeSetting,
BaseStationIpSetting
BaseStationIpSetting,
KeyboardControlSetting
};
Q_ENUM(AppInternalSetting)
@ -39,7 +40,8 @@ public:
static QVariant::Type keyToType(int key) {
QMap<AppInternalSetting, QVariant::Type> types = {
{AppThemeSetting, QVariant::String},
{BaseStationIpSetting, QVariant::String}
{BaseStationIpSetting, QVariant::String},
{KeyboardControlSetting, QVariant::Bool}
};
if(types.contains(AppInternalSetting(key)))

View file

@ -74,4 +74,19 @@ Column {
appTheme.setting.setValue(checked ? "Dark":"Light")
}
}
/*----Style Settings----*/
SmoothSwitchDelegate {
id: keyboardDel
text: qsTr("keyboard control")
width: parent.width
height: parentObj.delegateHeight
checked: scStwAppSettings.readSetting(ScStwAppSettings.KeyboardControlSetting)
onCheckedChanged: {
scStwAppSettings.writeSetting(ScStwAppSettings.KeyboardControlSetting, checked)
}
}
}

View file

@ -47,6 +47,21 @@ ApplicationWindow {
state: scStwRemoteRace.state
Keys.onPressed: {
if (!scStwAppSettings.readSetting(ScStwAppSettings.KeyboardControlSetting) || scStwRemoteRace.state !== ScStwRace.RUNNING) {
return
}
if(event.key === Qt.Key_A) {
defaultTimerA.stop()
}
if(event.key === Qt.Key_L) {
defaultTimerB.stop()
}
}
Rectangle {
id: backgroundRect
anchors.fill: parent
@ -77,7 +92,14 @@ ApplicationWindow {
}
ScStwTimer {
id: defaultTimer
id: defaultTimerA
letter: "A"
}
ScStwTimer {
id: defaultTimerB
letter: "B"
}
ScStwRemoteRace {
@ -88,7 +110,8 @@ ApplicationWindow {
scStwClient: scStwClient
Component.onCompleted: {
scStwRemoteRace.addTimer(defaultTimer)
scStwRemoteRace.addTimer(defaultTimerA)
scStwRemoteRace.addTimer(defaultTimerB)
}
onStateChanged: {
@ -210,7 +233,7 @@ ApplicationWindow {
PropertyChanges {
target: topToolBar
sizeMode: "medium"
sizeMode: scStwAppSettings.readSetting(ScStwAppSettings.KeyboardControlSetting) ? "large":"medium"
}
PropertyChanges {

@ -1 +1 @@
Subproject commit 0f269a76370d84c8d1f43a7298a59b6fac1c6980
Subproject commit 206d55f301da6fbbb7c8ae3932349cb2bbc57efb