menu fuxes

This commit is contained in:
Andrei Yankovich 2020-11-03 00:00:48 +03:00
parent 95c4614787
commit 40bf6cccb8
7 changed files with 104 additions and 86 deletions

View File

@ -6,8 +6,8 @@
//#
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick 2.15
import QtQuick.Controls 2.15
import NotifyModule 1.0
import "./base" as Base
import "./menu" as Menu
@ -26,36 +26,95 @@ ApplicationWindow {
}
header: Menu.ToolBar {
state: "MainMenu"
state: stackview.state
onReturnToMenu: {
stackview.state = "MainMenu"
}
}
contentData: Loader {
id: core
source: "menu/MainMenu.qml"
contentData: SwipeView {
id: stackview
currentIndex: 0
anchors.fill: parent
interactive: false
Menu.MainMenu {
id: mainmenu
onStart: {
gamePage.start();
stackview.state = "Game"
property bool isLoad: false
}
onLoad: {
gamePage.load();
stackview.state = "Game"
function start() {
isLoad = false;
source = "../game.qml"
}
function load() {
isLoad = true;
source = "../game.qml"
}
onLoaded: {
if (isLoad) {
item.continue_game();
} else {
item.launch(-1);
}
onNewState: {
stackview.state = state;
}
}
Menu.UsersTable {
id: usersTable
}
Menu.Config {
id: configPage
}
About {
id: aboutPage
}
Game {
id: gamePage
}
states: [
State {
name: "MainMenu"
PropertyChanges {
target: stackview
currentIndex: 0
}
},
State {
name: "UsersTable"
PropertyChanges {
target: stackview
currentIndex: 1
}
},
State {
name: "Settings"
PropertyChanges {
target: stackview
currentIndex: 2
}
},
State {
name: "About"
PropertyChanges {
target: stackview
currentIndex: 3
}
},
State {
name: "Game"
PropertyChanges {
target: stackview
currentIndex: 4
}
}
]
}
NotificationServiceView {
anchors.fill: parent;
anchors.fill: parent;
}
}

View File

@ -18,39 +18,6 @@ Item {
id: theme;
}
Rectangle {
id: head
color: theme.headerColor
height: parent.height * 0.15;
RowLayout {
Base.BaseText {
Layout.alignment: Qt.AlignCenter
text: qsTr("Settings");
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: theme.headerSize;
}
Base.BaseButton {
text: qsTr("Return to main menu");
Layout.alignment: Qt.AlignRight
Layout.rightMargin: theme.pading
onClicked: {
menuPage.parent.source = "MainMenu.qml"
}
}
anchors.fill: parent
}
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
}
Row {
Image {
@ -109,7 +76,7 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.top: head.bottom
anchors.top: parent.top
}

View File

@ -18,6 +18,10 @@ Page {
id: theme;
}
signal load()
signal start()
signal newState(var state)
contentItem: Item {
id: content;
@ -33,8 +37,7 @@ Page {
text: qsTr("continue");
width: about.width * 0.8;
onClicked: {
menuPage.parent.load()
menuPage.load();
}
}
@ -47,8 +50,7 @@ Page {
text: qsTr("start");
width: about.width * 0.8;
onClicked: {
menuPage.parent.start()
menuPage.start();
}
}
@ -60,8 +62,7 @@ Page {
text: qsTr("About");
width: config.width * 0.8;
onClicked: {
menuPage.parent.source = "../about.qml"
newState("About")
}
}
@ -73,7 +74,8 @@ Page {
text: qsTr("Config");
width: exit.width * 0.8;
onClicked: {
menuPage.parent.source = "Config.qml"
newState("Settings")
}
}
@ -85,7 +87,7 @@ Page {
text: qsTr("Users");
width: exit.width * 0.8;
onClicked: {
menuPage.parent.source = "UsersTable.qml"
newState("UsersTable")
}
}

View File

@ -12,7 +12,7 @@ Rectangle {
property var client: backEnd.onlineStatus;
property int onlineStatus: (client)? client.status : 0
property bool returnButton: false
property bool profileLabel: false
property string wecomMessage: ""
function getStatusColor(status) {
switch(status) {
@ -23,29 +23,19 @@ Rectangle {
}
}
signal returnToMenu();
height: parent.height * 0.15;
RowLayout {
Base.BaseText {
Layout.alignment: Qt.AlignCenter
text: qsTr("Welcom to Hanoi Towers ") + backEnd.profile;
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: theme.headerSize;
visible: !profileLabel
}
Base.BaseText {
Layout.alignment: Qt.AlignCenter
text: qsTr("Profiles") + " (" + backEnd.profile + ")";
text: wecomMessage
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: theme.headerSize;
visible: profileLabel
}
Base.BaseButton {
@ -55,7 +45,7 @@ Rectangle {
visible: returnButton
onClicked: {
menuPage.parent.source = "MainMenu.qml"
returnToMenu()
}
}
@ -68,8 +58,8 @@ Rectangle {
PropertyChanges {
target: root
returnButton: false
profileLabel: false
visible: true
wecomMessage: qsTr("Welcom to Hanoi Towers ") + backEnd.profile
}
},
@ -78,8 +68,8 @@ Rectangle {
PropertyChanges {
target: root
returnButton: true
profileLabel: true
visible: true
wecomMessage: qsTr("Profiles") + " (" + backEnd.profile + ")";
}
},
@ -89,8 +79,8 @@ Rectangle {
PropertyChanges {
target: root
returnButton: true
profileLabel: false
visible: true
wecomMessage: qsTr("This are the main settings")
}
},
@ -100,8 +90,8 @@ Rectangle {
PropertyChanges {
target: root
returnButton: true
profileLabel: false
visible: true
wecomMessage: qsTr("About Page")
}
},
@ -111,8 +101,8 @@ Rectangle {
PropertyChanges {
target: root
returnButton: true
profileLabel: false
visible: false
wecomMessage: ""
}
}

View File

@ -2,9 +2,9 @@
<qresource prefix="/">
<file>main.qml</file>
<file>plate.qml</file>
<file>game.qml</file>
<file>Game.qml</file>
<file>Tower.qml</file>
<file>about.qml</file>
<file>About.qml</file>
<file>qtquickcontrols2.conf</file>
<file>res/icon.ico</file>
<file>base/BaseButton.qml</file>