From 8ef3a6dc33ded04445d8bc4d4e2a751b90dac482 Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 21 Aug 2019 06:02:00 -0400 Subject: [PATCH] Fix expand icon size and startup highlight Remove "hide hover highlight when keyboard pressed" feature, too hacky. --- TODO.md | 3 +- src/icons/dark-filled/expand.svg | 53 ++++++++++++++++++++++- src/icons/light-thin/expand.svg | 63 +++++++++++++++++++++++----- src/qml/Base/HButton.qml | 1 + src/qml/Base/HTileDelegate.qml | 27 +++++------- src/qml/SidePane/AccountRoomList.qml | 24 +++-------- src/qml/SidePane/DelegateAccount.qml | 11 ++--- src/qml/SidePane/DelegateRoom.qml | 8 ++-- 8 files changed, 130 insertions(+), 60 deletions(-) diff --git a/TODO.md b/TODO.md index 5c19fe3f..678fe180 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,4 @@ - Refactoring - - Repair timer/connection - Repair filter members field and retest its performance - Use HInterfaceBox for EditAccount Profile and Encryption @@ -20,7 +19,6 @@ - Fixes - (Left?)Banner binding loop - Reloading config files (cache) - - Tiny invisible scrollbar - Run import in thread and AsyncClient.olm functions, they block async loop - Handle import keys errors @@ -34,6 +32,7 @@ - Terrible performance using `QT_QPA_PLATFORM=wayland-egl`, must use `xcb` - UI + - Make HListView scrollbars visible - Remove first html lists left margin - Popup: diff --git a/src/icons/dark-filled/expand.svg b/src/icons/dark-filled/expand.svg index 952bb108..ee95e724 100644 --- a/src/icons/dark-filled/expand.svg +++ b/src/icons/dark-filled/expand.svg @@ -1 +1,52 @@ - \ No newline at end of file + + + + + + image/svg+xml + + + + + + + + diff --git a/src/icons/light-thin/expand.svg b/src/icons/light-thin/expand.svg index 8e0400c9..d3aec10a 100644 --- a/src/icons/light-thin/expand.svg +++ b/src/icons/light-thin/expand.svg @@ -1,13 +1,54 @@ - - + - - - + + + + + + image/svg+xml + + + + + + + diff --git a/src/qml/Base/HButton.qml b/src/qml/Base/HButton.qml index 265f5c41..8fd7d74f 100644 --- a/src/qml/Base/HButton.qml +++ b/src/qml/Base/HButton.qml @@ -55,6 +55,7 @@ Button { svgName: loading ? "hourglass" : iconName Layout.fillHeight: true + Layout.alignment: Qt.AlignCenter } HLabel { diff --git a/src/qml/Base/HTileDelegate.qml b/src/qml/Base/HTileDelegate.qml index 2e669080..72bd86e8 100644 --- a/src/qml/Base/HTileDelegate.qml +++ b/src/qml/Base/HTileDelegate.qml @@ -6,10 +6,10 @@ HButton { signal activated() - signal highlightMe() - property bool isCurrent: false + property HListView view: ListView.view + property bool shouldBeCurrent: false readonly property var delegateModel: model @@ -30,7 +30,7 @@ HButton { HLabel { id: title - text: "Title" + text: "Missing title" elide: Text.ElideRight verticalAlignment: Qt.AlignVCenter @@ -73,29 +73,22 @@ HButton { children: [image, details].concat(additionalItems) } - onIsCurrentChanged: if (isCurrent) highlightMe() - onHighlightMe: accountRoomList.currentIndex = model.index + onActivated: view.currentIndex = model.index onClicked: { - ListView.highlightRangeMode = ListView.NoHighlightRange - ListView.highlightMoveDuration = 0 + view.highlightRangeMode = ListView.NoHighlightRange + view.highlightMoveDuration = 0 activated() - ListView.highlightRangeMode = ListView.ApplyRange - ListView.highlightMoveDuration = theme.animationDuration + view.highlightRangeMode = ListView.ApplyRange + view.highlightMoveDuration = theme.animationDuration } Timer { interval: 100 repeat: true - running: ListView.currentIndex == -1 + running: view.currentIndex == -1 // Component.onCompleted won't work for this - onTriggered: if (isCurrent) highlightMe() + onTriggered: if (shouldBeCurrent) view.currentIndex = model.index } - - // Connections { - // target: ListView - // onHideHoverHighlight: tile.hovered = false - // } - } diff --git a/src/qml/SidePane/AccountRoomList.qml b/src/qml/SidePane/AccountRoomList.qml index 60b6791a..5aa1cff1 100644 --- a/src/qml/SidePane/AccountRoomList.qml +++ b/src/qml/SidePane/AccountRoomList.qml @@ -7,10 +7,6 @@ HListView { id: accountRoomList - signal hideHoverHighlight() - onHideHoverHighlight: hoverBlocker.enabled = true - - readonly property var originSource: window.sidePaneModelSource readonly property var collapseAccounts: window.uiState.collapseAccounts readonly property string filter: paneToolBar.roomFilter @@ -62,14 +58,12 @@ HListView { } function previous(activate=true) { - hideHoverHighlight() decrementCurrentIndex() if (activate) activateLimiter.requestFire() } function next(activate=true) { - hideHoverHighlight() incrementCurrentIndex() if (activate) activateLimiter.requestFire() } @@ -106,22 +100,14 @@ HListView { delegate: Loader { width: accountRoomList.width - source: "Delegate" + - (model.type == "Account" ? "Account.qml" : "Room.qml") + Component.onCompleted: setSource( + model.type == "Account" ? + "DelegateAccount.qml" : "DelegateRoom.qml", + {view: accountRoomList} + ) } - MouseArea { - id: hoverBlocker - anchors.fill: parent - enabled: false - hoverEnabled: enabled - propagateComposedEvents: true - - onMouseXChanged: enabled = false - onMouseYChanged: enabled = false - } - HRateLimiter { id: filterLimiter cooldown: 16 diff --git a/src/qml/SidePane/DelegateAccount.qml b/src/qml/SidePane/DelegateAccount.qml index 936bd414..2d01773f 100644 --- a/src/qml/SidePane/DelegateAccount.qml +++ b/src/qml/SidePane/DelegateAccount.qml @@ -8,12 +8,12 @@ HTileDelegate { topPadding: model.index > 0 ? sidePane.currentSpacing / 2 : 0 bottomPadding: topPadding backgroundColor: theme.sidePane.account.background - opacity: collapsed && ! forceExpand ? theme.sidePane.account.collapsedOpacity : 1 - isCurrent: window.uiState.page == "Pages/EditAccount/EditAccount.qml" && - window.uiState.pageProperties.userId == model.data.user_id + shouldBeCurrent: + window.uiState.page == "Pages/EditAccount/EditAccount.qml" && + window.uiState.pageProperties.userId == model.data.user_id Behavior on opacity { HNumberAnimation {} } @@ -52,9 +52,8 @@ HTileDelegate { HButton { id: expand iconName: "expand" - ico.dimension: 16 backgroundColor: "transparent" - leftPadding: sidePane.currentSpacing / 1.5 + padding: sidePane.currentSpacing / 1.5 rightPadding: leftPadding onClicked: accountDelegate.toggleCollapse() @@ -70,7 +69,5 @@ HTileDelegate { } Behavior on opacity { HNumberAnimation {} } - - Layout.fillHeight: true } } diff --git a/src/qml/SidePane/DelegateRoom.qml b/src/qml/SidePane/DelegateRoom.qml index 708e8f0e..6b1f9614 100644 --- a/src/qml/SidePane/DelegateRoom.qml +++ b/src/qml/SidePane/DelegateRoom.qml @@ -8,9 +8,11 @@ HTileDelegate { spacing: sidePane.currentSpacing backgroundColor: theme.sidePane.room.background opacity: model.data.left ? theme.sidePane.room.leftRoomOpacity : 1 - isCurrent: window.uiState.page == "Chat/Chat.qml" && - window.uiState.pageProperties.userId == model.user_id && - window.uiState.pageProperties.roomId == model.data.room_id + + shouldBeCurrent: + window.uiState.page == "Chat/Chat.qml" && + window.uiState.pageProperties.userId == model.user_id && + window.uiState.pageProperties.roomId == model.data.room_id Behavior on opacity { HNumberAnimation {} }