2019-07-07 23:52:41 -04:00
|
|
|
// Copyright 2019 miruka
|
|
|
|
// This file is part of harmonyqml, licensed under LGPLv3.
|
|
|
|
|
2019-07-13 05:39:01 -04:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
2019-04-28 15:18:36 -04:00
|
|
|
import "../Base"
|
2019-03-26 03:19:55 -04:00
|
|
|
|
2019-05-11 17:51:00 -04:00
|
|
|
HRectangle {
|
2019-03-26 03:19:55 -04:00
|
|
|
id: sidePane
|
2019-07-16 08:52:26 -04:00
|
|
|
clip: true // Avoid artifacts when collapsed
|
2019-07-16 09:27:38 -04:00
|
|
|
visible: mainUI.accountsPresent && width > 0
|
2019-04-28 11:01:38 -04:00
|
|
|
|
2019-07-16 08:52:26 -04:00
|
|
|
|
2019-07-16 09:21:45 -04:00
|
|
|
property bool canAutoSize: true
|
2019-07-16 08:52:26 -04:00
|
|
|
property int parentWidth: parent.width
|
|
|
|
|
2019-07-16 09:21:45 -04:00
|
|
|
// Needed for SplitView because it breaks the binding on collapse
|
|
|
|
onParentWidthChanged: if (canAutoSize) {
|
|
|
|
width = Qt.binding(() => implicitWidth)
|
|
|
|
}
|
2019-07-16 08:52:26 -04:00
|
|
|
|
|
|
|
|
2019-07-16 09:21:45 -04:00
|
|
|
property int autoWidth:
|
|
|
|
Math.min(
|
|
|
|
parentWidth * theme.sidePane.autoWidthRatio,
|
|
|
|
theme.sidePane.maximumAutoWidth
|
|
|
|
)
|
2019-07-11 22:25:50 -04:00
|
|
|
|
2019-07-16 09:21:45 -04:00
|
|
|
property bool collapse:
|
|
|
|
canAutoSize ?
|
|
|
|
autoWidth < theme.sidePane.autoCollapseBelowWidth :
|
|
|
|
width < theme.sidePane.autoCollapseBelowWidth
|
2019-07-16 08:36:11 -04:00
|
|
|
|
2019-07-16 09:21:45 -04:00
|
|
|
property bool reduce:
|
|
|
|
window.width < theme.sidePane.autoReduceBelowWindowWidth
|
2019-05-12 15:57:18 -04:00
|
|
|
|
2019-07-16 09:21:45 -04:00
|
|
|
property int implicitWidth:
|
|
|
|
reduce ? 0 :
|
|
|
|
collapse ? theme.sidePane.collapsedWidth :
|
|
|
|
autoWidth
|
2019-07-16 08:52:26 -04:00
|
|
|
|
2019-07-16 09:21:45 -04:00
|
|
|
property int currentSpacing: collapse ? 0 : theme.spacing
|
2019-07-16 08:52:26 -04:00
|
|
|
|
2019-07-16 09:21:45 -04:00
|
|
|
Behavior on currentSpacing { HNumberAnimation {} }
|
|
|
|
Behavior on implicitWidth { HNumberAnimation {} }
|
2019-07-16 08:52:26 -04:00
|
|
|
|
|
|
|
|
2019-04-28 15:18:36 -04:00
|
|
|
HColumnLayout {
|
2019-03-26 03:19:55 -04:00
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
AccountList {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2019-05-02 14:20:21 -04:00
|
|
|
|
2019-07-12 17:06:37 -04:00
|
|
|
spacing: currentSpacing
|
|
|
|
bottomMargin: currentSpacing
|
2019-03-26 03:19:55 -04:00
|
|
|
}
|
|
|
|
|
2019-07-02 13:59:52 -04:00
|
|
|
PaneToolBar {
|
|
|
|
id: paneToolBar
|
|
|
|
}
|
2019-03-26 03:19:55 -04:00
|
|
|
}
|
|
|
|
}
|