status-desktop/ui/app/AppLayouts/Communities/views/ChannelsSelectionModel.qml
Alex Jbanca 055d8e8322 chore(permissions): Improve performance by using the Fast expressions and add necessary models and APIs in the PermissionsStore
Changes:
1. Adding the `Fast` expressions where needed
2. Break the channel permissions into categories in PermissionsStore
3. Remove unused/unneeded code
2024-02-07 19:54:47 +02:00

54 lines
1.3 KiB
QML

import QtQml 2.15
import SortFilterProxyModel 0.2
import StatusQ.Core.Utils 0.1
import StatusQ.Core.Theme 0.1
import StatusQ 0.1
import utils 1.0
SortFilterProxyModel {
id: root
property var selectedChannels
property var allChannels
sourceModel: LeftJoinModel {
readonly property var channelsModelAlignedKey: SortFilterProxyModel {
sourceModel: root.allChannels
proxyRoles: [
FastExpressionRole {
name: "key"
expression: model.itemId ?? ""
expectedRoles: ["itemId"]
}
]
}
leftModel: root.selectedChannels
rightModel: channelsModelAlignedKey
joinRole: "key"
}
proxyRoles: [
FastExpressionRole {
name: "text"
expression: "#" + model.name
expectedRoles: ["name"]
},
FastExpressionRole {
name: "imageSource"
expression: model.icon
expectedRoles: ["icon"]
},
FastExpressionRole {
name: "operator"
// Direct call for singleton enum is not handled properly by SortFilterProxyModel.
readonly property int none: OperatorsUtils.Operators.None
expression: none
expectedRoles: []
}
]
}