-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainPage.qml
173 lines (158 loc) · 4.41 KB
/
MainPage.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import QtQuick 2.9
import QtQuick.Controls 2.5
import QtQuick.Dialogs 1.2
Page {
title: persian.checked ? "خوش آمدید" : "Wellcome"
id: mainPage
background: Image {
id: image
source: "qrc:/Assets/Images/Main.jpg"
}
Dialog {
id: fileErr
title: persian.checked ? "خظای فایل" : "File Error"
Text {
id: fileErrTxt
text: persian.checked ? "برخی اطلاعات این فایل اشتباه هستند" : "Some of this file's details are invalid"
}
}
Connections {
target: bknd
onGameLoaded: mystack.push("GamePage.qml")
}
Connections {
target: bknd
onFileError: fileErr.open()
}
LoadGameDialog {
id: loadGameDialog
}
//start button style
Rectangle {
id: startRec
anchors.top: parent.top
anchors.topMargin: parent.height * 0.05
anchors.left: parent.left
anchors.leftMargin: parent.width * 0.05
width: parent.width * 0.2
height: parent.height * 0.1
gradient: Gradient {
GradientStop {
position: 0
color: "#00000000"
}
GradientStop {
position: 0.175
color: "#182127"
}
GradientStop {
position: 0.5
color: "#ffffff"
}
GradientStop {
position: 0.85
color: "#000000"
}
GradientStop {
position: 1
color: "#00000000"
}
}
//start button
Button {
id: start
anchors.fill: parent
text: persian.checked ? "بازی جدید" : "New game"
font.bold: true
font.italic: true
font.pixelSize: this.height * 0.2
onClicked: mystack.push("LoginPage.qml")
}
}
Rectangle {
id: loadRec
anchors.top: startRec.bottom
anchors.topMargin: image.height * 0.05
anchors.horizontalCenter: startRec.horizontalCenter
width: parent.width * 0.2
height: parent.height * 0.1
gradient: Gradient {
GradientStop {
position: 0
color: "#00000000"
}
GradientStop {
position: 0.175
color: "#182127"
}
GradientStop {
position: 0.5
color: "#ffffff"
}
GradientStop {
position: 0.85
color: "#000000"
}
GradientStop {
position: 1
color: "#00000000"
}
}
//loging button
Button {
id: load
anchors.fill: parent
text: persian.checked ? "بارگیری بازی" : "Load game"
font.bold: true
font.italic: true
font.pixelSize: this.height * 0.2
onClicked: {
bknd.getFiles() //get files in directory
loadGameDialog.modelCount = 0 //to refresh
loadGameDialog.modelCount = bknd.filesCount() //get files count
loadGameDialog.open()
}
}
}
//loging button style
Rectangle {
id: exitRec
anchors.top: loadRec.bottom
anchors.topMargin: image.height * 0.05
anchors.horizontalCenter: startRec.horizontalCenter
width: parent.width * 0.2
height: parent.height * 0.1
gradient: Gradient {
GradientStop {
position: 0
color: "#00000000"
}
GradientStop {
position: 0.175
color: "#182127"
}
GradientStop {
position: 0.5
color: "#ffffff"
}
GradientStop {
position: 0.85
color: "#000000"
}
GradientStop {
position: 1
color: "#00000000"
}
}
//loging button
Button {
id: exit
anchors.fill: parent
text: persian.checked ? "خروج" : "Exit"
font.bold: true
font.italic: true
font.pixelSize: this.height * 0.2
onClicked: Qt.quit()
}
}
}