This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
130 lines (115 loc) · 3.92 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
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
import QtQuick.Layouts 1.3
ApplicationWindow {
id: mainWindow
visible: true
width: 1200
height: 800
title: instanceName
flags: Qt.Window | Qt.FramelessWindowHint | Qt.WindowMinMaxButtonsHint
Material.theme: arkzilla.darkTheme ? Material.Dark : Material.Light
Material.primary: Material.Green
Material.accent: Material.LightGreen
Material.elevation: 6
FontLoader { id: faSolid; source: 'fa-solid-900.ttf'}
font.pixelSize: 18
readonly property string appName: 'ARKZilla'
readonly property string instanceName: arkzilla.host.length ? appName + ' (' + arkzilla.host + ')' : appName
header: ToolBar {
opacity: active ? 1.0 : 0.5
RowLayout {
anchors.fill: parent
IconButton {
text: ''
color: 'white'
onClicked: stackWindow.pop()
visible: (stackWindow.depth > 1) ? true : false
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
MouseArea {
anchors.fill: parent
property variant clickPos
property variant window
onPressed: {
clickPos = { x: arkzilla.cursorPos.x, y: arkzilla.cursorPos.y }
window = { x: mainWindow.x, y: mainWindow.y }
}
onPositionChanged: {
mainWindow.setX(window.x + arkzilla.cursorPos.x - clickPos.x)
mainWindow.setY(window.y + arkzilla.cursorPos.y - clickPos.y)
}
onDoubleClicked: {
mainWindow.showMinimized()
}
}
}
IconButton {
text: ''
color: 'white'
ToolTip.text: qsTr('Open settings')
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered
visible: mainWindow.title != qsTr('Settings')
onClicked: stackWindow.push(settingsUI)
}
IconButton {
text: ''
color: 'white'
ToolTip.text: qsTr('Quit')
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered
onClicked: Qt.quit()
}
}
Label {
anchors.centerIn: parent
text: mainWindow.title
color: 'white'
elide: Label.ElideRight
}
}
StackView {
id: stackWindow
anchors.fill: parent
initialItem: backupUI
Component.onCompleted: {
if (!arkzilla.host.length) {
stackWindow.push(settingsUI)
}
}
Component { id: backupUI; BackupUI {} }
Component { id: tamedUI; TamedUI {} }
Component { id: settingsUI; SettingsUI {} }
}
ToastManager { id: toast }
Label {
height: width
anchors.right: parent.right
anchors.bottom: parent.bottom
rotation: -45
color: Material.primary
font.pixelSize: 40
font.family: faSolid.name
text: ''
MouseArea {
anchors.fill: parent
cursorShape: Qt.SizeFDiagCursor
property variant clickPos
property variant window
onPressed: {
clickPos = { x: arkzilla.cursorPos.x, y: arkzilla.cursorPos.y }
window = { w: mainWindow.width, h: mainWindow.height }
}
onPositionChanged: {
mainWindow.setWidth(window.w + arkzilla.cursorPos.x - clickPos.x)
mainWindow.setHeight(window.h + arkzilla.cursorPos.y - clickPos.y)
}
}
}
}