2020-09-24 09:57:54 +10:00
|
|
|
// Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
|
2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-07-13 19:39:01 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
2020-03-17 00:04:59 +11:00
|
|
|
import QtQuick.Window 2.12
|
2019-08-31 09:21:51 +10:00
|
|
|
import QtGraphicalEffects 1.12
|
2019-04-29 05:18:36 +10:00
|
|
|
import "Base"
|
2019-12-11 06:17:41 +11:00
|
|
|
import "MainPane"
|
2019-04-28 08:54:33 +10:00
|
|
|
|
2019-08-31 09:09:21 +10:00
|
|
|
Item {
|
2019-04-28 11:07:20 +10:00
|
|
|
id: mainUI
|
2019-12-19 08:00:02 +11:00
|
|
|
|
|
|
|
property bool accountsPresent:
|
2019-12-03 07:29:29 +11:00
|
|
|
ModelStore.get("accounts").count > 0 || py.startupAnyAccountsSaved
|
2019-12-19 08:00:02 +11:00
|
|
|
|
2020-04-03 21:13:45 +11: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 22:18:00 +11:00
|
|
|
readonly property alias debugConsole: debugConsole
|
2019-12-11 06:17:41 +11:00
|
|
|
readonly property alias mainPane: mainPane
|
2019-09-18 06:30:04 +10:00
|
|
|
readonly property alias pageLoader: pageLoader
|
2020-05-17 04:28:29 +10:00
|
|
|
readonly property alias fontMetrics: fontMetrics
|
2020-07-11 14:51:53 +10:00
|
|
|
readonly property alias idleManager: idleManager
|
2019-12-19 08:00:02 +11:00
|
|
|
|
2020-07-12 14:25:57 +10:00
|
|
|
focus: true
|
|
|
|
Component.onCompleted: window.mainUI = mainUI
|
|
|
|
|
2020-03-28 22:18:00 +11:00
|
|
|
HShortcut {
|
2020-10-08 11:12:32 +11:00
|
|
|
sequences: window.settings.Keys.python_debugger
|
2020-03-28 22:18:00 +11:00
|
|
|
onActivated: py.call("BRIDGE.pdb")
|
2019-12-20 04:41:57 +11:00
|
|
|
}
|
|
|
|
|
2020-03-28 22:18:00 +11:00
|
|
|
HShortcut {
|
2020-10-08 11:12:32 +11:00
|
|
|
sequences: window.settings.Keys.zoom_in
|
2020-09-02 04:19:40 +10:00
|
|
|
onActivated: {
|
2020-10-08 11:12:32 +11:00
|
|
|
window.settings.General.zoom += 0.1
|
|
|
|
window.saveSettings()
|
2020-09-02 04:19:40 +10:00
|
|
|
}
|
2020-03-28 22:18:00 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
HShortcut {
|
2020-10-08 11:12:32 +11:00
|
|
|
sequences: window.settings.Keys.zoom_out
|
2020-09-02 04:19:40 +10:00
|
|
|
onActivated: {
|
2020-10-08 11:12:32 +11:00
|
|
|
window.settings.General.zoom =
|
|
|
|
Math.max(0.1, window.settings.General.zoom - 0.1)
|
|
|
|
|
|
|
|
window.saveSettings()
|
2020-09-02 04:19:40 +10:00
|
|
|
}
|
2020-03-28 22:18:00 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
HShortcut {
|
2020-10-08 11:12:32 +11:00
|
|
|
sequences: window.settings.Keys.reset_zoom
|
2020-09-02 04:19:40 +10:00
|
|
|
onActivated: {
|
2020-10-08 11:12:32 +11:00
|
|
|
window.settings.General.zoom = 1
|
|
|
|
window.saveSettings()
|
2020-09-02 04:19:40 +10:00
|
|
|
}
|
2020-03-28 22:18:00 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
HShortcut {
|
2020-10-08 11:12:32 +11:00
|
|
|
sequences: window.settings.Keys.compact
|
2020-03-28 22:18:00 +11:00
|
|
|
onActivated: {
|
2020-10-08 11:12:32 +11:00
|
|
|
window.settings.General.compact = ! window.settings.General.compact
|
|
|
|
windowsaveSettings()
|
2020-03-28 22:18:00 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-17 04:28:29 +10:00
|
|
|
FontMetrics {
|
|
|
|
id: fontMetrics
|
|
|
|
font.family: theme.fontFamily.sans
|
|
|
|
font.pixelSize: theme.fontSize.normal
|
|
|
|
font.pointSize: -1
|
|
|
|
}
|
|
|
|
|
2020-03-28 22:18:00 +11:00
|
|
|
DebugConsole {
|
|
|
|
id: debugConsole
|
|
|
|
target: mainUI
|
|
|
|
visible: false
|
2019-12-20 04:41:57 +11:00
|
|
|
}
|
2019-08-23 03:03:26 +10:00
|
|
|
|
2020-07-11 14:51:53 +10:00
|
|
|
IdleManager {
|
|
|
|
id: idleManager
|
|
|
|
}
|
|
|
|
|
2019-08-31 09:21:51 +10:00
|
|
|
LinearGradient {
|
2019-08-29 09:34:50 +10:00
|
|
|
id: mainUIGradient
|
2020-03-19 15:13:38 +11:00
|
|
|
visible: ! image.visible
|
2019-08-29 09:34:50 +10:00
|
|
|
anchors.fill: parent
|
2019-08-31 09:21:51 +10:00
|
|
|
start: theme.ui.gradientStart
|
|
|
|
end: theme.ui.gradientEnd
|
|
|
|
|
2019-08-29 09:34:50 +10:00
|
|
|
gradient: Gradient {
|
2019-08-31 09:21:51 +10:00
|
|
|
GradientStop { position: 0.0; color: theme.ui.gradientStartColor }
|
|
|
|
GradientStop { position: 1.0; color: theme.ui.gradientEndColor }
|
2019-08-29 09:34:50 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-19 15:13:38 +11:00
|
|
|
HImage {
|
|
|
|
id: image
|
|
|
|
visible: Boolean(Qt.resolvedUrl(source))
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
2020-07-17 21:26:31 +10:00
|
|
|
animatedFillMode: AnimatedImage.PreserveAspectCrop
|
2020-03-19 15:13:38 +11:00
|
|
|
source: theme.ui.image
|
|
|
|
sourceSize.width: Screen.width
|
|
|
|
sourceSize.height: Screen.height
|
|
|
|
anchors.fill: parent
|
|
|
|
asynchronous: false
|
|
|
|
}
|
|
|
|
|
2019-12-11 06:17:41 +11:00
|
|
|
MainPane {
|
|
|
|
id: mainPane
|
2019-12-22 04:12:02 +11:00
|
|
|
maximumSize: parent.width - theme.minimumSupportedWidth * 1.5
|
2019-12-09 05:43:41 +11:00
|
|
|
}
|
2019-04-28 08:54:33 +10:00
|
|
|
|
2019-12-19 08:00:02 +11:00
|
|
|
PageLoader {
|
2019-12-09 05:43:41 +11:00
|
|
|
id: pageLoader
|
|
|
|
anchors.fill: parent
|
2020-07-14 17:31:01 +10:00
|
|
|
anchors.leftMargin:
|
|
|
|
mainPane.requireDefaultSize &&
|
|
|
|
mainPane.minimumSize > mainPane.maximumSize ?
|
2020-07-15 06:01:51 +10:00
|
|
|
mainPane.calculatedSizeNoRequiredMinimum :
|
2020-07-14 17:31:01 +10:00
|
|
|
mainPane.visibleSize
|
|
|
|
|
2020-07-14 17:56:58 +10:00
|
|
|
visible: mainPane.visibleSize < mainUI.width
|
2019-09-18 06:30:04 +10:00
|
|
|
}
|
2019-04-28 08:54:33 +10:00
|
|
|
}
|