-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
120 lines (107 loc) · 2.56 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
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import API.LoginHandler 0.1
import API.NewsModel 0.1
import API.CommentModel 0.1
ApplicationWindow {
id: mainwindow
visible: true
width: 1040
height: 580
title: qsTr("Stack")
FontLoader { source: "font/fontello.ttf" }
StackView {
id: stackView
property bool searchMode: false
property bool tabBarNeeded: true
property real index
property bool loginFailed: false
property var mainModel: stackView.searchMode ? searchmodel : newsmodel
initialItem: mainpage
anchors.fill: parent
}
MyToolBar { id: toolbar }
Rectangle {
id: toolbarseprator
anchors.top: toolbar.bottom
width: parent.width
height: 1.5
color: "#E0E0E0"
}
Component {
id: mainpage
MainPage { }
}
Component {
id: loginpage
LoginPage { }
}
Component {
id: submitpage
SubmitPage { }
}
Component {
id: commentpage
CommentPage { }
}
CommentModel {
id: commentmodel
}
NewsModel {
id: newsmodel
Component.onCompleted: fetchNewsId();
onIsReadyChanged: {
if (isReady) {
getPostInfo()
}
}
}
NewsModel {
id: searchmodel
}
LoginHandler {
id: loginhandler
property bool loginattempt: false
property bool signout: false
onLoginChanged: {
if (login) {
stackView.pop()
stackView.tabBarNeeded = true
loginhandler.loginattempt = false
stackView.loginFailed = false
return
}
if (!loginhandler.signout && loginattempt) {
stackView.loginFailed = true
}
loginhandler.loginattempt = false
}
}
Item {
id: loading
visible: loginhandler.loginattempt
anchors.fill: parent
Rectangle {
anchors.fill: parent
opacity: 0.6
color: "#212121"
}
Label {
id: loadingchar
anchors.centerIn: parent
font.family: "fontello"
font.pixelSize: 60
color: "#f56565"
text: "\ue834"
}
RotationAnimation {
running: true
target: loadingchar
from: 0
to: 360
duration: 2000
loops: Animation.Infinite
}
}
}