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
|
|
|
|
2023-06-23 06:17:04 +00:00
|
|
|
import AppLayouts.Communities.panels 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-06-29 22:05:46 +00:00
|
|
|
Button {
|
|
|
|
text: "Back"
|
|
|
|
onClicked: communityPermissionsSettingsPanel.navigateBack()
|
|
|
|
}
|
|
|
|
|
2023-03-07 08:47:04 +00:00
|
|
|
Rectangle {
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.fillHeight: true
|
|
|
|
color: Theme.palette.statusAppLayout.rightPanelBackgroundColor
|
|
|
|
|
2023-06-26 11:48:45 +00:00
|
|
|
PermissionsSettingsPanel {
|
2023-03-07 08:47:04 +00:00
|
|
|
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
|
|
|
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 {
|
2023-06-29 22:05:46 +00:00
|
|
|
readonly property string id: "community_id"
|
2023-03-07 08:47:04 +00:00
|
|
|
readonly property string name: "Socks"
|
|
|
|
readonly property string image: ModelsData.icons.socks
|
|
|
|
readonly property string color: "red"
|
2023-06-29 22:05:46 +00:00
|
|
|
readonly property bool owner: isOwnerCheckBox.checked
|
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
|
2023-06-29 22:05:46 +00:00
|
|
|
SplitView.preferredHeight: 100
|
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-08-08 16:17:24 +00:00
|
|
|
CheckBox {
|
|
|
|
id: isOwnerCheckBox
|
2023-02-09 22:31:34 +00:00
|
|
|
|
2023-08-08 16:17:24 +00:00
|
|
|
text: "Is owner"
|
2022-11-24 16:23:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-31 12:21:14 +00:00
|
|
|
|
|
|
|
// category: Panels
|