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
displayName: model.display_name
mxc: model.avatar_url
rotation: mainPane.small ? -45 : 0
Behavior on rotation { HNumberAnimation {} }
}
contextMenu: HMenu {
@ -69,7 +72,23 @@ HTileDelegate {
Behavior on title.color { HColorAnimation {} }
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 {
HButton {

View File

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

View File

@ -8,16 +8,22 @@ HDrawer {
id: mainPane
saveName: "mainPane"
color: theme.mainPane.background
minimumSize: theme.controls.avatar.size + theme.spacing * 2
minimumSize: bottomBar.addAccountButton.width
onHasFocusChanged:
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 alias mainPaneList: mainPaneList
readonly property alias topBar: topBar
readonly property alias bottomBar: bottomBar
property alias filter: bottomBar.roomFilter
function toggleFocus() {
@ -46,6 +52,8 @@ HDrawer {
anchors.fill: parent
TopBar {
id: topBar
Layout.fillWidth: true
Layout.fillHeight: false
Layout.preferredHeight: theme.baseElementsHeight

View File

@ -158,4 +158,20 @@ HTileDelegate {
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"
Rectangle {
clip: true
color: theme.mainPane.topBar.background
HRowLayout {

View File

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

View File

@ -156,7 +156,8 @@ controls:
color subtitle: colors.dimText
listView:
color highlight: colors.strongBackground
color highlight: colors.strongBackground
color smallPaneHighlight: colors.accentBackground
textField:
color background: colors.strongBackground

View File

@ -156,7 +156,8 @@ controls:
color subtitle: colors.dimText
listView:
color highlight: colors.strongBackground
color highlight: colors.strongBackground
color smallPaneHighlight: colors.accentBackground
textField:
color background: colors.strongBackground