54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
#ifndef SCSTWAPPBACKEND_H
|
|
#define SCSTWAPPBACKEND_H
|
|
|
|
#include <QObject>
|
|
|
|
#include <scstwclient.h>
|
|
#include <scstwrace.h>
|
|
#include <ScStw.hpp>
|
|
#include <scstwremoterace.h>
|
|
|
|
#include "headers/scstwappsettings.h"
|
|
|
|
|
|
class ScStwAppBackend : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(ScStwRace* race READ getRace NOTIFY raceChanged)
|
|
Q_PROPERTY(ScStwClient *scStwClient READ getScStwClient NOTIFY scStwClientChanged)
|
|
Q_PROPERTY(ScStwAppSettings *settings READ getSettings NOTIFY settingsChanged)
|
|
|
|
public:
|
|
explicit ScStwAppBackend(QObject *parent = nullptr);
|
|
|
|
private:
|
|
ScStwAppSettings * appSettings;
|
|
ScStwClient * scStwClient;
|
|
|
|
QTimer * timerTextRefreshTimer;
|
|
ScStwRemoteRace * race;
|
|
|
|
public slots:
|
|
// functions for qml
|
|
Q_INVOKABLE ScStwRace *getRace();
|
|
Q_INVOKABLE ScStwClient *getScStwClient();
|
|
Q_INVOKABLE ScStwAppSettings *getSettings();
|
|
|
|
// 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();
|
|
void scStwClientChanged();
|
|
void settingsChanged();
|
|
};
|
|
|
|
#endif // SCSTWAPPBACKEND_H
|