This repository has been archived by the owner on Jul 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.qml
153 lines (141 loc) · 3.96 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
import QtQuick 2.12
import QtQuick.Window 2.10
import QtQuick.Controls 2.15
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.3
//import Qt.labs.platform 1.1
import DB 1.0
ApplicationWindow {
id: window
visible: true
width: 640
height: 480
title: qsTr("Stack")
property string filename: ""
property string project: ""
property int fileid: 0;
property int caseid: 0;
property int codecatsid: 0;
property int filescatid: 0;
property int memotyp: 0;
property int memoid: 0;
property int journalid: 0;
Shortcut {
sequence: StandardKey.Quit
context: Qt.ApplicationShortcut
onActivated: Qt.quit()
}
SwipeView {
id: swipeView
anchors.fill: parent
currentIndex: tabBar.currentIndex
}
Database {
id: database
db: project
}
FileDialog {
id: fileDialog
title: "Please choose a file"
folder: shortcuts.home
onAccepted: {
console.log("You chose: " + fileDialog.fileUrls)
var str = ""
str = fileDialog.fileUrls.toString()
// remove prefixed "file://"
if (Qt.platform.os === "windows")
str = str.replace(/^(file:\/{3})/,"");
else
str = str.replace(/^(file:\/{2})/,"");
// unescape html codes like '%23' for '#'
str = decodeURIComponent(str);
// str += Qt.resolvedUrl(str) // what does this do?
project = str
}
onRejected: {
console.log("Canceled")
}
Component.onCompleted: visible = false
}
//menu containing two menu items
menuBar: MenuBar {
Menu {
title: qsTr("Project")
MenuItem {
text: qsTr("&Open")
onTriggered: fileDialog.open();
}
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
}
}
Menu {
title: qsTr("Settings")
}
}
header: TabBar {
id: tabBar
currentIndex: swipeView.currentIndex
TabButton {
text: qsTr("Project")
onClicked: {
stackView.push("qml/HomeForm.ui.qml")
}
}
TabButton {
text: qsTr("Files")
onClicked: {
files.files();
stackView.push("qml/Files.qml")
}
}
TabButton {
text: qsTr("Codes")
onClicked: {
codes.codes();
stackView.push("qml/Codes.qml")
}
}
TabButton {
text: qsTr("Code Categories")
onClicked: {
codecats.codecats();
stackView.push("qml/CodesCat.qml")
}
}
TabButton {
text: qsTr("Cases")
onClicked: {
cases.cases();
stackView.push("qml/Cases.qml")
}
}
TabButton {
text: qsTr("Attributes")
onClicked: {
attr.attr();
stackView.push("qml/Attributes.qml")
}
}
TabButton {
text: qsTr("File Categories")
onClicked: {
filescat.filescat();
stackView.push("qml/FilesCat.qml")
}
}
TabButton {
text: qsTr("Journals")
onClicked: {
journals.journals();
stackView.push("qml/Journals.qml")
}
}
}
StackView {
id: stackView
initialItem: "qml/HomeForm.ui.qml"
anchors.fill: parent
}
}