Dedicated MessageIndicator.qml (unread/mentions)
This commit is contained in:
		
							
								
								
									
										1
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										35
									
								
								src/gui/MainPane/MessageIndicator.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								src/gui/MainPane/MessageIndicator.qml
									
									
									
									
									
										Normal file
									
								
							@@ -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 {} }
 | 
			
		||||
}
 | 
			
		||||
@@ -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:
 | 
			
		||||
                MessageIndicator {
 | 
			
		||||
                    indicatorTheme:
 | 
			
		||||
                        theme.accountView.roomList.room.unreadIndicator
 | 
			
		||||
 | 
			
		||||
                        Behavior on color { HColorAnimation {} }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    Behavior on scale { HNumberAnimation {} }
 | 
			
		||||
                    unreads: model.unreads
 | 
			
		||||
                    mentions: model.mentions
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                HIcon {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user