Add compact mode for sidepanes + setting

This commit is contained in:
miruka 2020-03-22 12:50:10 -04:00
parent c65d51b0e8
commit 5d513f84fa
8 changed files with 27 additions and 3 deletions

View File

@ -208,6 +208,7 @@ class UISettings(JSONDataFile):
return {
"alertOnMessageForMsec": 4000,
"alwaysCenterRoomHeader": False,
"alwaysUseCompactMode": False,
"clearRoomFilterOnEnter": True,
"clearRoomFilterOnEscape": True,
"collapseSidePanesUnderWindowWidth": 400,

View File

@ -6,8 +6,12 @@ import "../Base"
Rectangle {
id: avatar
implicitWidth: theme.controls.avatar.size
implicitHeight: theme.controls.avatar.size
implicitWidth: implicitHeight
implicitHeight:
compact ?
theme.controls.avatar.compactSize :
theme.controls.avatar.size
radius: theme.controls.avatar.radius
color: avatarImage.visible ? "transparent" : utils.hsluv(
@ -18,6 +22,8 @@ Rectangle {
)
property bool compact: false
property string name
property alias mxc: avatarImage.mxc
property alias title: avatarImage.title

View File

@ -11,6 +11,7 @@ HButton {
default property alias additionalData: contentItem.data
property bool compact: window.settings.alwaysUseCompactMode
property real contentOpacity: 1
readonly property alias title: title
@ -77,7 +78,7 @@ HButton {
color: theme.colors.dimText
visible: Layout.maximumHeight > 0
Layout.maximumHeight: text ? implicitWidth : 0
Layout.maximumHeight: ! compact && text ? implicitHeight : 0
Layout.fillWidth: true
Layout.fillHeight: true
@ -87,6 +88,16 @@ HButton {
}
Binding on topPadding {
value: spacing / 4
when: compact
}
Binding on bottomPadding {
value: spacing / 4
when: compact
}
TapHandler {
acceptedButtons: Qt.LeftButton
onTapped: leftClicked()

View File

@ -23,6 +23,7 @@ HTileDelegate {
userId: model.id
displayName: model.display_name
mxc: model.avatar_url
compact: account.compact
radius:
mainPane.small ?

View File

@ -7,6 +7,7 @@ import ".."
import "../Base"
HTileDelegate {
id: room
backgroundColor: theme.mainPane.listView.room.background
opacity: model.left ? theme.mainPane.listView.room.leftRoomOpacity : 1
@ -19,6 +20,7 @@ HTileDelegate {
roomId: model.id
displayName: model.display_name
mxc: model.avatar_url
compact: room.compact
radius:
mainPane.small ?

View File

@ -17,6 +17,7 @@ HTileDelegate {
powerLevel: model.power_level
shiftMembershipIconPosition: ! roomPane.collapsed
invited: model.invited
compact: memberDelegate.compact
}
title.text: model.display_name || model.id

View File

@ -218,6 +218,7 @@ controls:
avatar:
int size: baseElementsHeight
int compactSize: baseElementsHeight / 2
int radius: theme.radius
hoveredImage:

View File

@ -224,6 +224,7 @@ controls:
avatar:
int size: baseElementsHeight
int compactSize: baseElementsHeight / 2
int radius: theme.radius
hoveredImage: