Add a compact room list option

This commit is contained in:
Gary Wang
2022-12-20 18:06:44 +08:00
committed by Tobias Fella
parent 3c33bea7db
commit 304054a4bb
3 changed files with 23 additions and 6 deletions

View File

@@ -72,7 +72,11 @@
<default>true</default>
</entry>
<entry name="CompactLayout" type="bool">
<label>Use a compact layout</label>
<label>Use a compact chat layout</label>
<default>false</default>
</entry>
<entry name="CompactRoomList" type="bool">
<label>Use a compact room list layout</label>
<default>false</default>
</entry>
<entry name="ShowRename" type="bool">

View File

@@ -316,6 +316,7 @@ Kirigami.ScrollablePage {
labelItem.textFormat: Text.PlainText
subtitle: subtitleText
subtitleItem.textFormat: Text.PlainText
subtitleItem.visible: !Config.compactRoomList
onPressAndHold: {
createRoomListContextMenu()
}
@@ -347,8 +348,8 @@ Kirigami.ScrollablePage {
QQC2.Label {
text: notificationCount > 0 ? notificationCount : "●"
visible: unreadCount > 0
padding: Kirigami.Units.smallSpacing
color: Kirigami.Theme.textColor
Layout.rightMargin: Kirigami.Units.smallSpacing
Layout.minimumWidth: height
horizontalAlignment: Text.AlignHCenter
background: Rectangle {
@@ -361,7 +362,7 @@ Kirigami.ScrollablePage {
}
QQC2.Button {
id: configButton
visible: roomListItem.hovered && !Kirigami.Settings.isMobile
visible: roomListItem.hovered && !Kirigami.Settings.isMobile && !Config.compactRoomList
Accessible.name: i18n("Configure room")
action: Kirigami.Action {
@@ -376,13 +377,13 @@ Kirigami.ScrollablePage {
function createRoomListContextMenu() {
const menu = roomListContextMenu.createObject(page, {room: currentRoom})
if (!Kirigami.Settings.isMobile) {
if (!Kirigami.Settings.isMobile && !Config.compactRoomList) {
configButton.visible = true
configButton.down = true
}
menu.closed.connect(function() {
configButton.down = undefined
configButton.visible = Qt.binding(function() { return roomListItem.hovered && !Kirigami.Settings.isMobile })
configButton.visible = Qt.binding(function() { return roomListItem.hovered && !Kirigami.Settings.isMobile && !Config.compactRoomList })
})
menu.open()
}

View File

@@ -199,8 +199,20 @@ Kirigami.ScrollablePage {
}
}
}
MobileForm.FormDelegateSeparator { below: compactRoomListDelegate }
MobileForm.FormCheckDelegate {
id: compactRoomListDelegate
text: i18n("Use compact room list")
checked: Config.compactRoomList
onToggled: {
Config.compactRoomList = checked;
Config.save();
}
}
MobileForm.FormDelegateSeparator { below: colorSchemeDelegate.item ; visible: colorSchemeDelegate.visible }
MobileForm.FormDelegateSeparator { above: compactRoomListDelegate ; below: colorSchemeDelegate.item ; visible: colorSchemeDelegate.visible }
Loader {
id: colorSchemeDelegate