-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.qml
173 lines (165 loc) · 5.2 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
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.1
import Qt.labs.settings 1.0 as Stgs
import QtGraphicalEffects 1.0
ApplicationWindow {
visible: true
width: 360
height: 520
title: "Plant Recognition"
id: window
Shortcut {
sequence: ["Esc", "Back"]
enabled: stackView.depth > 1
onActivated: {
stackView.pop()
}
}
onClosing: {
if (stackView !== null && stackView.depth !== 'undefined'
&& stackView.depth > 1) {
close.accepted = false
stackView.pop()
}
}
Dialog {
width: parent.width - 20
margins: 10
standardButtons: Dialog.Ok
id: snackbarOK
Column {
width: parent.width
Label {
id: snackbarOKT
wrapMode: Label.Wrap
width: parent.width
text: ''
}
}
}
Dialog {
width: parent.width - 20
margins: 10
standardButtons: Dialog.Ok
id: snackbar
title: "Ups..."
Column {
width: parent.width
Label {
id: snackbarT
wrapMode: Label.Wrap
width: parent.width
text: ''
}
}
}
Dialog {
id: aboutDialog
width: parent.width - 20
margins: 10
standardButtons: Dialog.Ok
Column {
width: parent.width
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: 'Plant image recognition'
font.weight: Font.Light
font.pixelSize: 16
}
Rectangle {
color: 'transparent'
width: 1
height: 10
}
Label {
anchors.horizontalCenter: parent.horizontalCenter
onLinkActivated: Qt.openUrlExternally(link)
text: "<a href='https://atlas.roslin.pl'>https://atlas.roslin.pl</a>"
}
Rectangle {
color: 'transparent'
width: 1
height: 10
}
Label {
wrapMode: Label.Wrap
horizontalAlignment: Text.AlignJustify
width: parent.width
text: "App uses MXNet and resnet CNN model trained over plant images available in Internet."
}
Label {
width: parent.width
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignJustify
font.pixelSize: 12
onLinkActivated: Qt.openUrlExternally(link)
text: "Source code find on <a href='https://github.com/mjamroz/PlantRecognition'>https://github.com/mjamroz/PlantRecognition</a>"
}
Rectangle {
color: 'transparent'
width: 1
height: 10
}
Label {
width: parent.width
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignJustify
onLinkActivated: Qt.openUrlExternally(link)
font.pixelSize: 12
text: "App may contains some bugs, let me know by <a href='mailto:[email protected]'>[email protected]</a>, and I'll try to fix it."
}
}
}
header: ToolBar {
id: hdr
RowLayout {
spacing: 20
anchors.fill: parent
Label {
id: titleLabel
text: "Plant image recognition"
font.pixelSize: 20
color: 'white'
elide: Label.ElideRight
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: true
}
ToolButton {
id: tb
contentItem: Image {
id: neigh
fillMode: Image.Pad
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
source: "images/menu.png"
}
onClicked: optionsMenu.open()
Menu {
id: optionsMenu
x: parent.width - width
transformOrigin: Menu.TopRight
MenuItem {
text: "Recognize plant"
onTriggered: stackView.push(Qt.resolvedUrl("pages/IdentifyPlant.qml"))
}
MenuItem {
text: "Download data"
onTriggered: stackView.push(Qt.resolvedUrl("pages/DownloadOffline.qml"))
}
MenuItem {
text: "About"
onTriggered: aboutDialog.open()
}
}
}
}
}
StackView {
id: stackView
anchors.fill: parent
initialItem: (MXNet.modelExists()) ? Qt.resolvedUrl("pages/IdentifyPlant.qml") : stackView.push(Qt.resolvedUrl("pages/DownloadOffline.qml"))
}
}