2019-02-13 13:03:40 +03:00
|
|
|
|
#ifndef CLIENT_CP_H
|
|
|
|
|
#define CLIENT_CP_H
|
|
|
|
|
|
|
|
|
|
#include "clientprotocol_global.h"
|
|
|
|
|
#include "clientprotocol.h"
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
|
|
class QTcpSocket;
|
2019-02-13 14:28:42 +03:00
|
|
|
|
class Player;
|
|
|
|
|
class BaseItem;
|
2019-02-13 13:03:40 +03:00
|
|
|
|
|
|
|
|
|
namespace ClientProtocol {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CLIENTPROTOCOLSHARED_EXPORT Client: public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
private:
|
|
|
|
|
QTcpSocket *_destination;
|
|
|
|
|
Package _downloadPackage;
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void incommingData();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit Client(QObject * ptr = nullptr);
|
|
|
|
|
bool sendPackage(const Package& pkg);
|
2019-02-13 14:28:42 +03:00
|
|
|
|
/**
|
|
|
|
|
* @brief login - register or login a user
|
|
|
|
|
* @param gmail - gmail of user
|
|
|
|
|
* @param pass - hash of pass of user
|
|
|
|
|
* @param error - error ( if all good this variable is empty)
|
2019-02-15 23:36:59 +03:00
|
|
|
|
* @return
|
2019-02-13 14:28:42 +03:00
|
|
|
|
*/
|
2019-02-15 23:36:59 +03:00
|
|
|
|
bool login(const QString& gmail, const QByteArray &pass);
|
2019-02-13 14:28:42 +03:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief updateData
|
|
|
|
|
* @return true if refresh seсcessfully completed
|
|
|
|
|
*/
|
2019-02-15 23:36:59 +03:00
|
|
|
|
bool updateData(const QString& gmail, const QByteArray &pass);
|
2019-02-13 14:28:42 +03:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief getItem
|
|
|
|
|
* @param id of item
|
|
|
|
|
* @return item data
|
|
|
|
|
*/
|
2019-02-15 23:36:59 +03:00
|
|
|
|
bool getItem(int id, const QByteArray &pass);
|
2019-02-13 14:28:42 +03:00
|
|
|
|
|
2019-02-13 13:03:40 +03:00
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void sigIncommingData(const QVariantMap& map);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endif // CLIENT_CP_H
|