4
0
mirror of https://github.com/QuasarApp/Hanoi-Towers.git synced 2025-05-14 18:39:33 +00:00

fix world table updates

This commit is contained in:
Andrei Yankovich 2021-03-11 17:47:44 +03:00
parent 427a5841ff
commit 029e47e518
16 changed files with 147 additions and 136 deletions

@ -13,7 +13,7 @@ bool World::fromSqlRecord(const QSqlRecord &q) {
data.userName = q.value("userName").toString();
data.record = q.value("points").toInt();
softUpdatePrivate({data});
softUpdatePrivate({{data.id, data}});
return true;
}
@ -89,29 +89,30 @@ bool World::softUpdate(const WorldUpdate &update) {
return false;
}
_data -= update.getDataRemove();
for (const auto& removeVal : qAsConst(update.getDataRemove())) {
_data.remove(removeVal);
}
return true;
}
bool World::softUpdatePrivate(const QSet<UserPreview>& val) {
bool World::softUpdatePrivate(const QHash<QString, UserPreview>& val) {
QString bestid = getBestUserId();
auto it = _data.find(UserPreview(bestid));
auto it = _data.value(bestid);
int bestRecord = 0;
if (it != _data.end()) {
bestRecord = (*it).record;
if (_data.contains(bestid)) {
bestRecord = _data[bestid].record;
}
bool userChanged = false;
for (const auto &item : val) {
if (item.record >= bestRecord) {
bestRecord = item.record;
bestid = item.id;
for (auto item = val.begin(); item != val.end(); ++item ) {
if (item->record >= bestRecord) {
bestRecord = item->record;
bestid = item->id;
userChanged = true;
}
_data += item;
_data[item.key()] = *item;
}
if (userChanged) {
@ -123,8 +124,13 @@ bool World::softUpdatePrivate(const QSet<UserPreview>& val) {
bool World::hardUpdate(const WorldUpdate &update) {
_data += update.getDataAddUpdate();
_data -= update.getDataRemove();
for (const auto& removeVal : qAsConst(update.getDataAddUpdate())) {
_data.insert(removeVal.id, removeVal);
}
for (const auto& removeVal : qAsConst(update.getDataRemove())) {
_data.remove(removeVal);
}
if (_data.size()) {
QString newBest = fullSearch()->id;
@ -137,7 +143,7 @@ bool World::hardUpdate(const WorldUpdate &update) {
return true;
}
QSet<UserPreview>::ConstIterator World::fullSearch() const {
QHash<QString, UserPreview>::ConstIterator World::fullSearch() const {
auto lessThen = [](const UserPreview & left, const UserPreview &right) {
return left.record <= right.record;
};
@ -160,11 +166,11 @@ unsigned int World::getWorldVersion() const {
return _worldVersion;
}
QSet<UserPreview> World::getData() const {
QHash<QString, UserPreview> World::getData() const {
return _data;
}
void World::setData(const QSet<UserPreview> &data) {
void World::setData(const QHash<QString, UserPreview> &data) {
_data = data;
}
@ -173,9 +179,9 @@ bool World::applyUpdate(const WorldUpdate &update) {
if (update.getWorldVersion() != _worldVersion + 1) {
return false;
}
auto oldBestUser = UserPreview{getBestUserId()};
if (update.getDataRemove().contains(oldBestUser) ||
update.getDataAddUpdate().contains(oldBestUser)) {
if (update.getDataRemove().contains(getBestUserId()) ||
update.getDataAddUpdate().contains(getBestUserId())) {
hardUpdate(update);
} else {

@ -31,8 +31,8 @@ public:
void setSignToken(const QH::AccessToken &token) override;
QSet<UserPreview> getData() const;
void setData(const QSet<UserPreview> &data);
QHash<QString, UserPreview> getData() const;
void setData(const QHash<QString, UserPreview> &data);
bool applyUpdate(const WorldUpdate& update);
unsigned int getWorldVersion() const;
const QString &getBestUserId() const;
@ -49,12 +49,12 @@ protected:
private:
bool softUpdate(const WorldUpdate& update);
bool softUpdatePrivate(const QSet<UserPreview> &);
bool softUpdatePrivate(const QHash<QString, UserPreview> &);
bool hardUpdate(const WorldUpdate& update);
QSet<UserPreview>::ConstIterator fullSearch() const;
QHash<QString, UserPreview>::ConstIterator fullSearch() const;
QSet<UserPreview> _data;
QHash<QString, UserPreview> _data;
QH::AccessToken _token;
unsigned int _subscribeId;
unsigned int _worldVersion = 0;

@ -60,18 +60,18 @@ void WorldUpdate::setWorldVersion(unsigned int worldVersion) {
_worldVersion = worldVersion;
}
const QSet<UserPreview>& WorldUpdate::getDataRemove() const {
const QSet<QString>& WorldUpdate::getDataRemove() const {
return _dataRemove;
}
void WorldUpdate::setDataRemove(const QSet<UserPreview> &dataRemove) {
void WorldUpdate::setDataRemove(const QSet<QString> &dataRemove) {
_dataRemove = dataRemove;
}
const QSet<UserPreview>& WorldUpdate::getDataAddUpdate() const {
const QHash<QString, UserPreview> &WorldUpdate::getDataAddUpdate() const {
return _dataAddUpdate;
}
void WorldUpdate::setDataAddUpdate(const QSet<UserPreview> &dataAddUpdate) {
void WorldUpdate::setDataAddUpdate(const QHash<QString, UserPreview> &dataAddUpdate) {
_dataAddUpdate = dataAddUpdate;
}

@ -28,11 +28,11 @@ public:
void setSignToken(const QH::AccessToken &) override;
// StreamBase interface
const QSet<UserPreview> &getDataAddUpdate() const;
void setDataAddUpdate(const QSet<UserPreview> &dataAddUpdate);
const QHash<QString, UserPreview> &getDataAddUpdate() const;
void setDataAddUpdate(const QHash<QString, UserPreview> &dataAddUpdate);
const QSet<UserPreview>& getDataRemove() const;
void setDataRemove(const QSet<UserPreview> &dataRemove);
const QSet<QString> &getDataRemove() const;
void setDataRemove(const QSet<QString> &dataRemove);
unsigned int getWorldVersion() const;
void setWorldVersion(unsigned int worldVersion);
@ -43,8 +43,8 @@ protected:
private:
QSet<UserPreview> _dataAddUpdate;
QSet<UserPreview> _dataRemove;
QHash<QString, UserPreview> _dataAddUpdate;
QSet<QString> _dataRemove;
QH::AccessToken _token;
unsigned int _subscribeId;
unsigned int _worldVersion = 0;
@ -52,4 +52,6 @@ private:
};
Q_DECLARE_METATYPE(WorldUpdate)
Q_DECLARE_METATYPE(QSharedPointer<WorldUpdate>)
#endif // WORLDUPDATE_H

@ -153,9 +153,9 @@ void HanoiServer::updateWorld(const UserPreview &user, bool isRemove) {
update->setWorldVersion(_world->getWorldVersion() + 1);
if (isRemove)
update->setDataRemove({user});
update->setDataRemove({user.id});
else
update->setDataAddUpdate({user});
update->setDataAddUpdate({{user.id, user}});
_worldHistory[update->getWorldVersion()] = update;

@ -41,8 +41,8 @@ void HanoiService::handleReceive(const QList<Patronum::Feature> &data) {
for (const auto& i: data) {
if (i.cmd() == "ping") {
sendResuylt("Pong");
} else if (i.cmd() == "Players") {
//_server->
} else if (i.cmd() == "State") {
sendResuylt(_server->getWorkState().toString());
} else {
notSupported += i;
}
@ -55,7 +55,7 @@ QList<Patronum::Feature> HanoiService::supportedFeatures() {
QList<Patronum::Feature> data;
data << Patronum::Feature("ping");
data << Patronum::Feature("Players");
data << Patronum::Feature("State");
return data;
}

@ -69,22 +69,22 @@ BackEnd::BackEnd(QQmlApplicationEngine *engine):
engine->addImageProvider("HanoiImages", _imageProvider);
connect(_loginModel , &LoginView::LVMainModel::sigLoginRequest,
connect(_loginModel, &LoginView::LVMainModel::sigLoginRequest,
this, &BackEnd::handleOnlineRequest);
connect(_loginModel , &LoginView::LVMainModel::sigRegisterRequest,
connect(_loginModel, &LoginView::LVMainModel::sigRegisterRequest,
this, &BackEnd::handleOnlineRegisterRequest);
connect(_createNewOfflineUser , &LoginView::LVMainModel::sigRegisterRequest,
this, &BackEnd::handleCreateNewProfile);
connect(_client , &HanoiClient::requestError,
connect(_client, &HanoiClient::requestError,
this, &BackEnd::handleOnlineRequestError);
connect(_client , &HanoiClient::userDataChanged,
connect(_client, &HanoiClient::userDataChanged,
this, &BackEnd::handleAcceptUserData);
connect(_client , &HanoiClient::statusChanged,
connect(_client, &HanoiClient::statusChanged,
this, &BackEnd::setOnlineStatus);
connect(_client, &HanoiClient::worldChanged,
@ -101,7 +101,6 @@ BackEnd::BackEnd(QQmlApplicationEngine *engine):
setProfile(_settings->getStrValue(CURRENT_PROFILE_KEY, DEFAULT_USER_ID));
init();
}
void BackEnd::init() {
@ -501,10 +500,10 @@ void BackEnd::handleWorldChanged(QSharedPointer<WorldUpdate> delta) {
}
for (const auto &val: qAsConst(delta->getDataRemove())) {
_world->removeSourceItem(val.id);
_world->removeSourceItem(val);
}
}
void BackEnd::handleWorldInited(QSet<UserPreview> initWorldList) {
void BackEnd::handleWorldInited(QHash<QString, UserPreview> initWorldList) {
_world->setSource({initWorldList.begin(), initWorldList.end()});
}

@ -201,7 +201,7 @@ private slots:
void handleAcceptUserData(QSharedPointer<LocalUser> profileId);
void setOnlineStatus(QH::ClientStatus onlineStatus);
void handleWorldChanged(QSharedPointer<WorldUpdate>);
void handleWorldInited(QSet<UserPreview> initWorldList);
void handleWorldInited(QHash<QString, UserPreview> initWorldList);
private:
void init();

@ -35,8 +35,10 @@ HanoiClient::HanoiClient() {
new QH::SqlDBWriter());
qRegisterMetaType<QSharedPointer<LocalUser>>();
qRegisterMetaType<QSet<UserPreview>>();
qRegisterMetaType<QHash<QString,UserPreview>>();
qRegisterMetaType<QSharedPointer<UserPreview>>();
qRegisterMetaType<WorldUpdate>();
qRegisterMetaType<QSharedPointer<WorldUpdate>>();
registerPackageType<UserData>();
registerPackageType<FixWorldRequest>();
@ -269,6 +271,7 @@ bool HanoiClient::setProfile(const QString &userId,
}
emit userDataChanged(user);
resetUser();
if ( user->online() && connectToServer()) {
auto userMember = DataConverter::toUserMember(user);

@ -73,7 +73,7 @@ signals:
void sigBestuserIdChanged(const QString &userId);
void worldChanged(QSharedPointer<WorldUpdate>);
void worldInited(QSet<UserPreview>);
void worldInited(QHash<QString, UserPreview>);
private slots:
void handleNewBestUser(QString userId);

@ -28,68 +28,68 @@
<translation>Create new user</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="147"/>
<location filename="../backEnd.cpp" line="149"/>
<source>Connect error</source>
<translation>Connection error</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="148"/>
<location filename="../backEnd.cpp" line="150"/>
<source>Failed to connect to server please check network connection befor login</source>
<translation>Failed to connect to server please check network connection befor login</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="182"/>
<location filename="../backEnd.cpp" line="188"/>
<source>login error</source>
<translation>Login error</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="183"/>
<location filename="../backEnd.cpp" line="189"/>
<source>Failed to login into online account, please check your password and username</source>
<translation>Failed to login into online account, please check your password and username</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="193"/>
<location filename="../backEnd.cpp" line="199"/>
<source>Register online error</source>
<translation></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="194"/>
<location filename="../backEnd.cpp" line="200"/>
<source>Failed to register this account, if this account was created by you, try to restore it.</source>
<translation>Failed to register this account, if this account was created by you, try to restore it.</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="204"/>
<location filename="../backEnd.cpp" line="226"/>
<location filename="../backEnd.cpp" line="210"/>
<location filename="../backEnd.cpp" line="232"/>
<source>Server error</source>
<translation>Server error</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="211"/>
<location filename="../backEnd.cpp" line="217"/>
<source>User with this id is not registered. If it you then use please the sigup form.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="219"/>
<location filename="../backEnd.cpp" line="225"/>
<source>User with this id already registered. If it you then use please the login form.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="361"/>
<location filename="../backEnd.cpp" line="371"/>
<source>Create user error</source>
<translation>User create error</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="362"/>
<location filename="../backEnd.cpp" line="372"/>
<source>Failed to create a new user, The name %0 alredy used.</source>
<translation>Failed to create a new user, This name %0 alredy used.</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="393"/>
<location filename="../backEnd.cpp" line="403"/>
<source>current profile not online!</source>
<translation>Current profile is offline!</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="393"/>
<location filename="../backEnd.cpp" line="403"/>
<source>Remove online error</source>
<translation>Error remove online user data</translation>
</message>
@ -181,17 +181,17 @@
<context>
<name>HanoiClient</name>
<message>
<location filename="../hanoiclient.cpp" line="175"/>
<location filename="../hanoiclient.cpp" line="177"/>
<source>Local user has been updated</source>
<translation>Local user has been updated</translation>
</message>
<message>
<location filename="../hanoiclient.cpp" line="175"/>
<location filename="../hanoiclient.cpp" line="177"/>
<source>local user accept nbew data from the server.</source>
<translation>Local user accept new data from the server.</translation>
</message>
<message>
<location filename="../hanoiclient.cpp" line="343"/>
<location filename="../hanoiclient.cpp" line="352"/>
<source>Internal Error, server send invalid data, and this data can&apos;t be saved into local database.</source>
<translation>Internal Error, server send invalid data, and this data can&apos;t be saved into local database.</translation>
</message>

@ -32,68 +32,68 @@
<translation></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="147"/>
<location filename="../backEnd.cpp" line="149"/>
<source>Connect error</source>
<translation></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="148"/>
<location filename="../backEnd.cpp" line="150"/>
<source>Failed to connect to server please check network connection befor login</source>
<translation></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="182"/>
<location filename="../backEnd.cpp" line="188"/>
<source>login error</source>
<translation></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="183"/>
<location filename="../backEnd.cpp" line="189"/>
<source>Failed to login into online account, please check your password and username</source>
<translation></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="193"/>
<location filename="../backEnd.cpp" line="199"/>
<source>Register online error</source>
<translation></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="194"/>
<location filename="../backEnd.cpp" line="200"/>
<source>Failed to register this account, if this account was created by you, try to restore it.</source>
<translation></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="204"/>
<location filename="../backEnd.cpp" line="226"/>
<location filename="../backEnd.cpp" line="210"/>
<location filename="../backEnd.cpp" line="232"/>
<source>Server error</source>
<translation></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="211"/>
<location filename="../backEnd.cpp" line="217"/>
<source>User with this id is not registered. If it you then use please the sigup form.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="219"/>
<location filename="../backEnd.cpp" line="225"/>
<source>User with this id already registered. If it you then use please the login form.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="361"/>
<location filename="../backEnd.cpp" line="371"/>
<source>Create user error</source>
<translation></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="362"/>
<location filename="../backEnd.cpp" line="372"/>
<source>Failed to create a new user, The name %0 alredy used.</source>
<translation> %0 使</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="393"/>
<location filename="../backEnd.cpp" line="403"/>
<source>current profile not online!</source>
<translation></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="393"/>
<location filename="../backEnd.cpp" line="403"/>
<source>Remove online error</source>
<translation></translation>
</message>
@ -192,17 +192,17 @@
<context>
<name>HanoiClient</name>
<message>
<location filename="../hanoiclient.cpp" line="175"/>
<location filename="../hanoiclient.cpp" line="177"/>
<source>Local user has been updated</source>
<translation></translation>
</message>
<message>
<location filename="../hanoiclient.cpp" line="175"/>
<location filename="../hanoiclient.cpp" line="177"/>
<source>local user accept nbew data from the server.</source>
<translation>NBEWデータを受け入れます</translation>
</message>
<message>
<location filename="../hanoiclient.cpp" line="343"/>
<location filename="../hanoiclient.cpp" line="352"/>
<source>Internal Error, server send invalid data, and this data can&apos;t be saved into local database.</source>
<translation></translation>
</message>

@ -32,68 +32,68 @@
<translation>Создать нового пользователя</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="147"/>
<location filename="../backEnd.cpp" line="149"/>
<source>Connect error</source>
<translation>Ошибка подключения</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="148"/>
<location filename="../backEnd.cpp" line="150"/>
<source>Failed to connect to server please check network connection befor login</source>
<translation>Ошибка подключения к серверу, пожалуйста проверьте интернет соединение перед входом</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="182"/>
<location filename="../backEnd.cpp" line="188"/>
<source>login error</source>
<translation>Ошибк входа</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="183"/>
<location filename="../backEnd.cpp" line="189"/>
<source>Failed to login into online account, please check your password and username</source>
<translation>Ошибка входа в онлайн аккаунт, пожалуйста проверьте свой логин и пароль</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="193"/>
<location filename="../backEnd.cpp" line="199"/>
<source>Register online error</source>
<translation>Ошибка регистрации</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="194"/>
<location filename="../backEnd.cpp" line="200"/>
<source>Failed to register this account, if this account was created by you, try to restore it.</source>
<translation>Не удалось зарегистрировать аккаунт, если этот аккаунт был создан вами попробуйте восстановить его.</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="204"/>
<location filename="../backEnd.cpp" line="226"/>
<location filename="../backEnd.cpp" line="210"/>
<location filename="../backEnd.cpp" line="232"/>
<source>Server error</source>
<translation>Ошибка сервера</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="211"/>
<location filename="../backEnd.cpp" line="217"/>
<source>User with this id is not registered. If it you then use please the sigup form.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="219"/>
<location filename="../backEnd.cpp" line="225"/>
<source>User with this id already registered. If it you then use please the login form.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="361"/>
<location filename="../backEnd.cpp" line="371"/>
<source>Create user error</source>
<translation>Ошибка создания пользователя</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="362"/>
<location filename="../backEnd.cpp" line="372"/>
<source>Failed to create a new user, The name %0 alredy used.</source>
<translation>Не удалось создать пользователя. Данное имя %0 уже используется</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="393"/>
<location filename="../backEnd.cpp" line="403"/>
<source>current profile not online!</source>
<translation>Текущий профиль не в сети!</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="393"/>
<location filename="../backEnd.cpp" line="403"/>
<source>Remove online error</source>
<translation>Ошибка удаления данных онлайн-пользователя</translation>
</message>
@ -192,17 +192,17 @@
<context>
<name>HanoiClient</name>
<message>
<location filename="../hanoiclient.cpp" line="175"/>
<location filename="../hanoiclient.cpp" line="177"/>
<source>Local user has been updated</source>
<translation>Локальный пользователь обновлён</translation>
</message>
<message>
<location filename="../hanoiclient.cpp" line="175"/>
<location filename="../hanoiclient.cpp" line="177"/>
<source>local user accept nbew data from the server.</source>
<translation>Локальный пользователь принял новые данные с сервера.</translation>
</message>
<message>
<location filename="../hanoiclient.cpp" line="343"/>
<location filename="../hanoiclient.cpp" line="352"/>
<source>Internal Error, server send invalid data, and this data can&apos;t be saved into local database.</source>
<translation>Внутренняя ошибка, сервер отправил неверные данные, и эти данные не могут быть сохранены в локальной базе данных.</translation>
</message>

@ -32,68 +32,68 @@
<translation>Yeni kullanıcı oluştur</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="147"/>
<location filename="../backEnd.cpp" line="149"/>
<source>Connect error</source>
<translation>Bağlantı hatası</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="148"/>
<location filename="../backEnd.cpp" line="150"/>
<source>Failed to connect to server please check network connection befor login</source>
<translation>Sunucuya bağlanılamadı, lütfen oturum açmadan önce bağlantısını kontrol edin</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="182"/>
<location filename="../backEnd.cpp" line="188"/>
<source>login error</source>
<translation>sisteme giriş hatası</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="183"/>
<location filename="../backEnd.cpp" line="189"/>
<source>Failed to login into online account, please check your password and username</source>
<translation>Çevrimiçi hesaba giriş yapılamadı, lütfen şifrenizi ve kullanıcı adınızı kontrol edin</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="193"/>
<location filename="../backEnd.cpp" line="199"/>
<source>Register online error</source>
<translation>Çevrimiçi kayıt hatası</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="194"/>
<location filename="../backEnd.cpp" line="200"/>
<source>Failed to register this account, if this account was created by you, try to restore it.</source>
<translation>Bu hesap kaydedilemedi, bu hesap sizin tarafınızdan oluşturulduysa, geri yüklemeyi deneyin.</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="204"/>
<location filename="../backEnd.cpp" line="226"/>
<location filename="../backEnd.cpp" line="210"/>
<location filename="../backEnd.cpp" line="232"/>
<source>Server error</source>
<translation>Server hatası</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="211"/>
<location filename="../backEnd.cpp" line="217"/>
<source>User with this id is not registered. If it you then use please the sigup form.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="219"/>
<location filename="../backEnd.cpp" line="225"/>
<source>User with this id already registered. If it you then use please the login form.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="361"/>
<location filename="../backEnd.cpp" line="371"/>
<source>Create user error</source>
<translation>Kullanıcı hatası oluştur</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="362"/>
<location filename="../backEnd.cpp" line="372"/>
<source>Failed to create a new user, The name %0 alredy used.</source>
<translation>Yeni bir kullanıcı oluşturulamadı, %0 adı kullanıldı.</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="393"/>
<location filename="../backEnd.cpp" line="403"/>
<source>current profile not online!</source>
<translation>Mevcut profil çevrimdışı!</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="393"/>
<location filename="../backEnd.cpp" line="403"/>
<source>Remove online error</source>
<translation>Çevrimiçi kullanıcı verilerini kaldırma hatası</translation>
</message>
@ -193,17 +193,17 @@ Bu seviye için minimum adımlar: %2</translation>
<context>
<name>HanoiClient</name>
<message>
<location filename="../hanoiclient.cpp" line="175"/>
<location filename="../hanoiclient.cpp" line="177"/>
<source>Local user has been updated</source>
<translation>Yerel kullanıcı güncellendi</translation>
</message>
<message>
<location filename="../hanoiclient.cpp" line="175"/>
<location filename="../hanoiclient.cpp" line="177"/>
<source>local user accept nbew data from the server.</source>
<translation>yerel kullanıcı sunucudan yeni verileri kabul eder.</translation>
</message>
<message>
<location filename="../hanoiclient.cpp" line="343"/>
<location filename="../hanoiclient.cpp" line="352"/>
<source>Internal Error, server send invalid data, and this data can&apos;t be saved into local database.</source>
<translation>Dahili Hata, sunucu geçersiz veri gönderdi ve bu veriler yerel veritabanına kaydedilemez.</translation>
</message>

@ -32,68 +32,68 @@
<translation>Створити нового користувача</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="147"/>
<location filename="../backEnd.cpp" line="149"/>
<source>Connect error</source>
<translation>Помилка підключення</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="148"/>
<location filename="../backEnd.cpp" line="150"/>
<source>Failed to connect to server please check network connection befor login</source>
<translation>Не вдалося підключитися до сервера, перевірте мережеве підключення для входу</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="182"/>
<location filename="../backEnd.cpp" line="188"/>
<source>login error</source>
<translation>помилка входу</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="183"/>
<location filename="../backEnd.cpp" line="189"/>
<source>Failed to login into online account, please check your password and username</source>
<translation>Не вдалося увійти в онлайн-акаунт, перевірте свій пароль та імя користувача</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="193"/>
<location filename="../backEnd.cpp" line="199"/>
<source>Register online error</source>
<translation>помилка реєстрації в Інтернеті</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="194"/>
<location filename="../backEnd.cpp" line="200"/>
<source>Failed to register this account, if this account was created by you, try to restore it.</source>
<translation>Не вдалося зареєструвати цей обліковий запис, якщо цей обліковий запис був створений вами, спробуйте відновити його.</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="204"/>
<location filename="../backEnd.cpp" line="226"/>
<location filename="../backEnd.cpp" line="210"/>
<location filename="../backEnd.cpp" line="232"/>
<source>Server error</source>
<translation>Помилка серверу</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="211"/>
<location filename="../backEnd.cpp" line="217"/>
<source>User with this id is not registered. If it you then use please the sigup form.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="219"/>
<location filename="../backEnd.cpp" line="225"/>
<source>User with this id already registered. If it you then use please the login form.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../backEnd.cpp" line="361"/>
<location filename="../backEnd.cpp" line="371"/>
<source>Create user error</source>
<translation>Помилка створення користувача</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="362"/>
<location filename="../backEnd.cpp" line="372"/>
<source>Failed to create a new user, The name %0 alredy used.</source>
<translation>Не вдалося створити нового користувача, імя %0 вже використовується.</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="393"/>
<location filename="../backEnd.cpp" line="403"/>
<source>current profile not online!</source>
<translation>Поточний профіль офлайн!</translation>
</message>
<message>
<location filename="../backEnd.cpp" line="393"/>
<location filename="../backEnd.cpp" line="403"/>
<source>Remove online error</source>
<translation>Помилка видалення онлайн даних користувачів</translation>
</message>
@ -193,17 +193,17 @@
<context>
<name>HanoiClient</name>
<message>
<location filename="../hanoiclient.cpp" line="175"/>
<location filename="../hanoiclient.cpp" line="177"/>
<source>Local user has been updated</source>
<translation>Локальний користувач був оновлений</translation>
</message>
<message>
<location filename="../hanoiclient.cpp" line="175"/>
<location filename="../hanoiclient.cpp" line="177"/>
<source>local user accept nbew data from the server.</source>
<translation>локальний користувач приймає нові дані з сервера.</translation>
</message>
<message>
<location filename="../hanoiclient.cpp" line="343"/>
<location filename="../hanoiclient.cpp" line="352"/>
<source>Internal Error, server send invalid data, and this data can&apos;t be saved into local database.</source>
<translation>Внутрішня помилка, сервер надсилає недійсні дані, і ці дані не можна зберегти в локальній базі даних.</translation>
</message>

@ -47,6 +47,7 @@ void RecordListModel::setSource(const QList<UserPreview> &data) {
void RecordListModel::updateAddSourceItem(const UserPreview &data) {
auto row = _data.indexOf(data);
if (row >= 0) {
_data[row] = data;
emit dataChanged(index(row, 0), index(row, 0));
} else {
beginInsertRows({}, _data.size(), _data.size());