-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMain.qml
107 lines (95 loc) · 3.21 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
/*
* This file is part of FlashbackPrism.
*
* Copyright (c) 2023 Luca Carlon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Author: Luca Carlon
* Company: -
* Date: 2023.24.13
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Material
import "qml/views"
ApplicationWindow {
property color statusBarColor: Material.background
readonly property rect visibleArea: {
Screen.orientation
const visibleArea_ = lqtQmlUtils.visibleDisplayFrame()
if (visibleArea_.width === 0)
return Qt.rect(0, 0, width, height)
return visibleArea_
}
id: mainWindow
width: 1280
height: 720
visible: true
title: "FlashbackPrism"
Material.theme: Material.Dark
Material.accent: Material.Purple
Component.onCompleted: {
lqtQmlUtils.setBarColorLight(false, true)
lqtQmlUtils.setStatusBarColor(Qt.rgba(0, 0, 0, 0))
lqtQmlUtils.setNavBarColor(Qt.rgba(0, 0, 0, 0))
}
Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: mainStackView.top
color: statusBarColor
}
StackView {
id: mainStackView
anchors.fill: parent
anchors.topMargin: {
Screen.orientation
return Math.max(lqtQmlUtils.safeAreaTopInset(), visibleArea.y)
}
//anchors.leftMargin: {
// Screen.orientation
// return Math.max(lqtQmlUtils.safeAreaLeftInset(), visibleArea.x)
//}
//anchors.rightMargin: {
// Screen.orientation
// return Math.max(lqtQmlUtils.safeAreaRightInset(),
// parent.width - visibleArea.x - visibleArea.width)
//}
anchors.bottomMargin: {
Screen.orientation
return Math.max(lqtQmlUtils.safeAreaBottomInset(),
parent.height - visibleArea.y - visibleArea.height)
}
initialItem: settingsNotifier.token ? albumsTodayComponent : loginComponent
Component.onCompleted: forceActiveFocus()
Keys.onPressed: function(event) {
if (event.key === Qt.Key_Back || event.key === Qt.Key_Escape)
handleBackKey(event)
}
function handleBackKey(event) {
if (mainStackView.depth === 1) {
Qt.quit()
return
}
mainStackView.pop()
event.accepted = true
}
}
Component { id: loginComponent; FPLogin {} }
Component { id: albumsTodayComponent; FPYearListView {} }
Component { id: dayViewComponent; FPYearView {} }
Component { id: photoViewComponent; FPPhotoView {} }
}