2024-02-28 12:01:31 +00:00
|
|
|
import QtQml 2.15
|
2024-03-08 09:27:45 +00:00
|
|
|
import QtQml.Models 2.15
|
2024-02-28 12:01:31 +00:00
|
|
|
|
|
|
|
import StatusQ 0.1
|
|
|
|
import StatusQ.Core.Utils 0.1
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
2024-03-08 09:27:45 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2024-02-28 12:01:31 +00:00
|
|
|
QObject {
|
|
|
|
id: root
|
|
|
|
|
2024-03-04 22:07:09 +00:00
|
|
|
// Communities input models
|
|
|
|
property alias communitiesSourceModel: communitySFPM.sourceModel
|
2024-03-29 11:43:49 +00:00
|
|
|
property alias communitiesShowcaseModel: communityJoinedModel.leftModel
|
2024-02-28 12:01:31 +00:00
|
|
|
|
|
|
|
// adapted models
|
2024-03-29 11:43:49 +00:00
|
|
|
readonly property alias adaptedCommunitiesSourceModel: communityJoinedModel
|
2024-02-28 12:01:31 +00:00
|
|
|
|
2024-03-04 22:07:09 +00:00
|
|
|
// Accounts input models
|
|
|
|
property alias accountsSourceModel: accountsSFPM.sourceModel
|
2024-02-28 12:01:31 +00:00
|
|
|
|
|
|
|
// adapted models
|
2024-03-04 22:07:09 +00:00
|
|
|
readonly property alias adaptedAccountsSourceModel: accountsSFPM
|
2024-02-28 12:01:31 +00:00
|
|
|
|
2024-03-29 11:43:49 +00:00
|
|
|
//helpers
|
|
|
|
property var isAddressSaved: (address) => false
|
2024-04-07 22:00:16 +00:00
|
|
|
property bool isShowcaseLoading: false
|
2024-03-29 11:43:49 +00:00
|
|
|
|
2024-03-04 22:07:09 +00:00
|
|
|
// Collectibles input models
|
|
|
|
property alias collectiblesSourceModel: collectiblesSFPM.sourceModel
|
2024-03-29 11:43:49 +00:00
|
|
|
property alias collectiblesShowcaseModel: collectiblesJoinedModel.leftModel
|
2024-02-28 12:01:31 +00:00
|
|
|
|
|
|
|
// adapted models
|
2024-03-29 11:43:49 +00:00
|
|
|
readonly property alias adaptedCollectiblesSourceModel: collectiblesJoinedModel
|
2024-02-28 12:01:31 +00:00
|
|
|
|
2024-03-08 09:27:45 +00:00
|
|
|
// Social links input models
|
2024-03-11 18:54:51 +00:00
|
|
|
property alias socialLinksSourceModel: socialLinksSFPM.sourceModel
|
|
|
|
|
2024-03-08 09:27:45 +00:00
|
|
|
// adapted models
|
|
|
|
readonly property alias adaptedSocialLinksSourceModel: socialLinksSFPM
|
2024-02-28 12:01:31 +00:00
|
|
|
|
2024-03-29 11:43:49 +00:00
|
|
|
component JoinModel: LeftJoinModel {
|
|
|
|
joinRole: "showcaseKey"
|
|
|
|
}
|
|
|
|
|
|
|
|
// Communities proxies
|
|
|
|
|
2024-03-04 22:07:09 +00:00
|
|
|
SortFilterProxyModel {
|
|
|
|
id: communitySFPM
|
|
|
|
proxyRoles: [
|
|
|
|
FastExpressionRole {
|
|
|
|
name: "showcaseKey"
|
|
|
|
expression: model.id
|
|
|
|
expectedRoles: ["id"]
|
2024-03-29 11:43:49 +00:00
|
|
|
},
|
|
|
|
FastExpressionRole {
|
|
|
|
name: "membersCount"
|
2024-10-26 01:25:50 +00:00
|
|
|
expression: model.allMembers.rowCount()
|
|
|
|
expectedRoles: ["allMembers"]
|
2024-04-02 07:45:38 +00:00
|
|
|
},
|
2024-10-26 01:25:50 +00:00
|
|
|
ConstantRole {
|
2024-04-02 07:45:38 +00:00
|
|
|
name: "showcaseVisibility"
|
2024-10-26 01:25:50 +00:00
|
|
|
value: Constants.ShowcaseVisibility.Everyone
|
2024-04-07 22:00:16 +00:00
|
|
|
},
|
|
|
|
FastExpressionRole {
|
|
|
|
name: "isShowcaseLoading"
|
|
|
|
expression: root.isShowcaseLoading
|
2024-02-28 12:01:31 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2024-03-29 11:43:49 +00:00
|
|
|
JoinModel {
|
|
|
|
id: communityJoinedModel
|
|
|
|
rightModel: communitySFPM
|
|
|
|
}
|
|
|
|
|
2024-03-04 22:07:09 +00:00
|
|
|
SortFilterProxyModel {
|
|
|
|
id: accountsSFPM
|
|
|
|
proxyRoles: [
|
|
|
|
FastExpressionRole {
|
|
|
|
name: "showcaseKey"
|
|
|
|
expression: model.address
|
|
|
|
expectedRoles: ["address"]
|
2024-03-29 11:43:49 +00:00
|
|
|
},
|
|
|
|
FastExpressionRole {
|
|
|
|
name: "saved"
|
|
|
|
expression: root.isAddressSaved(model.address)
|
|
|
|
expectedRoles: ["address"]
|
2024-04-02 07:45:38 +00:00
|
|
|
},
|
|
|
|
FastExpressionRole {
|
|
|
|
name: "showcaseVisibility"
|
|
|
|
expression: getShowcaseVisibility()
|
|
|
|
function getShowcaseVisibility() {
|
|
|
|
return Constants.ShowcaseVisibility.Everyone
|
|
|
|
}
|
2024-02-27 17:11:03 +00:00
|
|
|
},
|
|
|
|
FastExpressionRole {
|
|
|
|
name: "canReceiveFromMyAccounts"
|
|
|
|
expression: true
|
2024-02-28 12:01:31 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2024-03-29 11:43:49 +00:00
|
|
|
// Collectibles proxies
|
|
|
|
|
2024-03-04 22:07:09 +00:00
|
|
|
SortFilterProxyModel {
|
|
|
|
id: collectiblesSFPM
|
|
|
|
proxyRoles: [
|
|
|
|
FastExpressionRole {
|
|
|
|
name: "showcaseKey"
|
|
|
|
expression: model.uid
|
|
|
|
expectedRoles: ["uid"]
|
2024-04-02 07:45:38 +00:00
|
|
|
},
|
|
|
|
FastExpressionRole {
|
|
|
|
name: "showcaseVisibility"
|
|
|
|
expression: getShowcaseVisibility()
|
|
|
|
function getShowcaseVisibility() {
|
|
|
|
return Constants.ShowcaseVisibility.Everyone
|
|
|
|
}
|
2024-02-28 12:01:31 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2024-03-29 11:43:49 +00:00
|
|
|
JoinModel {
|
|
|
|
id: collectiblesJoinedModel
|
|
|
|
rightModel: collectiblesSFPM
|
|
|
|
}
|
|
|
|
|
|
|
|
// Social links proxies
|
|
|
|
|
2024-03-08 09:27:45 +00:00
|
|
|
SortFilterProxyModel {
|
|
|
|
id: socialLinksSFPM
|
|
|
|
proxyRoles: [
|
|
|
|
FastExpressionRole {
|
2024-03-11 18:54:51 +00:00
|
|
|
name: "showcaseKey"
|
|
|
|
expression: model.url
|
|
|
|
expectedRoles: ["url"]
|
2024-03-08 09:27:45 +00:00
|
|
|
},
|
|
|
|
FastExpressionRole {
|
|
|
|
name: "showcaseVisibility"
|
|
|
|
expression: getShowcaseVisibility()
|
|
|
|
function getShowcaseVisibility() {
|
|
|
|
return Constants.ShowcaseVisibility.Everyone
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|