Improve MainPane when reduced to minimumSize

This commit is contained in:
miruka 2020-03-12 23:17:23 -04:00
parent ca53e18e24
commit 02d09f405a
8 changed files with 57 additions and 6 deletions

View File

@ -23,6 +23,9 @@ HTileDelegate {
userId: model.id userId: model.id
displayName: model.display_name displayName: model.display_name
mxc: model.avatar_url mxc: model.avatar_url
rotation: mainPane.small ? -45 : 0
Behavior on rotation { HNumberAnimation {} }
} }
contextMenu: HMenu { contextMenu: HMenu {
@ -69,7 +72,23 @@ HTileDelegate {
Behavior on title.color { HColorAnimation {} } Behavior on title.color { HColorAnimation {} }
Behavior on opacity { HNumberAnimation {} } Behavior on opacity { HNumberAnimation {} }
Behavior on leftPadding { HNumberAnimation {} }
Behavior on topPadding { HNumberAnimation {} }
Binding on leftPadding {
value: (mainPane.minimumSize - loadedImage.width) / 2
when: mainPane.small
}
Binding on topPadding {
value: theme.spacing
when: mainPane.small
}
Binding on bottomPadding {
value: theme.spacing
when: mainPane.small
}
HRowLayout { HRowLayout {
HButton { HButton {

View File

@ -7,6 +7,7 @@ import "../Base"
HListView { HListView {
id: mainPaneList id: mainPaneList
model: ModelStore.get("accounts") model: ModelStore.get("accounts")
spacing: mainPane.small ? theme.spacing : 0
delegate: AccountRoomsDelegate { delegate: AccountRoomsDelegate {
width: mainPaneList.width width: mainPaneList.width
@ -32,10 +33,14 @@ HListView {
currentItem.roomList.currentItem.height : currentItem.roomList.currentItem.height :
currentItem.account.height currentItem.account.height
color: theme.controls.listView.highlight color:
mainPane.small ?
theme.controls.listView.smallPaneHighlight :
theme.controls.listView.highlight
Behavior on y { HNumberAnimation { id: yAnimation } } Behavior on y { HNumberAnimation { id: yAnimation } }
Behavior on height { HNumberAnimation {} } Behavior on height { HNumberAnimation {} }
Behavior on color { HColorAnimation {} }
Binding { Binding {
target: mainPaneList target: mainPaneList
@ -69,6 +74,7 @@ HListView {
model.findIndex(window.uiState.pageProperties.userId) : null model.findIndex(window.uiState.pageProperties.userId) : null
function previous() { function previous() {
detachedCurrentIndex = true detachedCurrentIndex = true

View File

@ -8,16 +8,22 @@ HDrawer {
id: mainPane id: mainPane
saveName: "mainPane" saveName: "mainPane"
color: theme.mainPane.background color: theme.mainPane.background
minimumSize: theme.controls.avatar.size + theme.spacing * 2 minimumSize: bottomBar.addAccountButton.width
onHasFocusChanged: onHasFocusChanged:
if (! hasFocus) mainPaneList.detachedCurrentIndex = false if (! hasFocus) mainPaneList.detachedCurrentIndex = false
property alias filter: bottomBar.roomFilter
readonly property bool small:
width < theme.controls.avatar.size + theme.spacing * 2
readonly property bool hasFocus: bottomBar.filterField.activeFocus readonly property bool hasFocus: bottomBar.filterField.activeFocus
readonly property alias mainPaneList: mainPaneList readonly property alias mainPaneList: mainPaneList
readonly property alias topBar: topBar
readonly property alias bottomBar: bottomBar readonly property alias bottomBar: bottomBar
property alias filter: bottomBar.roomFilter
function toggleFocus() { function toggleFocus() {
@ -46,6 +52,8 @@ HDrawer {
anchors.fill: parent anchors.fill: parent
TopBar { TopBar {
id: topBar
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: false Layout.fillHeight: false
Layout.preferredHeight: theme.baseElementsHeight Layout.preferredHeight: theme.baseElementsHeight

View File

@ -158,4 +158,20 @@ HTileDelegate {
Behavior on opacity { HNumberAnimation {} } Behavior on opacity { HNumberAnimation {} }
Behavior on leftPadding { HNumberAnimation {} }
Binding on leftPadding {
value: (mainPane.minimumSize - loadedImage.width) / 2
when: mainPane.small
}
Binding on topPadding {
value: leftPadding / 2
when: mainPane.small
}
Binding on bottomPadding {
value: leftPadding / 2
when: mainPane.small
}
} }

View File

@ -5,6 +5,7 @@ import QtQuick.Layouts 1.12
import "../Base" import "../Base"
Rectangle { Rectangle {
clip: true
color: theme.mainPane.topBar.background color: theme.mainPane.topBar.background
HRowLayout { HRowLayout {

View File

@ -42,7 +42,6 @@ HTileDelegate {
Behavior on spacing { HNumberAnimation {} } Behavior on spacing { HNumberAnimation {} }
Binding on spacing { Binding on spacing {
id: spacebind
value: (roomPane.minimumSize - loadedImage.width) / 2 value: (roomPane.minimumSize - loadedImage.width) / 2
when: loadedImage && when: loadedImage &&
roomPane.width < loadedImage.width + theme.spacing * 2 roomPane.width < loadedImage.width + theme.spacing * 2

View File

@ -157,6 +157,7 @@ controls:
listView: listView:
color highlight: colors.strongBackground color highlight: colors.strongBackground
color smallPaneHighlight: colors.accentBackground
textField: textField:
color background: colors.strongBackground color background: colors.strongBackground

View File

@ -157,6 +157,7 @@ controls:
listView: listView:
color highlight: colors.strongBackground color highlight: colors.strongBackground
color smallPaneHighlight: colors.accentBackground
textField: textField:
color background: colors.strongBackground color background: colors.strongBackground