refactor: replace StatusIdenticon with StatusSmartIdenticon
closes #3882
This commit is contained in:
parent
781f86bd60
commit
173943f1be
|
@ -2,12 +2,12 @@ import QtQuick 2.13
|
||||||
import QtQuick.Controls 2.13
|
import QtQuick.Controls 2.13
|
||||||
import "../../../../shared"
|
import "../../../../shared"
|
||||||
import "../../../../shared/panels"
|
import "../../../../shared/panels"
|
||||||
import "../../../../shared/status"
|
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
import StatusQ.Components 0.1
|
import StatusQ.Components 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
|
import StatusQ.Core 0.1
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: wrapper
|
id: wrapper
|
||||||
|
@ -53,17 +53,23 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusIdenticon {
|
StatusSmartIdenticon {
|
||||||
id: contactImage
|
id: contactImage
|
||||||
height: 28
|
|
||||||
width: 28
|
|
||||||
chatId: wrapper.publicKey
|
|
||||||
chatName: wrapper.name
|
|
||||||
chatType: Constants.chatTypeOneToOne
|
|
||||||
identicon: wrapper.profileImage || wrapper.identicon
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: Style.current.padding
|
anchors.leftMargin: Style.current.padding
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
image: StatusImageSettings {
|
||||||
|
width: 28
|
||||||
|
height: 28
|
||||||
|
source: wrapper.profileImage || wrapper.identicon
|
||||||
|
isIdenticon: true
|
||||||
|
}
|
||||||
|
icon: StatusIconSettings {
|
||||||
|
width: 28
|
||||||
|
height: 28
|
||||||
|
letterSize: 15
|
||||||
|
}
|
||||||
|
name: wrapper.name
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
|
|
@ -6,7 +6,9 @@ import Qt.labs.platform 1.1
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import "../../../../../shared"
|
import "../../../../../shared"
|
||||||
import "../../../../../shared/panels"
|
import "../../../../../shared/panels"
|
||||||
import "../../../../../shared/status"
|
|
||||||
|
import StatusQ.Components 0.1
|
||||||
|
import StatusQ.Core 0.1
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: channelBadge
|
id: channelBadge
|
||||||
|
@ -28,18 +30,23 @@ Item {
|
||||||
anchors.verticalCenter:parent.verticalCenter
|
anchors.verticalCenter:parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusIdenticon {
|
StatusSmartIdenticon {
|
||||||
id: contactImage
|
id: contactImage
|
||||||
height: 16
|
|
||||||
width: 16
|
|
||||||
chatId: chatId
|
|
||||||
chatName: name
|
|
||||||
chatType: realChatType
|
|
||||||
identicon: profileImage || identicon
|
|
||||||
anchors.left: channelIcon.right
|
anchors.left: channelIcon.right
|
||||||
anchors.leftMargin: 4
|
anchors.leftMargin: 4
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
letterSize: 11
|
image: StatusImageSettings {
|
||||||
|
width: 16
|
||||||
|
height: 16
|
||||||
|
source: profileImage || identicon
|
||||||
|
isIdenticon: true
|
||||||
|
}
|
||||||
|
icon: StatusIconSettings {
|
||||||
|
width: 16
|
||||||
|
height: 16
|
||||||
|
letterSize: 11
|
||||||
|
}
|
||||||
|
name: channelBadge.name
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
|
|
@ -5,9 +5,9 @@ import utils 1.0
|
||||||
import "../../../../shared"
|
import "../../../../shared"
|
||||||
import "../../../../shared/panels"
|
import "../../../../shared/panels"
|
||||||
import "../../../../shared/controls"
|
import "../../../../shared/controls"
|
||||||
import "../../../../shared/status"
|
|
||||||
|
|
||||||
import StatusQ.Components 0.1 as StatusQ
|
import StatusQ.Components 0.1 as StatusQ
|
||||||
|
import StatusQ.Core 0.1
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: wrapper
|
id: wrapper
|
||||||
|
@ -180,18 +180,23 @@ Item {
|
||||||
anchors.verticalCenter:parent.verticalCenter
|
anchors.verticalCenter:parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusIdenticon {
|
StatusQ.StatusSmartIdenticon {
|
||||||
id: contactImage
|
id: contactImage
|
||||||
height: 16
|
|
||||||
width: 16
|
|
||||||
chatId: wrapper.chatId
|
|
||||||
chatName: wrapper.name
|
|
||||||
chatType: wrapper.realChatType
|
|
||||||
identicon: wrapper.profileImage || wrapper.identicon
|
|
||||||
anchors.left: channelIcon.right
|
anchors.left: channelIcon.right
|
||||||
anchors.leftMargin: 4
|
anchors.leftMargin: 4
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
letterSize: 11
|
image: StatusImageSettings {
|
||||||
|
width: 16
|
||||||
|
height: 16
|
||||||
|
source: wrapper.profileImage || wrapper.identicon
|
||||||
|
isIdenticon: true
|
||||||
|
}
|
||||||
|
icon: StatusIconSettings {
|
||||||
|
width: 16
|
||||||
|
height: 16
|
||||||
|
letterSize: 11
|
||||||
|
}
|
||||||
|
name: wrapper.name
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
|
|
@ -3,7 +3,6 @@ import QtGraphicalEffects 1.13
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import "../../../../shared"
|
import "../../../../shared"
|
||||||
import "../../../../shared/status"
|
|
||||||
import "../../../../shared/popups"
|
import "../../../../shared/popups"
|
||||||
import "../../../../shared/controls"
|
import "../../../../shared/controls"
|
||||||
import "../../../../shared/panels"
|
import "../../../../shared/panels"
|
||||||
|
@ -11,6 +10,9 @@ import "../../../../shared/panels"
|
||||||
import "../controls"
|
import "../controls"
|
||||||
import "../panels"
|
import "../panels"
|
||||||
|
|
||||||
|
import StatusQ.Components 0.1
|
||||||
|
import StatusQ.Core.Theme 0.1
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -42,17 +44,13 @@ Item {
|
||||||
anchors.topMargin: dateGroupLbl.visible ? 4 : 0
|
anchors.topMargin: dateGroupLbl.visible ? 4 : 0
|
||||||
color: model.read ? Style.current.transparent : Utils.setColorAlpha(Style.current.blue, 0.1)
|
color: model.read ? Style.current.transparent : Utils.setColorAlpha(Style.current.blue, 0.1)
|
||||||
|
|
||||||
StatusIdenticon {
|
StatusSmartIdenticon {
|
||||||
id: channelIdenticon
|
id: channelIdenticon
|
||||||
height: 40
|
|
||||||
width: 40
|
|
||||||
chatId: model.chatId
|
|
||||||
chatName: model.name
|
|
||||||
chatType: Constants.chatTypePrivateGroupChat
|
|
||||||
identicon: ""
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: Style.current.padding
|
anchors.leftMargin: Style.current.padding
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
name: model.name
|
||||||
|
icon.color: Theme.palette.miscColor5
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -6,11 +6,13 @@ import QtQuick.Layouts 1.13
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
|
import StatusQ.Components 0.1
|
||||||
|
import StatusQ.Core.Theme 0.1
|
||||||
|
import StatusQ.Core 0.1
|
||||||
|
|
||||||
import "../../../../shared"
|
import "../../../../shared"
|
||||||
import "../../../../shared/popups"
|
import "../../../../shared/popups"
|
||||||
import "../../../../shared/panels"
|
import "../../../../shared/panels"
|
||||||
import "../../../../shared/status"
|
|
||||||
|
|
||||||
// TODO: replace with StatusModal
|
// TODO: replace with StatusModal
|
||||||
ModalPopup {
|
ModalPopup {
|
||||||
|
@ -39,16 +41,24 @@ ModalPopup {
|
||||||
radius: Style.current.radius
|
radius: Style.current.radius
|
||||||
color: isHovered ? Style.current.backgroundHover : Style.current.transparent
|
color: isHovered ? Style.current.backgroundHover : Style.current.transparent
|
||||||
|
|
||||||
StatusIdenticon {
|
StatusSmartIdenticon {
|
||||||
id: contactImage
|
id: contactImage
|
||||||
height: 40
|
|
||||||
width: 40
|
|
||||||
chatName: model.name
|
|
||||||
chatType: model.chatType
|
|
||||||
identicon: model.identicon
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: Style.current.smallPadding
|
anchors.leftMargin: Style.current.smallPadding
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
image: StatusImageSettings {
|
||||||
|
width: 40
|
||||||
|
height: 40
|
||||||
|
source: model.identicon
|
||||||
|
isIdenticon: true
|
||||||
|
}
|
||||||
|
icon: StatusIconSettings {
|
||||||
|
width: 40
|
||||||
|
height: 40
|
||||||
|
letterSize: 15
|
||||||
|
color: Theme.palette.miscColor5
|
||||||
|
}
|
||||||
|
name: model.name
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
|
|
@ -21,9 +21,11 @@ import Qt.labs.platform 1.1
|
||||||
import Qt.labs.settings 1.0
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
|
import StatusQ.Components 0.1
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
import StatusQ.Layout 0.1
|
import StatusQ.Layout 0.1
|
||||||
import StatusQ.Popups 0.1
|
import StatusQ.Popups 0.1
|
||||||
|
import StatusQ.Core 0.1
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -737,8 +739,22 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: statusIdenticonComponent
|
id: statusSmartIdenticonComponent
|
||||||
StatusIdenticon {}
|
StatusSmartIdenticon {
|
||||||
|
property string imageSource: ""
|
||||||
|
image: StatusImageSettings {
|
||||||
|
width: channelPicker.imageWidth
|
||||||
|
height: channelPicker.imageHeight
|
||||||
|
source: imageSource
|
||||||
|
isIdenticon: true
|
||||||
|
}
|
||||||
|
icon: StatusIconSettings {
|
||||||
|
width: channelPicker.imageWidth
|
||||||
|
height: channelPicker.imageHeight
|
||||||
|
letterSize: 15
|
||||||
|
color: Theme.palette.miscColor5
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusInputListPopup {
|
StatusInputListPopup {
|
||||||
|
@ -754,12 +770,9 @@ Item {
|
||||||
return modelData.name
|
return modelData.name
|
||||||
}
|
}
|
||||||
getImageComponent: function (parent, modelData) {
|
getImageComponent: function (parent, modelData) {
|
||||||
return statusIdenticonComponent.createObject(parent, {
|
return statusSmartIdenticonComponent.createObject(parent, {
|
||||||
width: channelPicker.imageWidth,
|
imageSource: modelData.identicon,
|
||||||
height: channelPicker.imageHeight,
|
name: modelData.name
|
||||||
chatName: modelData.name,
|
|
||||||
chatType: modelData.chatType,
|
|
||||||
identicon: modelData.identicon
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
onClicked: function (index) {
|
onClicked: function (index) {
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
import QtQuick 2.13
|
|
||||||
|
|
||||||
import utils 1.0
|
|
||||||
|
|
||||||
import StatusQ.Components 0.1
|
|
||||||
|
|
||||||
import "../../shared"
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property string chatId
|
|
||||||
property string chatName
|
|
||||||
property int chatType
|
|
||||||
property string identicon
|
|
||||||
property int letterSize: 15
|
|
||||||
|
|
||||||
width: 40
|
|
||||||
height: 40
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
sourceComponent: root.chatType == Constants.chatTypeOneToOne || !!root.identicon ? imageIdenticon : letterIdenticon
|
|
||||||
anchors.fill: parent
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: letterIdenticon
|
|
||||||
|
|
||||||
StatusLetterIdenticon {
|
|
||||||
name: root.chatName
|
|
||||||
width: parent.width
|
|
||||||
height: parent.height
|
|
||||||
letterSize: root.letterSize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: imageIdenticon
|
|
||||||
|
|
||||||
StatusImageIdenticon {
|
|
||||||
source: root.identicon
|
|
||||||
width: parent.width
|
|
||||||
height: parent.height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,6 +6,10 @@ import utils 1.0
|
||||||
import "../../shared"
|
import "../../shared"
|
||||||
import "../../shared/panels"
|
import "../../shared/panels"
|
||||||
|
|
||||||
|
import StatusQ.Components 0.1
|
||||||
|
import StatusQ.Core.Theme 0.1
|
||||||
|
import StatusQ.Core 0.1
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
property string chatId: ""
|
property string chatId: ""
|
||||||
|
@ -33,12 +37,24 @@ Rectangle {
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: userOrChannelIdenticon
|
id: userOrChannelIdenticon
|
||||||
StatusIdenticon {
|
StatusSmartIdenticon {
|
||||||
height: 40
|
id: contactImage
|
||||||
width: 40
|
anchors.left: parent.left
|
||||||
chatName: root.name
|
anchors.leftMargin: Style.current.smallPadding
|
||||||
chatType: root.chatType
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
identicon: root.identicon
|
image: StatusImageSettings {
|
||||||
|
width: 40
|
||||||
|
height: 40
|
||||||
|
source: root.identicon
|
||||||
|
isIdenticon: true
|
||||||
|
}
|
||||||
|
icon: StatusIconSettings {
|
||||||
|
width: 40
|
||||||
|
height: 40
|
||||||
|
letterSize: 15
|
||||||
|
color: Theme.palette.miscColor5
|
||||||
|
}
|
||||||
|
name: root.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue