mirror of
https://github.com/QuasarApp/Hanoi-Towers.git
synced 2025-05-15 02:49:33 +00:00
dev 3
This commit is contained in:
parent
b970946afa
commit
3fb5f5fd24
@ -1 +1 @@
|
||||
Subproject commit cf7628b7ba9ef4bdffb831a8a318cd9a2299e657
|
||||
Subproject commit 335c0c5ac99ebea2e6e45b2ee4dfe3a580e61dba
|
@ -19,9 +19,9 @@ void BackEnd::reset(){
|
||||
_settings->setValue("animation", true);
|
||||
_settings->setValue("randomColor", false);
|
||||
|
||||
// for (auto& item : _profileList) {
|
||||
// item->deleteLater();
|
||||
// }
|
||||
for (auto& item : _profileList) {
|
||||
item->deleteLater();
|
||||
}
|
||||
_profileList.clear();
|
||||
emit profileListChanged();
|
||||
|
||||
@ -55,7 +55,13 @@ bool BackEnd::init() {
|
||||
setRandomColor(_randomColor);
|
||||
setRandomColor(isFirstStart);
|
||||
|
||||
static_cast<GameState*>((_profileList["User"].
|
||||
auto profile = _profileList.value("User", nullptr);
|
||||
if (!profile) {
|
||||
profile = new ProfileData();
|
||||
_profileList["User"] = profile;
|
||||
}
|
||||
|
||||
static_cast<GameState*>((profile->
|
||||
gameState()))->saveLvl(
|
||||
static_cast<short>(lvl));
|
||||
|
||||
@ -134,5 +140,5 @@ QObject* BackEnd::gameState() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return _profileList[_profile].gameState();
|
||||
return _profileList[_profile]->gameState();
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ private:
|
||||
|
||||
QuasarAppUtils::Settings *_settings = nullptr;
|
||||
|
||||
QHash<QString, ProfileData> _profileList;
|
||||
QHash<QString, ProfileData*> _profileList;
|
||||
QString _profile;
|
||||
HanoiClient _client;
|
||||
|
||||
|
@ -96,7 +96,12 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/MainMenu.qml" line="96"/>
|
||||
<location filename="../menu/MainMenu.qml" line="95"/>
|
||||
<source>Users</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/MainMenu.qml" line="108"/>
|
||||
<source>exit</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -109,6 +114,24 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>UsersTable</name>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="16"/>
|
||||
<source>Online user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="24"/>
|
||||
<source>Enter the name of new user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="29"/>
|
||||
<source>Create new user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>about</name>
|
||||
<message>
|
||||
|
@ -108,7 +108,12 @@
|
||||
<translation>設定</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/MainMenu.qml" line="96"/>
|
||||
<location filename="../menu/MainMenu.qml" line="95"/>
|
||||
<source>Users</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/MainMenu.qml" line="108"/>
|
||||
<source>exit</source>
|
||||
<translation>出口</translation>
|
||||
</message>
|
||||
@ -121,6 +126,24 @@
|
||||
<translation>スタート</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>UsersTable</name>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="16"/>
|
||||
<source>Online user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="24"/>
|
||||
<source>Enter the name of new user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="29"/>
|
||||
<source>Create new user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>about</name>
|
||||
<message>
|
||||
|
@ -100,7 +100,12 @@
|
||||
<translation>Настройки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/MainMenu.qml" line="96"/>
|
||||
<location filename="../menu/MainMenu.qml" line="95"/>
|
||||
<source>Users</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/MainMenu.qml" line="108"/>
|
||||
<source>exit</source>
|
||||
<translation>Выход</translation>
|
||||
</message>
|
||||
@ -113,6 +118,24 @@
|
||||
<translation>Начать</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>UsersTable</name>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="16"/>
|
||||
<source>Online user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="24"/>
|
||||
<source>Enter the name of new user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="29"/>
|
||||
<source>Create new user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>about</name>
|
||||
<message>
|
||||
|
@ -100,7 +100,12 @@
|
||||
<translation>ayarlar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/MainMenu.qml" line="96"/>
|
||||
<location filename="../menu/MainMenu.qml" line="95"/>
|
||||
<source>Users</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/MainMenu.qml" line="108"/>
|
||||
<source>exit</source>
|
||||
<translation>çıkış</translation>
|
||||
</message>
|
||||
@ -113,6 +118,24 @@
|
||||
<translation>başla</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>UsersTable</name>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="16"/>
|
||||
<source>Online user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="24"/>
|
||||
<source>Enter the name of new user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="29"/>
|
||||
<source>Create new user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>about</name>
|
||||
<message>
|
||||
|
@ -100,7 +100,12 @@
|
||||
<translation>Конфігурація</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/MainMenu.qml" line="96"/>
|
||||
<location filename="../menu/MainMenu.qml" line="95"/>
|
||||
<source>Users</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/MainMenu.qml" line="108"/>
|
||||
<source>exit</source>
|
||||
<translation>Вихід</translation>
|
||||
</message>
|
||||
@ -113,6 +118,24 @@
|
||||
<translation>Почати</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>UsersTable</name>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="16"/>
|
||||
<source>Online user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="24"/>
|
||||
<source>Enter the name of new user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../menu/UsersTable.qml" line="29"/>
|
||||
<source>Create new user</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>about</name>
|
||||
<message>
|
||||
|
@ -37,7 +37,7 @@ Page {
|
||||
Base.BaseButton {
|
||||
id: load;
|
||||
Layout.preferredWidth: parent.width * 0.5;
|
||||
Layout.preferredHeight: parent.height * 0.18
|
||||
Layout.preferredHeight: parent.height * 0.15
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
|
||||
text: qsTr("continue");
|
||||
@ -51,7 +51,7 @@ Page {
|
||||
Base.BaseButton {
|
||||
id: start;
|
||||
Layout.preferredWidth: parent.width * 0.5;
|
||||
Layout.preferredHeight: parent.height * 0.18
|
||||
Layout.preferredHeight: parent.height * 0.15
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
|
||||
text: qsTr("start");
|
||||
@ -65,7 +65,7 @@ Page {
|
||||
Base.BaseButton {
|
||||
id: about;
|
||||
Layout.preferredWidth: parent.width * 0.5;
|
||||
Layout.preferredHeight: parent.height * 0.18
|
||||
Layout.preferredHeight: parent.height * 0.15
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
text: qsTr("About");
|
||||
width: config.width * 0.8;
|
||||
@ -78,7 +78,7 @@ Page {
|
||||
Base.BaseButton {
|
||||
id: config;
|
||||
Layout.preferredWidth: parent.width * 0.5;
|
||||
Layout.preferredHeight: parent.height * 0.18
|
||||
Layout.preferredHeight: parent.height * 0.15
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
text: qsTr("Config");
|
||||
width: exit.width * 0.8;
|
||||
@ -87,10 +87,22 @@ Page {
|
||||
}
|
||||
}
|
||||
|
||||
Base.BaseButton {
|
||||
id: users;
|
||||
Layout.preferredWidth: parent.width * 0.5;
|
||||
Layout.preferredHeight: parent.height * 0.15
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
text: qsTr("Users");
|
||||
width: exit.width * 0.8;
|
||||
onClicked: {
|
||||
menuPage.parent.source = "UsersTable.qml"
|
||||
}
|
||||
}
|
||||
|
||||
Base.BaseButton {
|
||||
id: exit;
|
||||
Layout.preferredWidth: parent.width * 0.5;
|
||||
Layout.preferredHeight: parent.height * 0.18
|
||||
Layout.preferredHeight: parent.height * 0.15
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
width: content.width * 0.5;
|
||||
text: qsTr("exit");
|
||||
|
84
hanoi_towers/menu/UsersTable.qml
Normal file
84
hanoi_towers/menu/UsersTable.qml
Normal file
@ -0,0 +1,84 @@
|
||||
import QtQuick 2.13
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls 2.13
|
||||
import QtQuick.Controls.Material 2.13
|
||||
|
||||
Item {
|
||||
GridLayout {
|
||||
id: gridLayout
|
||||
rows: 2
|
||||
columns: 3
|
||||
anchors.fill: parent
|
||||
|
||||
|
||||
Switch {
|
||||
id: element
|
||||
text: qsTr("Online user")
|
||||
}
|
||||
|
||||
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
||||
id: textField
|
||||
text: qsTr("Enter the name of new user")
|
||||
}
|
||||
|
||||
Button {
|
||||
id: button
|
||||
text: qsTr("Create new user")
|
||||
}
|
||||
|
||||
ListView {
|
||||
|
||||
id: listView
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.columnSpan: 3
|
||||
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
name: "Grey"
|
||||
colorCode: "grey"
|
||||
}
|
||||
|
||||
ListElement {
|
||||
name: "Red"
|
||||
colorCode: "red"
|
||||
}
|
||||
|
||||
ListElement {
|
||||
name: "Blue"
|
||||
colorCode: "blue"
|
||||
}
|
||||
|
||||
ListElement {
|
||||
name: "Green"
|
||||
colorCode: "green"
|
||||
}
|
||||
}
|
||||
delegate: Item {
|
||||
x: 5
|
||||
width: 80
|
||||
height: 40
|
||||
Row {
|
||||
id: row1
|
||||
spacing: 10
|
||||
Rectangle {
|
||||
width: 40
|
||||
height: 40
|
||||
color: colorCode
|
||||
}
|
||||
|
||||
Text {
|
||||
text: name
|
||||
font.bold: true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -8,7 +8,8 @@ void ProfileData::setOnlineProfile(bool onlineProfile) {
|
||||
_onlineProfile = onlineProfile;
|
||||
}
|
||||
|
||||
ProfileData::ProfileData(bool isOnline) {
|
||||
ProfileData::ProfileData(bool isOnline):
|
||||
QObject(nullptr) {
|
||||
_onlineProfile = isOnline;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
<file>SwitchLvl.qml</file>
|
||||
<file>base/BaseRadioButton.qml</file>
|
||||
<file>base/BoseCheckBox.qml</file>
|
||||
<file>menu/UsersTable.qml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/textures">
|
||||
<file>res/wood.png</file>
|
||||
|
Loading…
x
Reference in New Issue
Block a user