2022-11-24 16:23:54 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
2023-02-09 22:31:34 +00:00
|
|
|
import QtQuick.Layouts 1.14
|
2022-11-24 16:23:54 +00:00
|
|
|
|
|
|
|
import AppLayouts.Chat.panels.communities 1.0
|
2022-12-01 16:31:03 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-02-22 17:44:04 +00:00
|
|
|
import StatusQ.Core.Utils 0.1
|
2022-11-24 16:23:54 +00:00
|
|
|
|
|
|
|
import Storybook 1.0
|
|
|
|
import Models 1.0
|
|
|
|
|
2023-01-20 11:22:04 +00:00
|
|
|
|
2022-11-24 16:23:54 +00:00
|
|
|
SplitView {
|
2023-01-20 11:22:04 +00:00
|
|
|
orientation: Qt.Vertical
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
|
2022-11-24 16:23:54 +00:00
|
|
|
Logs { id: logs }
|
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
QtObject {
|
|
|
|
id: permissionsStoreMock
|
2023-02-15 09:26:48 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
readonly property ListModel permissionsModel: ListModel {}
|
2023-02-09 22:31:34 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
readonly property QtObject _d: QtObject {
|
|
|
|
id: d
|
2023-01-20 11:22:04 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
property int keyCounter: 0
|
2023-02-22 17:44:04 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
function createPermissionEntry(holdings, permissionType, isPrivate,
|
|
|
|
channels) {
|
|
|
|
const permission = {
|
|
|
|
holdingsListModel: holdings,
|
|
|
|
channelsListModel: channels,
|
|
|
|
permissionType,
|
|
|
|
isPrivate
|
2023-02-22 17:44:04 +00:00
|
|
|
}
|
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
return permission
|
|
|
|
}
|
|
|
|
}
|
2023-02-22 17:44:04 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
function createPermission(holdings, permissionType, isPrivate, channels) {
|
|
|
|
const permissionEntry = d.createPermissionEntry(
|
|
|
|
holdings, permissionType, isPrivate, channels)
|
2023-02-22 17:44:04 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
permissionEntry.key = "" + d.keyCounter++
|
|
|
|
permissionsModel.append(permissionEntry)
|
|
|
|
}
|
2023-02-22 17:44:04 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
function editPermission(key, holdings, permissionType, channels, isPrivate) {
|
|
|
|
const permissionEntry = d.createPermissionEntry(
|
|
|
|
holdings, permissionType, isPrivate, channels)
|
2023-02-22 17:44:04 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
const index = ModelUtils.indexOf(permissionsModel, "key", key)
|
|
|
|
permissionsModel.set(index, permissionEntry)
|
|
|
|
}
|
2023-02-22 17:44:04 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
function removePermission(key) {
|
|
|
|
const index = ModelUtils.indexOf(permissionsModel, "key", key)
|
|
|
|
permissionsModel.remove(index)
|
|
|
|
}
|
|
|
|
}
|
2023-02-22 17:44:04 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
Rectangle {
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.fillHeight: true
|
|
|
|
color: Theme.palette.statusAppLayout.rightPanelBackgroundColor
|
|
|
|
|
|
|
|
CommunityPermissionsSettingsPanel {
|
|
|
|
id: communityPermissionsSettingsPanel
|
2023-02-22 17:44:04 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
anchors.topMargin: 50
|
2023-02-22 17:44:04 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
permissionsModel: permissionsStoreMock.permissionsModel
|
|
|
|
assetsModel: AssetsModel {}
|
|
|
|
collectiblesModel: CollectiblesModel {}
|
|
|
|
channelsModel: ChannelsModel {}
|
2023-02-22 17:44:04 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
isOwner: isOwnerCheckBox.checked
|
|
|
|
|
2023-04-04 14:10:37 +00:00
|
|
|
showWhoHoldsSwitch: true
|
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
onCreatePermissionRequested: {
|
|
|
|
permissionsStoreMock.createPermission(holdings, permissionType,
|
|
|
|
isPrivate, channels)
|
2023-01-20 11:22:04 +00:00
|
|
|
}
|
2022-12-20 00:03:25 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
onUpdatePermissionRequested:
|
|
|
|
permissionsStoreMock.editPermission(key, holdings, permissionType,
|
|
|
|
channels, isPrivate)
|
2022-12-20 00:03:25 +00:00
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
onRemovePermissionRequested:
|
|
|
|
permissionsStoreMock.removePermission(key)
|
|
|
|
|
|
|
|
communityDetails: QtObject {
|
|
|
|
readonly property string name: "Socks"
|
|
|
|
readonly property string image: ModelsData.icons.socks
|
|
|
|
readonly property string color: "red"
|
2022-11-24 16:23:54 +00:00
|
|
|
}
|
|
|
|
}
|
2023-01-20 11:22:04 +00:00
|
|
|
}
|
2022-11-24 16:23:54 +00:00
|
|
|
|
2023-01-20 11:22:04 +00:00
|
|
|
LogsAndControlsPanel {
|
|
|
|
id: logsAndControlsPanel
|
2022-11-24 16:23:54 +00:00
|
|
|
|
2023-01-20 11:22:04 +00:00
|
|
|
SplitView.minimumHeight: 100
|
|
|
|
SplitView.preferredHeight: 150
|
2022-11-24 16:23:54 +00:00
|
|
|
|
2023-01-20 11:22:04 +00:00
|
|
|
logsView.logText: logs.logText
|
2023-01-20 11:04:12 +00:00
|
|
|
|
2023-02-09 22:31:34 +00:00
|
|
|
ColumnLayout {
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
id: isOwnerCheckBox
|
|
|
|
|
|
|
|
text: "Is owner"
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
text: "Is dirty: " + communityPermissionsSettingsPanel.dirty
|
|
|
|
}
|
2022-11-24 16:23:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|