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.Layouts 1.12
|
2019-04-29 05:18:36 +10:00
|
|
|
import "../Base"
|
2019-03-26 18:19:55 +11:00
|
|
|
|
2019-05-12 07:51:00 +10:00
|
|
|
HRectangle {
|
2019-03-26 18:19:55 +11:00
|
|
|
id: sidePane
|
2019-07-16 22:52:26 +10:00
|
|
|
clip: true // Avoid artifacts when collapsed
|
2019-07-17 07:08:06 +10:00
|
|
|
// opacity: mainUI.accountsPresent && ! reduce ? 1 : 0
|
|
|
|
// visible: opacity > 0
|
2019-04-29 01:01:38 +10:00
|
|
|
|
2019-07-16 22:52:26 +10:00
|
|
|
|
2019-07-16 23:21:45 +10:00
|
|
|
property bool canAutoSize: true
|
2019-07-16 22:52:26 +10:00
|
|
|
property int parentWidth: parent.width
|
2019-07-17 02:37:11 +10:00
|
|
|
property real autoWidthRatio: theme.sidePane.autoWidthRatio
|
2019-07-16 22:52:26 +10:00
|
|
|
|
2019-07-16 23:21:45 +10:00
|
|
|
// Needed for SplitView because it breaks the binding on collapse
|
|
|
|
onParentWidthChanged: if (canAutoSize) {
|
|
|
|
width = Qt.binding(() => implicitWidth)
|
|
|
|
}
|
2019-07-16 22:52:26 +10:00
|
|
|
|
|
|
|
|
2019-07-16 23:21:45 +10:00
|
|
|
property int autoWidth:
|
2019-07-17 02:37:11 +10:00
|
|
|
Math.min(parentWidth * autoWidthRatio, theme.sidePane.maximumAutoWidth)
|
2019-07-12 12:25:50 +10:00
|
|
|
|
2019-07-16 23:21:45 +10:00
|
|
|
property bool collapse:
|
|
|
|
canAutoSize ?
|
|
|
|
autoWidth < theme.sidePane.autoCollapseBelowWidth :
|
2019-07-17 07:08:06 +10:00
|
|
|
width <= theme.sidePane.collapsedWidth
|
2019-07-16 22:36:11 +10:00
|
|
|
|
2019-07-16 23:21:45 +10:00
|
|
|
property bool reduce:
|
|
|
|
window.width < theme.sidePane.autoReduceBelowWindowWidth
|
2019-05-13 05:57:18 +10:00
|
|
|
|
2019-07-16 23:21:45 +10:00
|
|
|
property int implicitWidth:
|
|
|
|
reduce ? 0 :
|
|
|
|
collapse ? theme.sidePane.collapsedWidth :
|
|
|
|
autoWidth
|
2019-07-16 22:52:26 +10:00
|
|
|
|
2019-07-17 07:08:06 +10:00
|
|
|
property int currentSpacing:
|
|
|
|
collapse || reduce ? 0 : theme.spacing
|
2019-07-16 22:52:26 +10:00
|
|
|
|
2019-07-16 23:21:45 +10:00
|
|
|
Behavior on currentSpacing { HNumberAnimation {} }
|
|
|
|
Behavior on implicitWidth { HNumberAnimation {} }
|
2019-07-16 22:52:26 +10:00
|
|
|
|
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HColumnLayout {
|
2019-03-26 18:19:55 +11:00
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
AccountList {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2019-05-03 04:20:21 +10:00
|
|
|
|
2019-07-13 07:06:37 +10:00
|
|
|
spacing: currentSpacing
|
|
|
|
bottomMargin: currentSpacing
|
2019-03-26 18:19:55 +11:00
|
|
|
}
|
|
|
|
|
2019-07-03 03:59:52 +10:00
|
|
|
PaneToolBar {
|
|
|
|
id: paneToolBar
|
|
|
|
}
|
2019-03-26 18:19:55 +11:00
|
|
|
}
|
|
|
|
}
|