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
|
2019-07-18 17:13:34 +10:00
|
|
|
onWillLoadAccounts: will => {
|
2019-07-09 02:52:07 +10:00
|
|
|
pageStack.showPage(will ? "Default": "SignIn")
|
2019-07-18 17:13:34 +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
|
2019-07-18 03:40:28 +10:00
|
|
|
source: "../images/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-07-19 13:59:05 +10:00
|
|
|
property bool isWide: width > theme.contentIsWideAbove
|
2019-04-28 14:44:55 +10:00
|
|
|
|
2019-07-18 17:35:30 +10:00
|
|
|
function showPage(name, properties={}) {
|
|
|
|
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-18 19:18:13 +10:00
|
|
|
let info = rooms.getWhere({userId, roomId, category}, 1)[0]
|
2019-07-07 16:35:22 +10:00
|
|
|
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-18 21:22:41 +10:00
|
|
|
interval: 4000
|
2019-05-13 03:17:42 +10:00
|
|
|
repeat: false
|
2019-07-21 08:28:00 +10:00
|
|
|
// onTriggered: pageStack.showRoom(
|
|
|
|
// "@test_mary:matrix.org",
|
|
|
|
// "Rooms",
|
2019-07-18 21:22:41 +10:00
|
|
|
// "!TSXGsbBbdwsdylIOJZ:matrix.org" // st
|
2019-07-20 09:19:43 +10:00
|
|
|
// "!VDSsFIzQnXARSCVNxS:matrix.org" // hs
|
2019-07-21 08:28:00 +10:00
|
|
|
// "!XhxUcnVhVhUHkBZEIL:matrix.org" // nc
|
2019-07-17 01:48:57 +10:00
|
|
|
// "Invites",
|
|
|
|
// "!xjqvLOGhMVutPXpAqi:matrix.org"
|
2019-07-19 13:50:23 +10:00
|
|
|
// )
|
2019-07-21 08:28:00 +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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|