-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.qml
139 lines (130 loc) · 3.64 KB
/
main.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
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Window 2.3
import QtMultimedia 5.9
ApplicationWindow {
id: window
visible: true
width: Screen.width * 0.5
height: Screen.height * 0.75
Component.onCompleted: window.showFullScreen()
minimumHeight: 700
minimumWidth: 700
title: persian.checked ? "شطرنج پیشرفته" : "Advanced Chess"
InfoDialog {
id: infoDialog
}
header: ToolBar {
id: toolbar
height: window.height * 0.05
contentHeight: toolButton.implicitHeight
background: Rectangle {
id: toolbarRec
anchors.fill: parent
color: "black"
}
ToolButton {
id: toolButton
text: "\u2630"
font.pixelSize: parent.height * 0.6
anchors.verticalCenter: parent.verticalCenter
onClicked: drawer.open()
}
Label {
text: mystack.currentItem.title
anchors.centerIn: parent
}
}
Drawer {
id: drawer
width: window.width * 0.25
height: window.height
Rectangle {
anchors.fill: parent
color: "black"
Column {
anchors.fill: parent
Switch {
id: soundOn
text: persian.checked ? "صدا" : "Sound"
checked: true
}
Switch {
id: persian
text: "پارسی"
checked: false
}
Switch {
id: fullScreen
text: persian.checked ? "تمام صفحه" : "FullScreen"
checked: true
onCheckedChanged: {
this.checked ? window.showFullScreen(
) : window.showNormal()
}
}
}
Rectangle {
anchors.bottom: parent.bottom
anchors.bottomMargin: 8
anchors.left: parent.left
anchors.leftMargin: 8
width: parent.width * 0.2
height: parent.height * 0.06
Image {
anchors.fill: parent
source: "qrc:/Assets/Icons/info.png"
}
Button {
anchors.fill: parent
flat: true
id: infBtn
onPressed: {
infoDialog.open()
drawer.close()
}
}
}
}
}
StackView {
id: mystack
initialItem: "MainPage.qml"
anchors.fill: parent
//opening page animation
replaceEnter: Transition {}
//exiting page animation
replaceExit: Transition {
OpacityAnimator {
from: 1
to: 1
duration: 400
}
}
}
Audio {
id: music
autoLoad: true
autoPlay: true
playlist: Playlist {
playbackMode: Playlist.Loop
PlaylistItem {
source: "qrc:/Assets/Musics/Johann_Johannsson_Flight_From_The_City_2021.mp3"
}
}
}
Audio {
id: moveSound
autoLoad: true
autoPlay: false
playlist: Playlist {
PlaylistItem {
source: "qrc:/Assets/Sound_Effects/move.mp3"
}
}
}
Connections {
target: soundOn
onClicked: soundOn.checked ? music.play() : music.pause()
}
}