UserListPanel simplified, dependency on utilsStore removed
This commit is contained in:
parent
0db6fe2701
commit
0f98244e1f
|
@ -1,72 +1,35 @@
|
||||||
import QtQuick 2.14
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.14
|
import QtQuick.Controls 2.15
|
||||||
import AppLayouts.Chat.panels 1.0
|
|
||||||
|
|
||||||
import utils 1.0
|
import AppLayouts.Chat.panels 1.0
|
||||||
|
import StatusQ 0.1
|
||||||
|
|
||||||
import Storybook 1.0
|
import Storybook 1.0
|
||||||
import Models 1.0
|
import Models 1.0
|
||||||
|
|
||||||
SplitView {
|
import SortFilterProxyModel 0.2
|
||||||
id: root
|
|
||||||
|
|
||||||
|
SplitView {
|
||||||
Logs { id: logs }
|
Logs { id: logs }
|
||||||
|
|
||||||
orientation: Qt.Vertical
|
orientation: Qt.Vertical
|
||||||
|
|
||||||
property bool globalUtilsReady: false
|
|
||||||
property bool mainModuleReady: false
|
|
||||||
|
|
||||||
UsersModel {
|
UsersModel {
|
||||||
id: model
|
id: model
|
||||||
}
|
}
|
||||||
|
|
||||||
// globalUtilsInst mock
|
UserListPanel {
|
||||||
QtObject {
|
|
||||||
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
|
||||||
|
|
||||||
function getColorHashAsJson(publicKey) {
|
|
||||||
return JSON.stringify([{colorId: 0, segmentLength: 1},
|
|
||||||
{colorId: 19, segmentLength: 2}])
|
|
||||||
}
|
|
||||||
|
|
||||||
function isCompressedPubKey(publicKey) { return true }
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
Utils.globalUtilsInst = this
|
|
||||||
root.globalUtilsReady = true
|
|
||||||
}
|
|
||||||
Component.onDestruction: {
|
|
||||||
root.globalUtilsReady = false
|
|
||||||
Utils.globalUtilsInst = {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// mainModuleInst mock
|
|
||||||
QtObject {
|
|
||||||
function getContactDetailsAsJson(publicKey, getVerificationRequest) {
|
|
||||||
return JSON.stringify({ ensVerified: false })
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
Utils.mainModuleInst = this
|
|
||||||
root.mainModuleReady = true
|
|
||||||
}
|
|
||||||
Component.onDestruction: {
|
|
||||||
root.mainModuleReady = false
|
|
||||||
Utils.mainModuleInst = {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Item {
|
|
||||||
SplitView.fillWidth: true
|
SplitView.fillWidth: true
|
||||||
SplitView.fillHeight: true
|
SplitView.fillHeight: true
|
||||||
|
|
||||||
Loader {
|
|
||||||
anchors.fill: parent
|
|
||||||
active: globalUtilsReady && mainModuleReady
|
|
||||||
|
|
||||||
sourceComponent: UserListPanel {
|
|
||||||
usersModel: model
|
|
||||||
label: "Some label"
|
label: "Some label"
|
||||||
|
|
||||||
|
usersModel: SortFilterProxyModel {
|
||||||
|
sourceModel: model
|
||||||
|
|
||||||
|
proxyRoles: FastExpressionRole {
|
||||||
|
name: "compressedKey"
|
||||||
|
expression: "compressed"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import shared 1.0
|
||||||
import shared.panels 1.0
|
import shared.panels 1.0
|
||||||
import shared.status 1.0
|
import shared.status 1.0
|
||||||
import shared.views.chat 1.0
|
import shared.views.chat 1.0
|
||||||
import shared.stores 1.0 as SharedStores
|
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
|
@ -24,7 +23,6 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property ChatStores.RootStore store
|
property ChatStores.RootStore store
|
||||||
property SharedStores.UtilsStore utilsStore
|
|
||||||
|
|
||||||
property var usersModel
|
property var usersModel
|
||||||
property string label
|
property string label
|
||||||
|
@ -112,7 +110,7 @@ Item {
|
||||||
width: ListView.view.width
|
width: ListView.view.width
|
||||||
nickName: model.localNickname
|
nickName: model.localNickname
|
||||||
userName: ProfileUtils.displayName("", model.ensName, model.displayName, model.alias)
|
userName: ProfileUtils.displayName("", model.ensName, model.displayName, model.alias)
|
||||||
pubKey: model.isEnsVerified ? "" : Utils.getCompressedPk(model.pubKey)
|
pubKey: model.isEnsVerified ? "" : model.compressedKey
|
||||||
isContact: model.isContact
|
isContact: model.isContact
|
||||||
isVerified: model.isVerified
|
isVerified: model.isVerified
|
||||||
isUntrustworthy: model.isUntrustworthy
|
isUntrustworthy: model.isUntrustworthy
|
||||||
|
@ -130,9 +128,9 @@ Item {
|
||||||
Global.openMenu(profileContextMenuComponent, this, {
|
Global.openMenu(profileContextMenuComponent, this, {
|
||||||
profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname, chatType, isAdmin,
|
profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname, chatType, isAdmin,
|
||||||
publicKey: model.pubKey,
|
publicKey: model.pubKey,
|
||||||
emojiHash: root.utilsStore.getEmojiHash(model.pubKey),
|
emojiHash: model.emojiHash,
|
||||||
displayName: nickName || userName,
|
displayName: nickName || userName,
|
||||||
userIcon: model.icon,
|
userIcon: model.icon
|
||||||
})
|
})
|
||||||
} else if (mouse.button === Qt.LeftButton) {
|
} else if (mouse.button === Qt.LeftButton) {
|
||||||
Global.openProfilePopup(model.pubKey)
|
Global.openProfilePopup(model.pubKey)
|
||||||
|
|
|
@ -12,6 +12,7 @@ import shared.views.chat 1.0
|
||||||
import shared.stores.send 1.0 as SendStores
|
import shared.stores.send 1.0 as SendStores
|
||||||
import SortFilterProxyModel 0.2
|
import SortFilterProxyModel 0.2
|
||||||
|
|
||||||
|
import StatusQ 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
import StatusQ.Layout 0.1
|
import StatusQ.Layout 0.1
|
||||||
|
@ -183,10 +184,25 @@ StatusSectionLayout {
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
store: root.rootStore
|
store: root.rootStore
|
||||||
utilsStore: root.utilsStore
|
|
||||||
label: qsTr("Members")
|
label: qsTr("Members")
|
||||||
communityMemberReevaluationStatus: root.rootStore.communityMemberReevaluationStatus
|
communityMemberReevaluationStatus: root.rootStore.communityMemberReevaluationStatus
|
||||||
usersModel: usersStore.usersModel
|
|
||||||
|
usersModel: SortFilterProxyModel {
|
||||||
|
sourceModel: usersStore.usersModel
|
||||||
|
|
||||||
|
proxyRoles: [
|
||||||
|
FastExpressionRole {
|
||||||
|
name: "emojiHash"
|
||||||
|
expression: root.utilsStore.getEmojiHash(model.pubKey)
|
||||||
|
expectedRoles: ["pubKey"]
|
||||||
|
},
|
||||||
|
FastExpressionRole {
|
||||||
|
name: "compressedKey"
|
||||||
|
expression: root.utilsStore.getCompressedPk(model.pubKey)
|
||||||
|
expectedRoles: ["pubKey"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue