From 9ebd8644c801cbf74c235e22240a66bb0be84212 Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 1 May 2020 04:35:54 -0400 Subject: [PATCH] Dedicated MessageIndicator.qml (unread/mentions) --- TODO.md | 1 + src/gui/MainPane/MessageIndicator.qml | 35 +++++++++++++++++++++++++++ src/gui/MainPane/Room.qml | 30 ++++------------------- 3 files changed, 41 insertions(+), 25 deletions(-) create mode 100644 src/gui/MainPane/MessageIndicator.qml diff --git a/TODO.md b/TODO.md index 1a176265..b52b1ed6 100644 --- a/TODO.md +++ b/TODO.md @@ -8,6 +8,7 @@ - fix message delegate too tall - fix left rooms opacity - fix escape keybinds (filter rooms, message selection) +- fix nio 429 - lag when switching accounts - update glass theme diff --git a/src/gui/MainPane/MessageIndicator.qml b/src/gui/MainPane/MessageIndicator.qml new file mode 100644 index 00000000..dbe52c1c --- /dev/null +++ b/src/gui/MainPane/MessageIndicator.qml @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later + +import QtQuick 2.12 +import "../Base" + +HLabel { + text: unreads + font.pixelSize: theme.fontSize.small + verticalAlignment: Qt.AlignVCenter + leftPadding: theme.spacing / 4 + rightPadding: leftPadding + + scale: unreads === 0 ? 0 : 1 + visible: unreads !== 0 + + background: Rectangle { + color: + mentions ? + indicatorTheme.mentionBackground : + indicatorTheme.background + + radius: theme.radius / 4 + + Behavior on color { HColorAnimation {} } + } + + + property QtObject indicatorTheme + property int unreads: 0 + property int mentions: 0 + + + + Behavior on scale { HNumberAnimation {} } +} diff --git a/src/gui/MainPane/Room.qml b/src/gui/MainPane/Room.qml index 34494687..7a35c499 100644 --- a/src/gui/MainPane/Room.qml +++ b/src/gui/MainPane/Room.qml @@ -36,31 +36,11 @@ HTileDelegate { color: theme.accountView.roomList.room.name } - HLabel { - text: model.unreads - font.pixelSize: theme.fontSize.small - verticalAlignment: Qt.AlignVCenter - leftPadding: theme.spacing / 4 - rightPadding: leftPadding - - scale: model.unreads === 0 ? 0 : 1 - visible: model.unreads !== 0 - - background: Rectangle { - color: - model.mentions ? - indicatorTheme.mentionBackground : - indicatorTheme.background - - radius: theme.radius / 4 - - readonly property QtObject indicatorTheme: - theme.accountView.roomList.room.unreadIndicator - - Behavior on color { HColorAnimation {} } - } - - Behavior on scale { HNumberAnimation {} } + MessageIndicator { + indicatorTheme: + theme.accountView.roomList.room.unreadIndicator + unreads: model.unreads + mentions: model.mentions } HIcon {