mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-04-26 01:34:40 +00:00
53 lines
1.2 KiB
C++
53 lines
1.2 KiB
C++
#ifndef USERVIEW_H
|
|
#define USERVIEW_H
|
|
|
|
#include "playerclientdata.h"
|
|
|
|
#include <QObject>
|
|
|
|
class UserView : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString name READ name NOTIFY sourceChanged)
|
|
Q_PROPERTY(QString gmail READ gmail NOTIFY sourceChanged)
|
|
Q_PROPERTY(int money READ money NOTIFY sourceChanged)
|
|
Q_PROPERTY(int record READ record NOTIFY sourceChanged)
|
|
Q_PROPERTY(int avgRecord READ avgRecord NOTIFY sourceChanged)
|
|
Q_PROPERTY(int cureentSnake READ cureentSnake NOTIFY sourceChanged)
|
|
Q_PROPERTY(int id READ id NOTIFY sourceChanged)
|
|
Q_PROPERTY(bool offline READ offline NOTIFY offlineChanged)
|
|
|
|
private:
|
|
QSharedPointer<PlayerClientData> _source = nullptr;
|
|
|
|
bool _offline = false;
|
|
|
|
public:
|
|
explicit UserView(QObject *parent = nullptr);
|
|
|
|
QString name() const;
|
|
QString gmail() const;
|
|
int money() const;
|
|
int record() const;
|
|
int avgRecord() const;
|
|
int cureentSnake() const;
|
|
int id() const;
|
|
|
|
const PlayerClientData *getSource() const;
|
|
bool offline() const;
|
|
void setOffline(bool offline);
|
|
|
|
signals:
|
|
|
|
void sourceChanged();
|
|
|
|
void offlineChanged(bool offline);
|
|
|
|
public slots:
|
|
void setSource(QSharedPointer<PlayerClientData> data);
|
|
|
|
};
|
|
|
|
#endif // USERVIEW_H
|