2019-07-08 13:52:41 +10:00
|
|
|
// Copyright 2019 miruka
|
|
|
|
// This file is part of harmonyqml, licensed under LGPLv3.
|
|
|
|
|
2019-07-13 19:39:01 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
2019-05-01 17:25:58 +10:00
|
|
|
import QtQuick.Window 2.7
|
2019-04-29 05:18:36 +10:00
|
|
|
import "Base"
|
|
|
|
import "SidePane"
|
2019-04-28 08:54:33 +10:00
|
|
|
|
2019-04-28 14:44:55 +10:00
|
|
|
Item {
|
2019-04-28 11:07:20 +10:00
|
|
|
id: mainUI
|
2019-04-28 14:44:55 +10:00
|
|
|
|
2019-07-03 03:59:52 +10:00
|
|
|
Connections {
|
|
|
|
target: py
|
|
|
|
onWillLoadAccounts: function(will) {
|
2019-07-09 02:52:07 +10:00
|
|
|
pageStack.showPage(will ? "Default": "SignIn")
|
2019-07-13 19:34:58 +10:00
|
|
|
if (will) {initialRoomTimer.start()}
|
2019-07-03 03:59:52 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-29 08:12:45 +10:00
|
|
|
property bool accountsPresent:
|
2019-07-05 06:01:44 +10:00
|
|
|
accounts.count > 0 || py.loadingAccounts
|
2019-06-27 16:31:03 +10:00
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HImage {
|
2019-04-28 14:44:55 +10:00
|
|
|
id: mainUIBackground
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
|
|
|
source: "../images/login_background.jpg"
|
2019-05-01 17:25:58 +10:00
|
|
|
sourceSize.width: Screen.width
|
|
|
|
sourceSize.height: Screen.height
|
2019-04-28 14:44:55 +10:00
|
|
|
anchors.fill: parent
|
2019-06-27 16:31:03 +10:00
|
|
|
asynchronous: false
|
2019-04-28 14:44:55 +10:00
|
|
|
}
|
2019-04-28 08:54:33 +10:00
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HSplitView {
|
2019-05-13 05:57:18 +10:00
|
|
|
id: uiSplitView
|
2019-04-28 08:54:33 +10:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2019-07-18 03:34:02 +10:00
|
|
|
onAnyResizingChanged: if (anyResizing) {
|
|
|
|
sidePane.manuallyResizing = true
|
|
|
|
} else {
|
|
|
|
sidePane.manuallyResizing = false
|
|
|
|
sidePane.manuallyResized = true
|
|
|
|
sidePane.manualWidth = sidePane.width
|
|
|
|
}
|
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
SidePane {
|
2019-05-13 06:13:00 +10:00
|
|
|
id: sidePane
|
2019-05-13 05:57:18 +10:00
|
|
|
|
2019-07-17 07:08:06 +10:00
|
|
|
// Initial width until user manually resizes
|
|
|
|
width: implicitWidth
|
2019-07-16 23:27:38 +10:00
|
|
|
Layout.minimumWidth: reduce ? 0 : theme.sidePane.collapsedWidth
|
2019-07-18 03:34:02 +10:00
|
|
|
Layout.maximumWidth:
|
|
|
|
window.width -theme.minimumSupportedWidthPlusSpacing
|
2019-07-16 23:27:38 +10:00
|
|
|
|
2019-07-18 03:34:02 +10:00
|
|
|
Behavior on Layout.minimumWidth { HNumberAnimation {} }
|
2019-04-28 08:54:33 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
StackView {
|
2019-04-28 14:44:55 +10:00
|
|
|
id: pageStack
|
|
|
|
|
2019-04-28 11:07:20 +10:00
|
|
|
function showPage(name, properties) {
|
2019-04-29 02:45:12 +10:00
|
|
|
pageStack.replace("Pages/" + name + ".qml", properties || {})
|
2019-04-28 08:54:33 +10:00
|
|
|
}
|
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
function showRoom(userId, category, roomId) {
|
2019-07-07 16:35:22 +10:00
|
|
|
var info = rooms.getWhere({
|
|
|
|
"userId": userId,
|
|
|
|
"roomId": roomId,
|
|
|
|
"category": category
|
|
|
|
}, 1)[0]
|
|
|
|
|
|
|
|
pageStack.replace("Chat/Chat.qml", {"roomInfo": info})
|
2019-04-28 08:54:33 +10:00
|
|
|
}
|
|
|
|
|
2019-05-13 03:17:42 +10:00
|
|
|
Timer {
|
|
|
|
// TODO: remove this, debug
|
|
|
|
id: initialRoomTimer
|
2019-07-16 19:08:27 +10:00
|
|
|
interval: 5000
|
2019-05-13 03:17:42 +10:00
|
|
|
repeat: false
|
2019-07-17 01:48:57 +10:00
|
|
|
// onTriggered: pageStack.showRoom(
|
|
|
|
// "@test_mary:matrix.org",
|
2019-07-16 22:10:37 +10:00
|
|
|
// "Rooms",
|
|
|
|
// "!TSXGsbBbdwsdylIOJZ:matrix.org"
|
2019-07-17 01:48:57 +10:00
|
|
|
// "Invites",
|
|
|
|
// "!xjqvLOGhMVutPXpAqi:matrix.org"
|
2019-07-16 19:08:27 +10:00
|
|
|
// )
|
2019-07-17 01:48:57 +10:00
|
|
|
onTriggered: pageStack.showPage(
|
|
|
|
"EditAccount/EditAccount",
|
|
|
|
{"userId": "@test_mary:matrix.org"}
|
|
|
|
)
|
2019-04-28 14:44:55 +10:00
|
|
|
}
|
2019-04-28 08:54:33 +10:00
|
|
|
|
|
|
|
onCurrentItemChanged: if (currentItem) {
|
|
|
|
currentItem.forceActiveFocus()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Buggy
|
|
|
|
replaceExit: null
|
|
|
|
popExit: null
|
|
|
|
pushExit: null
|
|
|
|
}
|
2019-05-07 03:07:00 +10:00
|
|
|
|
2019-06-27 16:31:03 +10:00
|
|
|
Keys.onEscapePressed: if (window.debug) { py.call("APP.pdb") }
|
2019-04-28 08:54:33 +10:00
|
|
|
}
|
|
|
|
}
|