2019-12-19 07:46:16 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-07-13 05:39:01 -04:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
2020-03-16 09:04:59 -04:00
|
|
|
import QtQuick.Window 2.12
|
2019-08-30 19:21:51 -04:00
|
|
|
import QtGraphicalEffects 1.12
|
2019-04-28 15:18:36 -04:00
|
|
|
import "Base"
|
2019-12-10 15:17:41 -04:00
|
|
|
import "MainPane"
|
2019-04-27 18:54:33 -04:00
|
|
|
|
2019-08-30 19:09:21 -04:00
|
|
|
Item {
|
2019-04-27 21:07:20 -04:00
|
|
|
id: mainUI
|
2019-12-18 17:00:02 -04:00
|
|
|
|
|
|
|
property bool accountsPresent:
|
2019-12-02 16:29:29 -04:00
|
|
|
ModelStore.get("accounts").count > 0 || py.startupAnyAccountsSaved
|
2019-12-18 17:00:02 -04:00
|
|
|
|
2020-04-03 06:13:45 -04:00
|
|
|
readonly property var accountIds: {
|
|
|
|
const ids = []
|
|
|
|
const model = ModelStore.get("accounts")
|
|
|
|
|
|
|
|
for (let i = 0; i < model.count; i++)
|
|
|
|
ids.push(model.get(i).id)
|
|
|
|
|
|
|
|
return ids
|
|
|
|
}
|
|
|
|
|
2020-03-28 07:18:00 -04:00
|
|
|
readonly property alias debugConsole: debugConsole
|
2019-12-10 15:17:41 -04:00
|
|
|
readonly property alias mainPane: mainPane
|
2019-09-17 16:30:04 -04:00
|
|
|
readonly property alias pageLoader: pageLoader
|
|
|
|
readonly property alias pressAnimation: pressAnimation
|
2020-05-16 14:28:29 -04:00
|
|
|
readonly property alias fontMetrics: fontMetrics
|
2020-07-11 00:51:53 -04:00
|
|
|
readonly property alias idleManager: idleManager
|
2019-12-18 17:00:02 -04:00
|
|
|
|
2020-03-12 22:16:33 -04:00
|
|
|
function reloadSettings() {
|
|
|
|
py.loadSettings(() => { mainUI.pressAnimation.start() })
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-12 00:25:57 -04:00
|
|
|
focus: true
|
|
|
|
Component.onCompleted: window.mainUI = mainUI
|
|
|
|
|
2019-07-24 17:40:06 -04:00
|
|
|
SequentialAnimation {
|
2019-08-30 19:06:09 -04:00
|
|
|
id: pressAnimation
|
2019-12-16 04:42:41 -04:00
|
|
|
HNumberAnimation {
|
|
|
|
target: mainUI; property: "scale"; from: 1.0; to: 0.9
|
|
|
|
}
|
|
|
|
HNumberAnimation {
|
|
|
|
target: mainUI; property: "scale"; from: 0.9; to: 1.0
|
|
|
|
}
|
2019-07-24 17:40:06 -04:00
|
|
|
}
|
2019-04-28 00:44:55 -04:00
|
|
|
|
2020-03-28 07:18:00 -04:00
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.startPythonDebugger
|
|
|
|
onActivated: py.call("BRIDGE.pdb")
|
2019-12-19 13:41:57 -04:00
|
|
|
}
|
|
|
|
|
2020-03-28 07:18:00 -04:00
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.reloadConfig
|
|
|
|
onActivated: reloadSettings()
|
|
|
|
}
|
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.zoomIn
|
|
|
|
onActivated: theme.uiScale += 0.1
|
|
|
|
}
|
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.zoomOut
|
|
|
|
onActivated: theme.uiScale = Math.max(0.1, theme.uiScale - 0.1)
|
|
|
|
}
|
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.zoomReset
|
|
|
|
onActivated: theme.uiScale = 1
|
|
|
|
}
|
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.toggleCompactMode
|
|
|
|
onActivated: {
|
|
|
|
settings.compactMode = ! settings.compactMode
|
|
|
|
settingsChanged()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-16 14:28:29 -04:00
|
|
|
FontMetrics {
|
|
|
|
id: fontMetrics
|
|
|
|
font.family: theme.fontFamily.sans
|
|
|
|
font.pixelSize: theme.fontSize.normal
|
|
|
|
font.pointSize: -1
|
|
|
|
}
|
|
|
|
|
2020-03-28 07:18:00 -04:00
|
|
|
DebugConsole {
|
|
|
|
id: debugConsole
|
|
|
|
target: mainUI
|
|
|
|
visible: false
|
2019-12-19 13:41:57 -04:00
|
|
|
}
|
2019-08-22 13:03:26 -04:00
|
|
|
|
2020-07-11 00:51:53 -04:00
|
|
|
IdleManager {
|
|
|
|
id: idleManager
|
|
|
|
}
|
|
|
|
|
2019-08-30 19:21:51 -04:00
|
|
|
LinearGradient {
|
2019-08-28 19:34:50 -04:00
|
|
|
id: mainUIGradient
|
2020-03-19 00:13:38 -04:00
|
|
|
visible: ! image.visible
|
2019-08-28 19:34:50 -04:00
|
|
|
anchors.fill: parent
|
2019-08-30 19:21:51 -04:00
|
|
|
start: theme.ui.gradientStart
|
|
|
|
end: theme.ui.gradientEnd
|
|
|
|
|
2019-08-28 19:34:50 -04:00
|
|
|
gradient: Gradient {
|
2019-08-30 19:21:51 -04:00
|
|
|
GradientStop { position: 0.0; color: theme.ui.gradientStartColor }
|
|
|
|
GradientStop { position: 1.0; color: theme.ui.gradientEndColor }
|
2019-08-28 19:34:50 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-19 00:13:38 -04:00
|
|
|
HImage {
|
|
|
|
id: image
|
|
|
|
visible: Boolean(Qt.resolvedUrl(source))
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
2020-07-17 07:26:31 -04:00
|
|
|
animatedFillMode: AnimatedImage.PreserveAspectCrop
|
2020-03-19 00:13:38 -04:00
|
|
|
source: theme.ui.image
|
|
|
|
sourceSize.width: Screen.width
|
|
|
|
sourceSize.height: Screen.height
|
|
|
|
anchors.fill: parent
|
|
|
|
asynchronous: false
|
|
|
|
}
|
|
|
|
|
2019-12-10 15:17:41 -04:00
|
|
|
MainPane {
|
|
|
|
id: mainPane
|
2019-12-21 13:12:02 -04:00
|
|
|
maximumSize: parent.width - theme.minimumSupportedWidth * 1.5
|
2019-12-08 14:43:41 -04:00
|
|
|
}
|
2019-04-27 18:54:33 -04:00
|
|
|
|
2019-12-18 17:00:02 -04:00
|
|
|
PageLoader {
|
2019-12-08 14:43:41 -04:00
|
|
|
id: pageLoader
|
|
|
|
anchors.fill: parent
|
2020-07-14 03:31:01 -04:00
|
|
|
anchors.leftMargin:
|
|
|
|
mainPane.requireDefaultSize &&
|
|
|
|
mainPane.minimumSize > mainPane.maximumSize ?
|
2020-07-14 16:01:51 -04:00
|
|
|
mainPane.calculatedSizeNoRequiredMinimum :
|
2020-07-14 03:31:01 -04:00
|
|
|
mainPane.visibleSize
|
|
|
|
|
2020-07-14 03:56:58 -04:00
|
|
|
visible: mainPane.visibleSize < mainUI.width
|
2019-09-17 16:30:04 -04:00
|
|
|
}
|
2019-04-27 18:54:33 -04:00
|
|
|
}
|