refactor: Remove StatusLetterIdenticon from ui/shared/status and use existing one from StatusQ
closes #3845
This commit is contained in:
parent
e853eaa3ec
commit
d8c388c9b8
|
@ -7,6 +7,8 @@ import "../../../../shared/panels"
|
|||
import "../../../../shared/controls"
|
||||
import "../../../../shared/status"
|
||||
|
||||
import StatusQ.Components 0.1 as StatusQ
|
||||
|
||||
Item {
|
||||
id: wrapper
|
||||
|
||||
|
@ -89,11 +91,11 @@ Item {
|
|||
|
||||
Component {
|
||||
id: letterIdenticon
|
||||
StatusLetterIdenticon {
|
||||
StatusQ.StatusLetterIdenticon {
|
||||
width: 16
|
||||
height: 16
|
||||
letterSize: 12
|
||||
chatName: communityBadge.communityName
|
||||
name: communityBadge.communityName
|
||||
color: communityBadge.iconColor
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,9 @@ import QtQuick.Controls 2.13
|
|||
import QtQuick.Layouts 1.13
|
||||
|
||||
import utils 1.0
|
||||
|
||||
import StatusQ.Components 0.1 as StatusQ
|
||||
|
||||
import "../../../../shared"
|
||||
import "../../../../shared/views"
|
||||
import "../../../../shared/popups"
|
||||
|
@ -67,14 +70,13 @@ ModalPopup {
|
|||
width: parent.width
|
||||
|
||||
|
||||
StatusLetterIdenticon {
|
||||
StatusQ.StatusLetterIdenticon {
|
||||
id: letterIdenticon
|
||||
width: 36
|
||||
height: 36
|
||||
anchors.top: parent.top
|
||||
color: popup.channel.color
|
||||
chatId: popup.channel.id
|
||||
chatName: popup.channel.name
|
||||
name: popup.channel.name
|
||||
}
|
||||
|
||||
StyledTextEdit {
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
import QtQuick 2.13
|
||||
import QtQuick.Controls 2.13
|
||||
import QtGraphicalEffects 1.13
|
||||
|
||||
import utils 1.0
|
||||
import "../../shared"
|
||||
import "../../shared/panels"
|
||||
import "../../shared/status"
|
||||
|
||||
TabButton {
|
||||
id: control
|
||||
visible: enabled
|
||||
width: 40
|
||||
height: enabled ? 40 : 0
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
property color iconColor: Style.current.secondaryText
|
||||
property color disabledColor: iconColor
|
||||
property int iconRotation: 0
|
||||
property string iconSource
|
||||
property string section
|
||||
property int sectionIndex: Utils.getAppSectionIndex(section)
|
||||
property bool doNotHandleClick: false
|
||||
property bool borderOnChecked: false
|
||||
property bool useLetterIdenticon: false
|
||||
property string name: ""
|
||||
|
||||
onClicked: {
|
||||
if (doNotHandleClick) {
|
||||
return
|
||||
}
|
||||
|
||||
chatsModel.communities.activeCommunity.active = false
|
||||
appMain.changeAppSection(section)
|
||||
}
|
||||
|
||||
checked: sLayout.currentIndex === sectionIndex
|
||||
|
||||
icon.height: 24
|
||||
icon.width: 24
|
||||
icon.color: {
|
||||
if (!enabled) {
|
||||
return control.disabledColor
|
||||
}
|
||||
return (hovered || checked) ? Style.current.blue : control.iconColor
|
||||
}
|
||||
|
||||
onIconChanged: {
|
||||
if (iconSource) {
|
||||
icon.source = iconSource
|
||||
return
|
||||
}
|
||||
|
||||
icon.source = icon.name ? Style.svg(icon.name) : ""
|
||||
}
|
||||
|
||||
contentItem: Item {
|
||||
anchors.fill: parent
|
||||
|
||||
Loader {
|
||||
active: true
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
sourceComponent: useLetterIdenticon ? letterIdenticon :
|
||||
!!iconSource ? imageIcon : defaultIcon
|
||||
}
|
||||
|
||||
Component {
|
||||
id: defaultIcon
|
||||
SVGImage {
|
||||
id: iconImg
|
||||
source: control.icon.source
|
||||
height: control.icon.height
|
||||
width: control.icon.width
|
||||
fillMode: Image.PreserveAspectFit
|
||||
rotation: control.iconRotation
|
||||
ColorOverlay {
|
||||
anchors.fill: iconImg
|
||||
source: iconImg
|
||||
color: control.icon.color
|
||||
antialiasing: true
|
||||
smooth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: imageIcon
|
||||
RoundedImage {
|
||||
source: iconSource
|
||||
noMouseArea: true
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: letterIdenticon
|
||||
StatusLetterIdenticon {
|
||||
width: 26
|
||||
height: 26
|
||||
letterSize: 15
|
||||
chatName: control.name
|
||||
color: control.iconColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: hovered || (borderOnChecked && checked) ? Style.current.tabButtonBg : "transparent"
|
||||
border.color: Style.current.primary
|
||||
border.width: borderOnChecked && checked ? 1 : 0
|
||||
radius: control.width / 2
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
onPressed: mouse.accepted = false
|
||||
}
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
import QtQuick 2.13
|
||||
|
||||
import utils 1.0
|
||||
|
||||
import StatusQ.Components 0.1
|
||||
|
||||
import "../../shared"
|
||||
import "../../shared/status"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
@ -25,8 +27,7 @@ Item {
|
|||
id: letterIdenticon
|
||||
|
||||
StatusLetterIdenticon {
|
||||
chatId: root.chatId
|
||||
chatName: root.chatName
|
||||
name: root.chatName
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
letterSize: root.letterSize
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
import QtQuick 2.13
|
||||
|
||||
import utils 1.0
|
||||
import "../../shared"
|
||||
import "../../shared/panels"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
property string chatId
|
||||
property string chatName
|
||||
property int letterSize: 15
|
||||
|
||||
width: 40
|
||||
height: 40
|
||||
radius: width / 2
|
||||
|
||||
color: {
|
||||
const color = chatsModel.channelView.getChannelColor(chatId)
|
||||
if (!color) {
|
||||
return Style.current.orange
|
||||
}
|
||||
return color
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: (root.chatName.charAt(0) == "#" ? root.chatName.charAt(1) : root.chatName.charAt(0)).toUpperCase()
|
||||
opacity: 0.7
|
||||
font.weight: Font.Bold
|
||||
font.pixelSize: root.letterSize
|
||||
color: "white"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.leftMargin: -1
|
||||
anchors.bottomMargin: -2
|
||||
}
|
||||
}
|
|
@ -9,7 +9,6 @@ StatusGifPopup 1.0 StatusGifPopup.qml
|
|||
StatusGifColumn 1.0 StatusGifColumn.qml
|
||||
StatusIconButton 1.0 StatusIconButton.qml
|
||||
StatusImageIdenticon 1.0 StatusImageIdenticon.qml
|
||||
StatusLetterIdenticon 1.0 StatusLetterIdenticon.qml
|
||||
StatusRadioButton 1.0 StatusRadioButton.qml
|
||||
StatusRoundButton 1.0 StatusRoundButton.qml
|
||||
StatusSectionHeadline 1.0 StatusSectionHeadline.qml
|
||||
|
|
Loading…
Reference in New Issue