mirror of
https://github.com/QuasarApp/Hanoi-Towers.git
synced 2025-05-13 18:09:33 +00:00
update copyright and added clinet class
This commit is contained in:
parent
92e02b5f83
commit
3f82cadc24
CMakeLists.txt
HanoiTowers
CMakeLists.txt
HeartPatronumProtockol
Server
Terminal
client
About.qmlCMakeLists.txtGame.qmlHelp.qmlPopUp.qmlQMLLoginViewSimpleQmlNotifySwitchLvl.qmlTower.qmlViewSolutionsbackEnd.cppbackEnd.h
base
hanoiclient.cpphanoiclient.hhanoiimageprovider.cpphanoiimageprovider.hlocalrecordstable.cpplocalrecordstable.hlocaluser.cpplocaluser.hmain.cppmain.qmlmenu
onlinestatusqml.cpponlinestatusqml.hplate.qmlrecordlistmodel.cpprecordlistmodel.hsettingsdata.cppsettingsdata.huserpreview.cppuserpreview.h@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Copyright (C) 2018-2021 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Copyright (C) 2018-2021 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Copyright (C) 2018-2021 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Copyright (C) 2018-2021 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Copyright (C) 2018-2021 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Copyright (C) 2018-2021 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 491665cd0f23f84c8b69d980efdbe9f3fd785209
|
||||
Subproject commit 883271c38acb3a55595f046aa6707942242ed6a5
|
@ -1 +1 @@
|
||||
Subproject commit 61172fdd783c0294d62d9a9cff108619b41fbc4f
|
||||
Subproject commit 2f71a23f6f875acaf73ee9055f20223260633f10
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit f580a47a722135728fd0b435789e8e3555efb8fc
|
||||
Subproject commit d2a5b22942126fbca624055c5aaf80342f71d5b6
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
@ -84,7 +84,6 @@ BackEnd::BackEnd(QQmlApplicationEngine *engine):
|
||||
setProfile(_settings->getStrValue(CURRENT_PROFILE_KEY, DEFAULT_USER_ID));
|
||||
init();
|
||||
|
||||
_client->connectToServer(QH::HostAddress{DEFAULT_HANOI_ADDRESS, DEFAULT_HANOI_PORT});
|
||||
}
|
||||
|
||||
void BackEnd::init() {
|
||||
@ -134,6 +133,10 @@ void BackEnd::onlineRequest(const QString &userId) {
|
||||
emit showOnlinePage();
|
||||
}
|
||||
|
||||
int BackEnd::onlineStatus() const {
|
||||
return static_cast<int>(_onlineStatus);
|
||||
}
|
||||
|
||||
void BackEnd::handleChangeName(const QString & name) {
|
||||
emit profileChanged(name);
|
||||
}
|
||||
@ -380,3 +383,11 @@ void BackEnd::setGameState(GameState *gameState) {
|
||||
_profile.setGameState(*gameState);
|
||||
emit gameStateChanged(gameState);
|
||||
}
|
||||
|
||||
void BackEnd::setOnlineStatus(int onlineStatus) {
|
||||
if (_onlineStatus == static_cast<OnlineStatus>(onlineStatus))
|
||||
return;
|
||||
|
||||
_onlineStatus = static_cast<OnlineStatus>(onlineStatus);
|
||||
emit onlineStatusChanged(static_cast<int>(_onlineStatus));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
@ -15,6 +15,7 @@
|
||||
#include <quasarapp.h>
|
||||
#include <QObject>
|
||||
#include <QFile>
|
||||
#include "onlinestatusqml.h"
|
||||
//#include <listviewmodel.h>
|
||||
|
||||
#define SAVE "data"
|
||||
@ -47,6 +48,7 @@ class BackEnd: public QObject
|
||||
Q_PROPERTY(QObject* profileObject READ profileObject NOTIFY profileChanged)
|
||||
|
||||
Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged)
|
||||
Q_PROPERTY(int onlineStatus READ onlineStatus WRITE setOnlineStatus NOTIFY onlineStatusChanged)
|
||||
|
||||
|
||||
|
||||
@ -78,6 +80,7 @@ public:
|
||||
|
||||
Q_INVOKABLE void onlineRequest(const QString& userId);
|
||||
|
||||
int onlineStatus() const;
|
||||
|
||||
public slots:
|
||||
|
||||
@ -139,6 +142,7 @@ public slots:
|
||||
void setGameState(GameState* gameState);
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
void animationChanged();
|
||||
void randomColorChanged();
|
||||
@ -155,6 +159,8 @@ signals:
|
||||
|
||||
void gameStateChanged(GameState* gameState);
|
||||
|
||||
void onlineStatusChanged(int onlineStatus);
|
||||
|
||||
private slots:
|
||||
void handleChangeName(const QString&);
|
||||
|
||||
@ -165,6 +171,8 @@ private slots:
|
||||
void handleOnlineRequestError(const QString&Errr);
|
||||
|
||||
void handleProfileChanged(QSharedPointer<LocalUser> profileId);
|
||||
void setOnlineStatus(int onlineStatus);
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
@ -181,6 +189,7 @@ private:
|
||||
SettingsData _settingsData;
|
||||
HanoiImageProvider *_imageProvider = nullptr;
|
||||
DataConverter *_dataConverter = nullptr;
|
||||
OnlineStatus _onlineStatus = OnlineStatus::Offline;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
@ -23,7 +23,9 @@
|
||||
#include "hanoierrorcodes.h"
|
||||
#include "localrecordstable.h"
|
||||
|
||||
HanoiClient::HanoiClient() {
|
||||
HanoiClient::HanoiClient():
|
||||
_serverAddress(DEFAULT_HANOI_ADDRESS, DEFAULT_HANOI_PORT) {
|
||||
|
||||
initSqlDb("",
|
||||
new QH::SqlDB(),
|
||||
new QH::SqlDBWriter());
|
||||
@ -142,11 +144,20 @@ bool HanoiClient::sendUserData(const QSharedPointer<LocalUser> &data) {
|
||||
}
|
||||
|
||||
bool HanoiClient::isOnline(const QSharedPointer<LocalUser> &data) {
|
||||
if (data->userId() != _currentUserId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!data->isOnline()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data->userId() != _currentUserId) {
|
||||
return _status >= Status::Connected;
|
||||
}
|
||||
|
||||
bool HanoiClient::isOnlineAndLoginned(const QSharedPointer<LocalUser> &data) {
|
||||
|
||||
if (!isOnline(data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -184,7 +195,7 @@ bool HanoiClient::setNewAvatar(const QString &userId, const QByteArray &image) {
|
||||
|
||||
obj->setAvatar(image);
|
||||
|
||||
if (isOnline(obj)) {
|
||||
if (isOnlineAndLoginned(obj)) {
|
||||
return sendUserData(obj);
|
||||
}
|
||||
|
||||
@ -220,7 +231,30 @@ bool HanoiClient::addProfile(const LocalUser& user) {
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HanoiClient::setProfile(const QString &userId,
|
||||
QSharedPointer<LocalUser>* selectedProfileData) {
|
||||
auto user = getLocalUser(userId);
|
||||
|
||||
if (!user || !user->isValid()) {
|
||||
emit requestError("User '" + userId + "' is not exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
_currentUserId = userId;
|
||||
|
||||
if (selectedProfileData) {
|
||||
*selectedProfileData = user;
|
||||
}
|
||||
|
||||
emit profileChanged(user);
|
||||
|
||||
if ( user->online()) {
|
||||
connectToServer();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HanoiClient::updateProfile(const LocalUser& user) {
|
||||
@ -231,45 +265,38 @@ bool HanoiClient::updateProfile(const LocalUser& user) {
|
||||
return database->updateObject(localUser);
|
||||
}
|
||||
|
||||
if (isOnline(localUser)) {
|
||||
if (isOnlineAndLoginned(localUser)) {
|
||||
return sendUserData(localUser);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HanoiClient::login(const QString &userId, const QString &rawPassword) {
|
||||
bool HanoiClient::login(const QString &userId, const QString& rawPassword) {
|
||||
|
||||
auto user = getLocalUser(userId);
|
||||
|
||||
if (!user || !user->isValid()) {
|
||||
emit requestError("User '" + userId + "' is not exists");
|
||||
QSharedPointer<LocalUser> user;
|
||||
if (!setProfile(userId, &user)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_currentUserId = userId;
|
||||
|
||||
emit profileChanged(user);
|
||||
|
||||
bool fOnline = rawPassword.size() || user->online();
|
||||
if (fOnline && !p_login(userId, hashgenerator(rawPassword.toLatin1()))) {
|
||||
if (!(isOnline(user) && p_login(userId, hashgenerator(rawPassword.toLatin1())))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool HanoiClient::registerOnlineUser(const QString &userId, const QString &rawPassword) {
|
||||
auto user = getLocalUser(userId);
|
||||
QSharedPointer<LocalUser> user;
|
||||
if (!setProfile(userId, &user)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (user) {
|
||||
emit requestError("User '" + userId + "' is alredy exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
emit profileChanged(user);
|
||||
|
||||
return p_signIn(userId, hashgenerator(rawPassword.toLatin1()));
|
||||
}
|
||||
|
||||
@ -281,7 +308,7 @@ bool HanoiClient::removeUser(const QString &userId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isOnline(user)) {
|
||||
if (isOnlineAndLoginned(user)) {
|
||||
QH::PKG::AuthRequest request;
|
||||
request.setId(user->getId());
|
||||
request.setRequest(UserRequestType::Remove);
|
||||
@ -295,9 +322,8 @@ bool HanoiClient::removeUser(const QString &userId) {
|
||||
|
||||
}
|
||||
|
||||
void HanoiClient::connectToServer(const QH::HostAddress &host) {
|
||||
addNode(host);
|
||||
_serverAddress = host;
|
||||
void HanoiClient::connectToServer() {
|
||||
addNode(_serverAddress);
|
||||
}
|
||||
|
||||
QList<UserPreview> HanoiClient::localUsersPreview() {
|
||||
@ -310,17 +336,18 @@ QList<UserPreview> HanoiClient::localUsersPreview() {
|
||||
return result->data();
|
||||
}
|
||||
|
||||
void HanoiClient::nodeConfirmend(const QH::HostAddress &node) {
|
||||
void HanoiClient::nodeConfirmend(QH::AbstractNodeInfo *node) {
|
||||
setStatus(Status::Connected);
|
||||
DataBaseNode::nodeConfirmend(node);
|
||||
|
||||
}
|
||||
|
||||
void HanoiClient::nodeConnected(const QH::HostAddress &node) {
|
||||
void HanoiClient::nodeConnected(QH::AbstractNodeInfo* node) {
|
||||
setStatus(Status::Connected);
|
||||
DataBaseNode::nodeConnected(node);
|
||||
}
|
||||
|
||||
void HanoiClient::nodeDisconnected(const QH::HostAddress &node) {
|
||||
void HanoiClient::nodeDisconnected(QH::AbstractNodeInfo *node) {
|
||||
setStatus(Status::Dissconnected);
|
||||
DataBaseNode::nodeDisconnected(node);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
@ -49,13 +49,15 @@ public:
|
||||
QSharedPointer<LocalUser> currentProfile() const;
|
||||
bool updateProfile(const LocalUser &user);
|
||||
bool addProfile(const LocalUser &);
|
||||
bool setProfile(const QString &userId,
|
||||
QSharedPointer<LocalUser> *selectedProfileData = nullptr);
|
||||
|
||||
bool login(const QString &userId, const QString& rawPassword = "");
|
||||
bool registerOnlineUser(const QString &userId, const QString& rawPassword);
|
||||
|
||||
bool removeUser(const QString &userId);
|
||||
|
||||
void connectToServer(const QH::HostAddress& host);
|
||||
void connectToServer();
|
||||
|
||||
QList<UserPreview> localUsersPreview();
|
||||
|
||||
@ -67,9 +69,9 @@ public:
|
||||
\
|
||||
|
||||
protected:
|
||||
void nodeConfirmend(const QH::HostAddress &node) override;
|
||||
void nodeConnected(const QH::HostAddress &node) override;
|
||||
void nodeDisconnected(const QH::HostAddress &node) override;
|
||||
void nodeConfirmend(QH::AbstractNodeInfo* node) override;
|
||||
void nodeConnected(QH::AbstractNodeInfo *node) override;
|
||||
void nodeDisconnected(QH::AbstractNodeInfo *node) override;
|
||||
QByteArray hashgenerator(const QByteArray &data) override;
|
||||
QStringList SQLSources() const override;
|
||||
|
||||
@ -93,10 +95,11 @@ private:
|
||||
bool sendUserData(const QSharedPointer<LocalUser>& data);
|
||||
|
||||
bool isOnline(const QSharedPointer<LocalUser>& data);
|
||||
bool isOnlineAndLoginned(const QSharedPointer<LocalUser>& data);
|
||||
|
||||
Status _status;
|
||||
QString _currentUserId;
|
||||
QH::HostAddress _serverAddress;
|
||||
const QH::HostAddress _serverAddress;
|
||||
QList<LocalUser*> _usersList;
|
||||
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
@ -74,6 +74,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
root->setContextProperty("backEnd", &back);
|
||||
root->setContextProperty("OnlineStatusQml", QVariant::fromValue(OnlineStatusQml{}));
|
||||
|
||||
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -109,6 +109,13 @@ GridLayout {
|
||||
id: eonline
|
||||
text: ""
|
||||
checked: privateRoot.onlieUser
|
||||
visible: privateRoot.onlineStatus === OnlineStatusQml.offline || privateRoot.onlineStatus === OnlineStatusQml.loggined
|
||||
|
||||
}
|
||||
|
||||
BusyIndicator {
|
||||
running: true;
|
||||
visible: !eonline.visible
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,6 +157,7 @@ GridLayout {
|
||||
|
||||
property string userName: (userModel)? userModel.name: ""
|
||||
property bool onlieUser: (userModel)? userModel.onlineUser: false
|
||||
property int onlineStatus: backEnd.onlineStatus
|
||||
|
||||
function accept() {
|
||||
if (userModel) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
30
HanoiTowers/client/onlinestatusqml.cpp
Normal file
30
HanoiTowers/client/onlinestatusqml.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include "onlinestatusqml.h"
|
||||
|
||||
OnlineStatusQml::OnlineStatusQml()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int OnlineStatusQml::offline() const {
|
||||
return static_cast<int>(OnlineStatus::Offline);
|
||||
}
|
||||
|
||||
int OnlineStatusQml::connecting() const {
|
||||
return static_cast<int>(OnlineStatus::Connecting);
|
||||
|
||||
}
|
||||
|
||||
int OnlineStatusQml::connected() const {
|
||||
return static_cast<int>(OnlineStatus::Connected);
|
||||
|
||||
}
|
||||
|
||||
int OnlineStatusQml::loginning() const {
|
||||
return static_cast<int>(OnlineStatus::Loginning);
|
||||
|
||||
}
|
||||
|
||||
int OnlineStatusQml::loggined() const {
|
||||
return static_cast<int>(OnlineStatus::Loggined);
|
||||
|
||||
}
|
37
HanoiTowers/client/onlinestatusqml.h
Normal file
37
HanoiTowers/client/onlinestatusqml.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef ONLINESTATUSQML_H
|
||||
#define ONLINESTATUSQML_H
|
||||
#include <QObject>
|
||||
|
||||
|
||||
enum class OnlineStatus: int {
|
||||
Offline,
|
||||
Connecting,
|
||||
Connected,
|
||||
Loginning,
|
||||
Loggined
|
||||
};
|
||||
|
||||
class OnlineStatusQml
|
||||
{
|
||||
Q_GADGET
|
||||
|
||||
Q_PROPERTY(int offline READ offline)
|
||||
Q_PROPERTY(int connecting READ connecting)
|
||||
Q_PROPERTY(int connected READ connected)
|
||||
Q_PROPERTY(int loginning READ loginning)
|
||||
Q_PROPERTY(int loggined READ loggined)
|
||||
|
||||
public:
|
||||
OnlineStatusQml();
|
||||
|
||||
Q_INVOKABLE int offline() const;
|
||||
Q_INVOKABLE int connecting() const;
|
||||
Q_INVOKABLE int connected() const;
|
||||
Q_INVOKABLE int loginning() const;
|
||||
Q_INVOKABLE int loggined() const;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(OnlineStatusQml)
|
||||
Q_DECLARE_METATYPE(OnlineStatus)
|
||||
|
||||
#endif // ONLINESTATUSQML_H
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018 - 2020 QuasarApp.
|
||||
//# Copyright (C) 2018 - 2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 QuasarApp.
|
||||
* Copyright (C) 2018-2021 QuasarApp.
|
||||
* Distributed under the lgplv3 software license, see the accompanying
|
||||
* Everyone is permitted to copy and distribute verbatim copies
|
||||
* of this license document, but changing it is not allowed.
|
||||
|
2
Heart
2
Heart
@ -1 +1 @@
|
||||
Subproject commit c7c2cea9af87fb818e8f09de8b80d0a5cbdaf709
|
||||
Subproject commit c517955a58fd33cc06a42fb4353dbfceead68aed
|
2
Patronum
2
Patronum
@ -1 +1 @@
|
||||
Subproject commit 2ec4264a70854ec21d4be70c555e9090a1b08ff6
|
||||
Subproject commit 7cf2f8049a189fbf30a83cdf0ac58ba45e309f13
|
Loading…
x
Reference in New Issue
Block a user