mirror of
https://github.com/QuasarApp/Hanoi-Towers.git
synced 2025-05-13 18:09:33 +00:00
fix client warnings
This commit is contained in:
parent
40bf6cccb8
commit
ed67f89f29
@ -80,7 +80,7 @@ Dialog {
|
||||
id: indicator
|
||||
width: height * 0.9
|
||||
color: "#3bffd1"
|
||||
active: !backEnd.isFirst;
|
||||
active: (backEnd)? !backEnd.isFirst(): false;
|
||||
anchors.left: text.right
|
||||
anchors.leftMargin: width / 2
|
||||
anchors.top: parent.top
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 36ae53f1beaf5af3a0f0c291e81f41f8bf6e2eb5
|
||||
Subproject commit a3c1dce2df24412961547fc1ce6ba5a16378185b
|
@ -173,17 +173,26 @@ bool BackEnd::randomColor() const {
|
||||
}
|
||||
|
||||
void BackEnd::setRandomColor(bool random) {
|
||||
_settings->setValue(RANDOM_COLOR_KEY, random);
|
||||
emit randomColorChanged();
|
||||
|
||||
if (_settingsData.randomColor != random) {
|
||||
|
||||
_settings->setValue(RANDOM_COLOR_KEY, random);
|
||||
_settingsData.randomColor = random;
|
||||
emit randomColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool BackEnd::animation() const{
|
||||
return _settings->getValue(ANIMATION_KEY, true).toBool();
|
||||
}
|
||||
|
||||
void BackEnd::setAnimation(bool name) {
|
||||
_settings->setValue(ANIMATION_KEY, name);
|
||||
emit animationChanged();
|
||||
void BackEnd::setAnimation(bool value) {
|
||||
if (_settingsData.animation != value) {
|
||||
|
||||
_settings->setValue(ANIMATION_KEY, value);
|
||||
_settingsData.animation = value;
|
||||
emit animationChanged();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short BackEnd::getMinSteps(const unsigned short lvl) const{
|
||||
@ -196,8 +205,6 @@ bool BackEnd::isFirst()const{
|
||||
|
||||
void BackEnd::setShowHelp(bool state) {
|
||||
_settings->setValue(FIRST_RUN_KEY, state);
|
||||
emit firstChanged();
|
||||
|
||||
}
|
||||
|
||||
BackEnd::~BackEnd() {
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "gamestate.h"
|
||||
#include "hanoiclient.h"
|
||||
#include "profiledata.h"
|
||||
#include "settingsdata.h"
|
||||
#include <quasarapp.h>
|
||||
#include <QObject>
|
||||
#include <QFile>
|
||||
@ -31,7 +32,6 @@ class RecordListModel;
|
||||
class BackEnd: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool isFirst READ isFirst WRITE setShowHelp NOTIFY firstChanged)
|
||||
Q_PROPERTY(bool randomColor READ randomColor WRITE setRandomColor NOTIFY randomColorChanged)
|
||||
Q_PROPERTY(bool animation READ animation WRITE setAnimation NOTIFY animationChanged)
|
||||
Q_PROPERTY(QObject* gameState READ gameState)
|
||||
@ -52,6 +52,17 @@ public:
|
||||
|
||||
Q_INVOKABLE bool createProfile(const QString &userId, const QString& userName);
|
||||
|
||||
/**
|
||||
* @brief isFirst
|
||||
* @return true if is first start
|
||||
*/
|
||||
Q_INVOKABLE bool isFirst()const;
|
||||
|
||||
/**
|
||||
* @brief setShowHelp set new state for show help message
|
||||
* @param state - a new state of show help message
|
||||
*/
|
||||
Q_INVOKABLE void setShowHelp(bool state);
|
||||
|
||||
public slots:
|
||||
|
||||
@ -62,17 +73,7 @@ public slots:
|
||||
*/
|
||||
unsigned short getMinSteps(const unsigned short lvl) const;
|
||||
|
||||
/**
|
||||
* @brief isFirst
|
||||
* @return true if is first start
|
||||
*/
|
||||
bool isFirst()const;
|
||||
|
||||
/**
|
||||
* @brief setShowHelp set new state for show help message
|
||||
* @param state - a new state of show help message
|
||||
*/
|
||||
void setShowHelp(bool state);
|
||||
|
||||
/**
|
||||
* @brief reset all config to default values.
|
||||
@ -95,7 +96,7 @@ public slots:
|
||||
* @brief setAnimation
|
||||
* @param name of new animation;
|
||||
*/
|
||||
void setAnimation(bool name);
|
||||
void setAnimation(bool valeu);
|
||||
|
||||
/**
|
||||
* @brief setRandomColor
|
||||
@ -128,7 +129,6 @@ public slots:
|
||||
void setReward(int);
|
||||
|
||||
signals:
|
||||
void firstChanged();
|
||||
void animationChanged();
|
||||
void randomColorChanged();
|
||||
void profileListChanged();
|
||||
@ -155,6 +155,8 @@ private:
|
||||
ProfileData *_profile = nullptr;
|
||||
HanoiClient _client;
|
||||
|
||||
SettingsData _settingsData;
|
||||
|
||||
};
|
||||
|
||||
#endif // SAVER_H
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Controls.Material 2.15
|
||||
import NotifyModule 1.0
|
||||
import "./base" as Base
|
||||
import "./menu" as Menu
|
||||
@ -25,7 +26,7 @@ ApplicationWindow {
|
||||
id: theme;
|
||||
}
|
||||
|
||||
header: Menu.ToolBar {
|
||||
header: Menu.ToolBarPage {
|
||||
state: stackview.state
|
||||
|
||||
onReturnToMenu: {
|
||||
@ -35,7 +36,7 @@ ApplicationWindow {
|
||||
|
||||
contentData: SwipeView {
|
||||
id: stackview
|
||||
currentIndex: 0
|
||||
state: "MainMenu"
|
||||
anchors.fill: parent
|
||||
interactive: false
|
||||
Menu.MainMenu {
|
||||
|
@ -18,65 +18,53 @@ Item {
|
||||
id: theme;
|
||||
}
|
||||
|
||||
Row {
|
||||
RowLayout {
|
||||
|
||||
Image {
|
||||
id: colorsView
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: (backEnd.randomColor)? "../img/random":"../img/standart"
|
||||
height: width
|
||||
width: menuPage.width * 0.5
|
||||
|
||||
}
|
||||
|
||||
Column {
|
||||
ColumnLayout {
|
||||
|
||||
id: colors
|
||||
width: colorsView.width
|
||||
height: colorsView.height
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: parent.width * 0.1
|
||||
anchors.left: colorsView.right
|
||||
|
||||
Layout.alignment: Layout.Center
|
||||
|
||||
RadioButton {
|
||||
id: r1
|
||||
checked: !backEnd.randomColor
|
||||
checked: backEnd&& !backEnd.randomColor
|
||||
text: qsTr("Standart color")
|
||||
|
||||
width: colorsView.width;
|
||||
onCheckedChanged: {
|
||||
backEnd.randomColor = false;
|
||||
if (backEnd)
|
||||
backEnd.randomColor = false;
|
||||
}
|
||||
}
|
||||
|
||||
RadioButton {
|
||||
id:r2
|
||||
checked: backEnd.randomColor
|
||||
checked: backEnd && backEnd.randomColor
|
||||
text: qsTr("Random color")
|
||||
width: colorsView.width;
|
||||
onCheckedChanged: {
|
||||
backEnd.randomColor = true;
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
height: colorsView.height * 0.3;
|
||||
width: colorsView.width;
|
||||
Component.onCompleted: {
|
||||
checked = backEnd.animation
|
||||
}
|
||||
text: qsTr("Animation")
|
||||
checked: backEnd.animation
|
||||
onCheckedChanged: {
|
||||
backEnd.animation = checked;
|
||||
}
|
||||
}
|
||||
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
}
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: parent.top
|
||||
Image {
|
||||
id: colorsView
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: (backEnd && backEnd.randomColor)? "../img/random":"../img/standart"
|
||||
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
}
|
||||
|
||||
|
@ -4,16 +4,16 @@ import QtQuick.Layouts 1.3
|
||||
|
||||
import "./../base" as Base
|
||||
|
||||
Rectangle {
|
||||
ToolBar {
|
||||
id: root
|
||||
|
||||
color: getStatusColor(onlineStatus)
|
||||
|
||||
property var client: backEnd.onlineStatus;
|
||||
property var client: (backEnd)? backEnd.onlineStatus: null;
|
||||
property int onlineStatus: (client)? client.status : 0
|
||||
property bool returnButton: false
|
||||
property string wecomMessage: ""
|
||||
|
||||
property string p_profile: (backEnd)? backEnd.profile: ""
|
||||
|
||||
function getStatusColor(status) {
|
||||
switch(status) {
|
||||
|
||||
@ -25,12 +25,16 @@ Rectangle {
|
||||
|
||||
signal returnToMenu();
|
||||
|
||||
height: parent.height * 0.15;
|
||||
background: Rectangle {
|
||||
color: getStatusColor(onlineStatus)
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
||||
|
||||
Base.BaseText {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
Layout.preferredHeight: returnBut.height
|
||||
|
||||
text: wecomMessage
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
@ -38,7 +42,8 @@ Rectangle {
|
||||
font.pixelSize: theme.headerSize;
|
||||
}
|
||||
|
||||
Base.BaseButton {
|
||||
ToolButton {
|
||||
id: returnBut
|
||||
text: qsTr("Return to main menu");
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Layout.rightMargin: theme.pading
|
||||
@ -59,7 +64,7 @@ Rectangle {
|
||||
target: root
|
||||
returnButton: false
|
||||
visible: true
|
||||
wecomMessage: qsTr("Welcom to Hanoi Towers ") + backEnd.profile
|
||||
wecomMessage: qsTr("Welcom to Hanoi Towers ") + p_profile
|
||||
|
||||
}
|
||||
},
|
||||
@ -69,7 +74,7 @@ Rectangle {
|
||||
target: root
|
||||
returnButton: true
|
||||
visible: true
|
||||
wecomMessage: qsTr("Profiles") + " (" + backEnd.profile + ")";
|
||||
wecomMessage: qsTr("Profiles") + " (" + p_profile + ")";
|
||||
|
||||
}
|
||||
},
|
@ -55,7 +55,7 @@ Item {
|
||||
Layout.columnSpan: 3
|
||||
clip: true
|
||||
|
||||
model: backEnd.profileList
|
||||
model: (backEnd)? backEnd.profileList: null
|
||||
delegate: UserTableDelegate {
|
||||
|
||||
onRemovedRow: {
|
||||
@ -81,7 +81,7 @@ Item {
|
||||
|
||||
Connections {
|
||||
target: backEnd;
|
||||
onShowOnlinePage :{
|
||||
function onShowOnlinePage () {
|
||||
loginPopUp.open();
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
<file>base/BoseCheckBox.qml</file>
|
||||
<file>menu/UsersTable.qml</file>
|
||||
<file>menu/UserTableRow.qml</file>
|
||||
<file>menu/ToolBar.qml</file>
|
||||
<file>menu/ToolBarPage.qml</file>
|
||||
<file>menu/UserTableDelegate.qml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/textures">
|
||||
|
1
HanoiTowers/client/settingsdata.cpp
Normal file
1
HanoiTowers/client/settingsdata.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "settingsdata.h"
|
11
HanoiTowers/client/settingsdata.h
Normal file
11
HanoiTowers/client/settingsdata.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef SETTINGSDATA_H
|
||||
#define SETTINGSDATA_H
|
||||
|
||||
|
||||
struct SettingsData
|
||||
{
|
||||
bool animation = false;
|
||||
bool randomColor = false;
|
||||
};
|
||||
|
||||
#endif // SETTINGSDATA_H
|
Loading…
x
Reference in New Issue
Block a user