mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-10 06:16:32 +00:00
0ab8a62896
- Renamed main `CommunitiesPortal` folder to `Communities`. - Created new `layouts` folder. - Moved layout files from chat to communities. - Created new `helpers` folder. - Moved helpers files from chat to communities. - Moved `controls/community` files from chat to communities `controls`. - Moved `panels/communities` files from chat to communities `panels`. - Moved `popups/community` files from chat to communities `popups`. - Moved `views/community` files from chat to communities `views`. - Moved `CommunityBanner` file from shared to `Communities/controls`. Only used in communities context. - Moved `CommunitySettingsView` and `CommunityColumnView` files from chat to communities `views`. - Moved `PermissionsStore.qml` file to `shared/stores`. - Updated imports. - Updated storybook. Part of #6204
74 lines
2.0 KiB
QML
74 lines
2.0 KiB
QML
import QtQml 2.15
|
|
import SortFilterProxyModel 0.2
|
|
|
|
import StatusQ.Core.Utils 0.1
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import utils 1.0
|
|
|
|
SortFilterProxyModel {
|
|
property var channelsModel
|
|
|
|
readonly property QtObject _d: QtObject {
|
|
id: d
|
|
|
|
readonly property ModelChangeTracker tracker: ModelChangeTracker {
|
|
model: channelsModel
|
|
|
|
onRevisionChanged: {
|
|
const metadata = new Map()
|
|
const count = channelsModel.rowCount()
|
|
|
|
for (let i = 0; i < count; i++) {
|
|
const item = ModelUtils.get(channelsModel, i)
|
|
|
|
const text = "#" + item.name
|
|
const imageSource = item.icon
|
|
const emoji = item.emoji
|
|
const color = !!item.color ? item.color
|
|
: Theme.palette.userCustomizationColors[item.colorId]
|
|
metadata.set(item.itemId, { text, imageSource, emoji, color })
|
|
}
|
|
|
|
d.metadata = metadata
|
|
}
|
|
|
|
onModelChanged: revisionChanged()
|
|
}
|
|
|
|
property var metadata: new Map()
|
|
|
|
function get(key, role) {
|
|
const item = metadata.get(key)
|
|
return !!item ? item[role] : ""
|
|
}
|
|
}
|
|
|
|
proxyRoles: [
|
|
ExpressionRole {
|
|
name: "text"
|
|
expression: d.get(model.key, name)
|
|
},
|
|
ExpressionRole {
|
|
name: "imageSource"
|
|
expression: d.get(model.key, name)
|
|
},
|
|
ExpressionRole {
|
|
name: "emoji"
|
|
expression: d.get(model.key, name)
|
|
},
|
|
ExpressionRole {
|
|
name: "color"
|
|
expression: d.get(model.key, name)
|
|
},
|
|
ExpressionRole {
|
|
name: "operator"
|
|
|
|
// Direct call for singleton enum is not handled properly by SortFilterProxyModel.
|
|
readonly property int none: OperatorsUtils.Operators.None
|
|
|
|
expression: none
|
|
}
|
|
]
|
|
}
|