diff --git a/ScStwMonitor.pro b/ScStwMonitor.pro
index df11048..38a2ed6 100755
--- a/ScStwMonitor.pro
+++ b/ScStwMonitor.pro
@@ -18,8 +18,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
- sources/main.cpp \
- sources/scstwmonitorbackend.cpp
+ sources/main.cpp
RESOURCES += \
resources/qml/qml.qrc \
@@ -43,7 +42,6 @@ else: unix:!android: target.path = /usr/share/ScStwMonitor
!isEmpty(target.path): INSTALLS += target
HEADERS += \
- headers/scstwmonitorbackend.h
DISTFILES += \
android/AndroidManifest.xml \
diff --git a/headers/scstwmonitorbackend.h b/headers/scstwmonitorbackend.h
deleted file mode 100644
index 0064cb7..0000000
--- a/headers/scstwmonitorbackend.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
- ** ScStw Monitor
- ** Copyright (C) 2020 Itsblue development
- **
- ** This program is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program. If not, see .
- ****************************************************************************/
-
-#ifndef SCSTWMONITORBACKEND_H
-#define SCSTWMONITORBACKEND_H
-
-#include
-#include
-#include
-
-class ScStwMonitorBackend : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(ScStwRace* race READ getRace NOTIFY raceChanged)
- Q_PROPERTY(ScStwClient *scStwClient READ getScStwClient NOTIFY scStwClientChanged)
-public:
- explicit ScStwMonitorBackend(QObject *parent = nullptr);
-
-private:
- ScStwClient * scStwClient;
- QTimer *autoConnectRetryTimer; // timer to frequently trigger a connection attempt to the base station
- QTimer * timerTextRefreshTimer;
- ScStwRemoteMonitorRace * remoteRace;
-
-public slots:
- // functions for qml
- Q_INVOKABLE ScStwRace *getRace();
- Q_INVOKABLE ScStwClient *getScStwClient();
-
-private slots:
- void refreshTimerText();
- void doConnectionAttempt();
-
-signals:
- void raceChanged();
- void scStwClientChanged();
-};
-
-#endif // SCSTWMONITORBACKEND_H
diff --git a/release/ScStwMonitor.deb b/release/ScStwMonitor.deb
index 48c95ca..8b905eb 100644
Binary files a/release/ScStwMonitor.deb and b/release/ScStwMonitor.deb differ
diff --git a/release/debian/DEBIAN/control b/release/debian/DEBIAN/control
index dac4b63..6a7f01d 100644
--- a/release/debian/DEBIAN/control
+++ b/release/debian/DEBIAN/control
@@ -3,7 +3,7 @@ Version: 1.1
Section: base
Priority: optional
Architecture: armhf
-Depends: libScStwSharedLibraries (>=1.1.0), xinit (>= 1.4.0-1), x11-xserver-utils (>= 7.7+8+rpi1)
+Depends: libScStwSharedLibraries (>=1.1.0), xinit (>= 1.4.0-1), x11-xserver-utils (>= 7.7+8)
Maintainer: Dorian Zedler
Description: ScStwMonitor
This is the ScStwMonitor Application, used with the ScStw project
diff --git a/resources/qml/main.qml b/resources/qml/main.qml
index c3d1487..159367e 100755
--- a/resources/qml/main.qml
+++ b/resources/qml/main.qml
@@ -24,7 +24,6 @@ import Qt.labs.settings 1.0
import QtQuick.Layouts 1.0
import de.itsblue.ScStw 2.0
-import de.itsblue.ScStwMonitor 2.0
import de.itsblue.ScStw.Styling 2.0
import de.itsblue.ScStw.Styling.Components 1.0
@@ -49,9 +48,29 @@ Window {
return app.width > app.height
}
- ScStwMonitorBackend {
- id: backend
- scStwClient.ipAddress: appSettings.baseStationIp
+ ScStwClient {
+ id: scStwClient
+ ipAddress: appSettings.baseStationIp
+ }
+
+ Timer {
+ running: scStwClient.state !== ScStwClient.Connected
+ interval: 10
+ onTriggered: scStwClient.connectToHost()
+ }
+
+ ScStwRemoteRace {
+ id: scStwRemoteRace
+
+ autoRefreshTimerText: true
+ scStwClient: scStwClient
+
+ onStateChanged: {
+ if(scStwRemoteRace.state !== ScStwRace.IDLE) {
+ settingsDialog.close()
+ profilesDialog.close()
+ }
+ }
}
ScStwAppThemeManager {
@@ -89,7 +108,7 @@ Window {
anchors.fill: parent
- sourceComponent: backend.scStwClient.state === ScStwClient.CONNECTED ? displayComp:loadingComp
+ sourceComponent: scStwClient.state === ScStwClient.CONNECTED ? displayComp:loadingComp
}
Component {
@@ -100,7 +119,7 @@ Window {
Rectangle {
id: topBanner
width: parent.width
- height: !showControls && showBanners ? backend.race.state === ScStwRace.IDLE ? parent.height * 0.1:parent.height * 0.05 : 0
+ height: !showControls && showBanners ? scStwRemoteRace.state === ScStwRace.IDLE ? parent.height * 0.1:parent.height * 0.05 : 0
color: "black"
Text {
@@ -156,12 +175,12 @@ Window {
TimerColumn {
anchors.fill: parent
- timers: removeDisabledTimers(backend.race.timers)
+ timers: removeDisabledTimers(scStwRemoteRace.timers)
colors: appTheme.theme.colors
fontName: appTheme.theme.fonts.timers
- opacity: !showControls || [ScStwRace.IDLE,ScStwRace.STARTING].indexOf(backend.race.state) < 0 ? 1:0
+ opacity: !showControls || [ScStwRace.IDLE,ScStwRace.STARTING].indexOf(scStwRemoteRace.state) < 0 ? 1:0
function removeDisabledTimers(timers) {
var ret = []
@@ -199,7 +218,7 @@ Window {
"please wait...",
"running\ntap anywhere to stop",
"tap anywhere to reset"
- ][backend.race.state]
+ ][scStwRemoteRace.state]
anchors.fill: parent
@@ -210,9 +229,9 @@ Window {
font.pixelSize: height * 0.3
- color: backend.race.state === ScStwRace.STARTING ? appTheme.theme.colors.warning:appTheme.theme.colors.text
+ color: scStwRemoteRace.state === ScStwRace.STARTING ? appTheme.theme.colors.warning:appTheme.theme.colors.text
- text: implicitText === "NEXT_START_ACTION" ? ["", "at your \nmarks", "ready", "starting..."][backend.race.nextStartActionDetails[ScStwRace.NextStartAction]+1]:implicitText
+ text: implicitText === "NEXT_START_ACTION" ? ["", "at your \nmarks", "ready", "starting..."][scStwRemoteRace.nextStartActionDetails[ScStwRace.NextStartAction]+1]:implicitText
Behavior on text {
FadeAnimation {
@@ -233,9 +252,9 @@ Window {
height: app.landscape() ? app.height * 0.1:app.width * 0.1
- opacity: backend.race.nextStartActionDetails[ScStwRace.NextStartAction] < 3 && backend.race.state === ScStwRace.STARTING ? 1:0
+ opacity: scStwRemoteRace.nextStartActionDetails[ScStwRace.NextStartAction] < 3 && scStwRemoteRace.state === ScStwRace.STARTING ? 1:0
- value: backend.race.nextStartActionDetails[ScStwRace.NextStartActionDelayProgress]
+ value: scStwRemoteRace.nextStartActionDetails[ScStwRace.NextStartActionDelayProgress]
background: Rectangle {
@@ -273,25 +292,25 @@ Window {
enabled: visible
onClicked: {
- switch (backend.race.state) {
+ switch (scStwRemoteRace.state) {
case ScStwRace.IDLE:
// IDLE
- backend.race.start()
+ scStwRemoteRace.start()
break;
case ScStwRace.STARTING:
// STARTING
- backend.race.cancel()
+ scStwRemoteRace.cancel()
break;
case ScStwRace.WAITING:
// WAITING
break;
case ScStwRace.RUNNING:
// RUNNING
- backend.race.stop()
+ scStwRemoteRace.stop()
break;
case ScStwRace.STOPPED:
// STOPPED
- backend.race.reset()
+ scStwRemoteRace.reset()
break;
}
@@ -310,7 +329,7 @@ Window {
height: app.landscape() ? app.height * 0.1:app.width * 0.12
spacing: 0
- opacity: backend.race.state === ScStwRace.IDLE ? 1:0
+ opacity: scStwRemoteRace.state === ScStwRace.IDLE ? 1:0
visible: opacity > 0
Behavior on opacity {
@@ -399,7 +418,7 @@ Window {
states: [
State {
- when: [ScStwRace.IDLE,ScStwRace.STARTING].indexOf(backend.race.state) >= 0
+ when: [ScStwRace.IDLE,ScStwRace.STARTING].indexOf(scStwRemoteRace.state) >= 0
name: "big"
PropertyChanges {
target: clickHintLabel
@@ -417,7 +436,7 @@ Window {
}
},
State {
- when: [ScStwRace.IDLE,ScStwRace.STARTING].indexOf(backend.race.state) < 0
+ when: [ScStwRace.IDLE,ScStwRace.STARTING].indexOf(scStwRemoteRace.state) < 0
name: "small"
PropertyChanges {
@@ -452,7 +471,7 @@ Window {
Rectangle {
id: bottomBanner
width: parent.width
- height: !showControls && showBanners ? backend.race.state === ScStwRace.IDLE ? parent.height * 0.1:parent.height * 0.05 : 0
+ height: !showControls && showBanners ? scStwRemoteRace.state === ScStwRace.IDLE ? parent.height * 0.1:parent.height * 0.05 : 0
color: "black"
@@ -519,7 +538,7 @@ Window {
visible: !textFieldEnableMa.containsMouse
- opacity: backend.scStwClient.state === ScStwClient.CONNECTED ? 0:1
+ opacity: scStwClient.state === ScStwClient.CONNECTED ? 0:1
text: appSettings.baseStationIp
diff --git a/shared-libraries b/shared-libraries
index ae9e639..3985045 160000
--- a/shared-libraries
+++ b/shared-libraries
@@ -1 +1 @@
-Subproject commit ae9e6398ac233217ac89ef009fd84d8ce19f4159
+Subproject commit 39850455da76100e5f8e7a396b105da2cffb5ceb
diff --git a/sources/main.cpp b/sources/main.cpp
index c0eeb64..e47d5af 100755
--- a/sources/main.cpp
+++ b/sources/main.cpp
@@ -25,7 +25,6 @@
#include
-#include "headers/scstwmonitorbackend.h"
#if defined(Q_OS_IOS)
#include "sleepprevent.h"
#endif
@@ -39,8 +38,6 @@ int main(int argc, char *argv[])
app.setOrganizationName("itsblue");
app.setOrganizationDomain("itsblue.de");
- qmlRegisterType("de.itsblue.ScStwMonitor", 2, 0, "ScStwMonitorBackend");
-
QQmlApplicationEngine engine;
ScStwLibraries::init();
diff --git a/sources/scstwmonitorbackend.cpp b/sources/scstwmonitorbackend.cpp
deleted file mode 100644
index 8c66231..0000000
--- a/sources/scstwmonitorbackend.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
- ** ScStw Monitor
- ** Copyright (C) 2020 Itsblue development
- **
- ** This program is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program. If not, see .
- ****************************************************************************/
-
-#include "../headers/scstwmonitorbackend.h"
-
-ScStwMonitorBackend::ScStwMonitorBackend(QObject *parent) : QObject(parent)
-{
- this->scStwClient = new ScStwClient();
- this->remoteRace = new ScStwRemoteMonitorRace(this->scStwClient, this);
-
- // init refresh timers
- this->autoConnectRetryTimer = new QTimer(this);
- this->autoConnectRetryTimer->setInterval(1000);
- this->autoConnectRetryTimer->setSingleShot(true);
- connect(this->autoConnectRetryTimer, &QTimer::timeout, this, &ScStwMonitorBackend::doConnectionAttempt);
- this->autoConnectRetryTimer->start();
-
- this->timerTextRefreshTimer = new QTimer(this);
- this->timerTextRefreshTimer->setInterval(1);
- this->timerTextRefreshTimer->setSingleShot(true);
- this->timerTextRefreshTimer->connect(this->timerTextRefreshTimer, &QTimer::timeout, this, &ScStwMonitorBackend::refreshTimerText);
- this->refreshTimerText();
-
-}
-
-void ScStwMonitorBackend::refreshTimerText() {
-
- // --- refresh timer text ---
- if(this->getRace()->getState() == ScStwRace::RUNNING) {
- emit this->getRace()->timersChanged();
- }
-
- // --- refresh next start action delay progress ---
- if(this->getRace()->getState() == ScStwRace::STARTING) {
- emit this->getRace()->nextStartActionDetailsChanged();
- }
-
- this->timerTextRefreshTimer->start();
-}
-
-void ScStwMonitorBackend::doConnectionAttempt()
-{
- if(this->scStwClient->getState() == ScStwClient::DISCONNECTED) {
- qDebug() << "+--- trying to connect";
- this->scStwClient->connectToHost();
- }
-
- this->autoConnectRetryTimer->start();
-}
-
-ScStwRace* ScStwMonitorBackend::getRace() {
- return this->remoteRace;
-}
-
-ScStwClient* ScStwMonitorBackend::getScStwClient() {
- return this->scStwClient;
-}