2020-04-15 21:47:55 +02:00
|
|
|
#ifndef SCSTWAPPBACKEND_H
|
|
|
|
#define SCSTWAPPBACKEND_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
#include <scstwclient.h>
|
|
|
|
#include <scstwrace.h>
|
|
|
|
#include <ScStw.hpp>
|
2020-10-02 19:58:25 +02:00
|
|
|
#include <scstwremoterace.h>
|
2020-04-15 21:47:55 +02:00
|
|
|
|
2020-07-06 15:04:02 +02:00
|
|
|
#include "headers/scstwappsettings.h"
|
2020-04-15 21:47:55 +02:00
|
|
|
|
2020-04-19 13:09:46 +02:00
|
|
|
|
2020-04-15 21:47:55 +02:00
|
|
|
class ScStwAppBackend : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
Q_PROPERTY(ScStwRace* race READ getRace NOTIFY raceChanged)
|
2020-04-19 13:09:46 +02:00
|
|
|
Q_PROPERTY(ScStwClient *scStwClient READ getScStwClient NOTIFY scStwClientChanged)
|
2020-07-06 15:04:02 +02:00
|
|
|
Q_PROPERTY(ScStwAppSettings *settings READ getSettings NOTIFY settingsChanged)
|
2020-04-15 21:47:55 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ScStwAppBackend(QObject *parent = nullptr);
|
|
|
|
|
|
|
|
private:
|
2020-07-06 15:04:02 +02:00
|
|
|
ScStwAppSettings * appSettings;
|
2020-04-15 21:47:55 +02:00
|
|
|
ScStwClient * scStwClient;
|
|
|
|
|
|
|
|
QTimer * timerTextRefreshTimer;
|
2020-10-03 18:35:37 +02:00
|
|
|
ScStwRemoteRace * race;
|
2020-04-15 21:47:55 +02:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
// functions for qml
|
|
|
|
Q_INVOKABLE ScStwRace *getRace();
|
2020-04-19 13:09:46 +02:00
|
|
|
Q_INVOKABLE ScStwClient *getScStwClient();
|
2020-07-06 15:04:02 +02:00
|
|
|
Q_INVOKABLE ScStwAppSettings *getSettings();
|
2020-04-15 21:47:55 +02:00
|
|
|
|
|
|
|
// athlete management
|
|
|
|
Q_INVOKABLE QVariant getAthletes();
|
|
|
|
Q_INVOKABLE bool createAthlete( QString userName, QString fullName );
|
|
|
|
Q_INVOKABLE bool deleteAthlete( QString userName );
|
|
|
|
Q_INVOKABLE bool selectAthlete( QString userName, int timerId );
|
|
|
|
Q_INVOKABLE QVariant getResults( QString userName );
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void refreshTimerText();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void raceChanged();
|
2020-04-19 13:09:46 +02:00
|
|
|
void scStwClientChanged();
|
2020-07-06 15:04:02 +02:00
|
|
|
void settingsChanged();
|
2020-04-15 21:47:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SCSTWAPPBACKEND_H
|