Snake/src/Core/CrawlModule/MainMenu.qml

123 lines
2.4 KiB
QML
Raw Normal View History

//#
//# Copyright (C) 2021-2021 QuasarApp.
//# Distributed under the GPLv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
2021-06-05 14:19:08 +03:00
import QtQuick 2.15
import QtQuick.Controls.Material 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
2021-05-25 17:18:56 +03:00
Item {
id: item1
property var model: null
visible: true
z: 1
GridLayout {
id: columnLayout
anchors.top: parent.top
anchors.bottom: parent.bottom
2021-05-27 16:10:31 +03:00
anchors.left: parent.left
2021-05-25 17:18:56 +03:00
anchors.right: parent.right
anchors.leftMargin: 0
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.topMargin: 0
columns: 3
rows: 2
transformOrigin: Item.Center
MainMenuButton {
id: play
text: qsTr("Play game")
onClicked: {
2021-06-10 18:07:04 +03:00
selectLvl.open()
2021-05-25 17:18:56 +03:00
}
}
MainMenuButton {
id: settings
text: qsTr("My Settings")
onClicked: {
2021-05-31 16:27:37 +03:00
settingsPopUp.open();
2021-05-25 17:18:56 +03:00
}
}
MainMenuButton {
id: exit
text: qsTr("Exit")
onClicked: {
Qt.quit();
}
}
}
PagePopUp {
id: settingsPopUp
source: SettingsView {
id: settingsView
model: item1.model ? item1.model.userSettingsModel: null
}
standardButtons: Dialog.Save | Dialog.Cancel | Dialog.RestoreDefaults
modal: false;
2021-07-10 18:39:00 +03:00
width: parent.width * 0.8
height: parent.height * 0.8;
2021-05-25 17:18:56 +03:00
onAccepted: {
settingsView.save();
}
onReset: {
settingsView.reset();
}
onOpened: {
settingsView.update();
}
}
2021-06-08 18:00:18 +03:00
PagePopUp {
id: selectLvl
2021-06-10 18:07:04 +03:00
source: SelectLvlView {
2021-06-11 18:09:03 +03:00
id: view
2021-06-08 18:00:18 +03:00
model: item1.model ? item1.model.availableLvlsModel: null
2021-06-13 15:16:46 +03:00
onStart: {
if (!item1.model)
return;
item1.model.newGame(view.selectedLvl)
2021-06-21 10:57:31 +03:00
selectLvl.close();
2021-06-13 15:16:46 +03:00
}
2021-06-08 18:00:18 +03:00
}
modal: false;
2021-07-10 18:39:00 +03:00
width: parent.width * 0.8
height: parent.height * 0.8;
2021-06-08 18:00:18 +03:00
}
2021-05-25 17:18:56 +03:00
}
/*##^## Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/