From d651e5b04b6200b93c22bd8157b14a72bc3e1030 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Tue, 5 Jan 2021 20:47:17 +0100 Subject: [PATCH] adapted to latest libraries --- ScStwMonitor.pro | 4 +- headers/scstwmonitorbackend.h | 55 ------------------------ release/ScStwMonitor.deb | Bin 133540 -> 133544 bytes release/debian/DEBIAN/control | 2 +- resources/qml/main.qml | 65 ++++++++++++++++++---------- shared-libraries | 2 +- sources/main.cpp | 3 -- sources/scstwmonitorbackend.cpp | 72 -------------------------------- 8 files changed, 45 insertions(+), 158 deletions(-) delete mode 100644 headers/scstwmonitorbackend.h delete mode 100644 sources/scstwmonitorbackend.cpp 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 48c95ca46f3073a88bc60f6fc35fe085aef29162..8b905ebd2a36497950ed86ac487158cf8940d8fe 100644 GIT binary patch delta 872 zcmZ27nPbIdjtP>SW(JlPW|pP~1{0Oc>){*)1p@^TfRKg;24*HE3JPXMKmrUBxc-_~ zMMN<$usplA#f{~_I+lh2MMg0O2>5%c>&*l8|4eGJ4C35-WNI0w9+362s}wzSMs0DV zTQ}#Ai0wQ0gsPSE&31j8@+&E9O2HXE*2~xb*VnsD2`|h#tCF2-wP?0khH-?O_JfzN zT$c9=)C){M^X&KEce}PRKYvtuLDg#NmNk0QI1g7o_x!l%&8ArgSUVKhxe|Sf z@3HGyknB;_yRR;-T2vyjZTB*Njumrv2XWf2QonjvA+4x(*iT6k^GHivJkFVybO z4ViXJ_rhZFz2E2NYt>G$Ws&`nviiRHmOigMsYmOX7c&1@xL#pu{YImO69c0@M?d?R zI8Uo?;kia-^>=bxYg;5gMY9>Jt>)R!r&(_heEis-6aOk6crN~ZZPD(7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*%AS zu#n{UVSQJ2)_T`4z5L&(G52xQ9G2t3lk1#3d(9GL?Ns87f4s70SDSI1hvTxYjYF|O ziDXr0L5b2*@6vZE>TmdV=p1DJFS%D$_*6(@+)M>zs5E%skqRoDF 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; -}