-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.qml
327 lines (296 loc) · 11.5 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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtModel 1.0
import "components"
import "pages"
ApplicationWindow{
id: appWindow
visible: true
width: 500
height: 800
minimumWidth: 500
minimumHeight: 800
background: Rectangle{
anchors.fill: parent
color: ApplicationSettings.isDarkTheme ? "#1B1B1B" : "white"
}
onClosing: {
close.accepted = false
stackView.currentItem.popSignal()
}
StackView{
id: stackView
anchors.fill: parent
Connections{
target: stackView.currentItem
onSignalClose:{
stackView.pop()
}
onEditNote:{
stackView.push("qrc:/qml/pages/CreateNotePage.qml",{"appHeight": appWindow.height, "isEdit": true, "str_date": date})
}
ignoreUnknownSignals: true
}
background: Rectangle{
anchors.fill: parent
color: ApplicationSettings.isDarkTheme ? "#1B1B1B" : "white"
}
pushEnter: Transition {
ParallelAnimation{
ScaleAnimator {
from: 0.95
to: 1
duration: 400
easing.type: Easing.OutCubic
}
PropertyAnimation {
property: "opacity"
from: 0
to:1
duration: 200
}
}
}
popEnter: Transition {
ParallelAnimation{
ScaleAnimator {
from: 1.1
to: 1
duration: 400
easing.type: Easing.OutCubic
}
}
}
pushExit: Transition {}
popExit: Transition {}
initialItem: Pane{
id: stackInitial
padding: 0
function popSignal(){
if(settings.isOpen){
settings.isOpen = false
return
}
if(about.isOpen){
about.isOpen = false
return
}
if(menu.isOpen){
menu.isOpen = false
return
}
if(passwordDialog.isOpen){
passwordDialog.isOpen = false
return
}
Qt.quit()
}
background: Rectangle{
anchors.fill: parent
color: ApplicationSettings.isDarkTheme ? "#1B1B1B" : "white"
}
ListView{
id: listView
anchors.fill: parent
clip: true
model: NoteModel{
list: tableNote
}
delegate: ListViewComponent{}
headerPositioning: ListView.PullBackHeader
boundsBehavior: Flickable.StopAtBounds
boundsMovement: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar{
visible: true
width: 8
}
add: Transition {
PropertyAnimation {
property: "opacity"
from: 0
to: 1
duration: 300
easing.type: Easing.InOutQuad
}
}
moveDisplaced: Transition {
YAnimator{easing.type: Easing.OutCirc; duration: 200 }
}
header: Page{
id: listHeader
height: headerColumn.implicitHeight
width: appWindow.width
clip: true
z: 2
background: Rectangle{
anchors.fill: parent
color: ApplicationSettings.isDarkTheme ? "#1B1B1B" : "white"
}
Column{
id: headerColumn
width: parent.width
spacing: 40
bottomPadding: 20
Pane{
width: parent.width
height: 60
padding: 0
background: Rectangle{
anchors.fill: parent
color: "transparent"
}
MenuButton{
height: 21
width: 30
anchors.left: parent.left
anchors.leftMargin: 15
anchors.verticalCenter: parent.verticalCenter
onClicked: function(){menu.isOpen = true}
}
Button{
id: addButton
height: 39
padding: 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
onClicked: {tableAction.resetList(); stackView.push("qrc:/qml/pages/CreateNotePage.qml",{"appHeight": appWindow.height})}
background: Rectangle{
anchors.fill: parent
radius: height/2
color: "#3073FA"
clip: true
Rectangle{
anchors.fill: parent
color: "#408DFB"
radius: height/2
opacity: addButton.pressed ? 1 : 0
Behavior on opacity {
NumberAnimation{
duration: 200
}
}
}
}
contentItem: Row{
Rectangle{
width: addButton.height
height: addButton.height
color: "transparent"
Rectangle{
width: 2
height: parent.height/2.4
color: "white"
anchors.centerIn: parent
}
Rectangle{
width: parent.width/2.4
height: 2
color: "white"
anchors.centerIn: parent
}
}
Label{
text: "Новая заметка"
height: parent.height
font.pixelSize: height/2.5
font.family: ApplicationSettings.font
leftPadding: 0
rightPadding: 15
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "white"
}
}
}
SettingsButton{
height: 23
width: 30
anchors.right: parent.right
anchors.rightMargin: 8
anchors.verticalCenter: parent.verticalCenter
onClicked: function(){settings.isOpen = true}
}
}
Column{
width: parent.width/1.05
anchors.horizontalCenter: parent.horizontalCenter
leftPadding: 20
FontLoader{
id: headerFont
source: "qrc:/font/header_font.ttf"
}
Label{
text: "Мои заметки"
font.pixelSize: 35
font.family: headerFont.name
color: ApplicationSettings.isDarkTheme ? "silver" : "#4E4E4E"
}
Label{
property var date: new Date()
text: date.getDate() + " " + ApplicationSettings.getMonth(date.getMonth()) + ", " + ApplicationSettings.getDayOfWeek(date.getDay())
font.pixelSize: 25
font.family: headerFont.name
color: "#7C7C7C"
}
}
}
}
}
Column{
width: parent.width
visible: listView.count === 0
anchors.centerIn: parent
opacity: listView.count === 0 ? 1 : 0
Behavior on opacity{
NumberAnimation{
duration: 300
}
}
Column{
anchors.horizontalCenter: parent.horizontalCenter
spacing: 5
Label{
text: "Распланируйте свои дни"
font.pixelSize: 18
font.family: ApplicationSettings.font
font.bold: true
color: ApplicationSettings.isDarkTheme ? "silver" : "#454545"
anchors.horizontalCenter: parent.horizontalCenter
}
Label{
text: "Добавьте заметки"
font.pixelSize: 15
font.family: ApplicationSettings.font
color: "#909090"
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
}
}
SettingsOverlay{
id: settings; isOpen: false
}
MenuOverlay{
id: menu; isOpen: false
}
SetPasswordOverlay{
id: passwordDialog; isOpen: false
}
PasswordPage{
id: passwordPage
visible: ApplicationSettings.blockAppOnStart()
}
AboutPage{
id: about; isOpen: false
}
SnackBar{
id: snackBar; anchors.fill: parent
Connections{
target: ApplicationSettings
onSnackBarShowed: snackBar.show(info_text)
}
}
}