2023-09-01 07:58:48 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQml 2.15
|
2022-11-08 21:23:55 +00:00
|
|
|
|
2024-02-06 09:32:34 +00:00
|
|
|
import StatusQ 0.1
|
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
|
|
|
|
2022-11-08 21:23:55 +00:00
|
|
|
import Storybook 1.0
|
2024-02-06 09:32:34 +00:00
|
|
|
import Models 1.0
|
2022-11-08 21:23:55 +00:00
|
|
|
|
2023-06-23 06:17:04 +00:00
|
|
|
import AppLayouts.Communities.popups 1.0
|
2022-11-08 21:23:55 +00:00
|
|
|
|
|
|
|
SplitView {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
Logs { id: logs }
|
|
|
|
|
|
|
|
orientation: Qt.Vertical
|
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
property var dialog
|
|
|
|
|
|
|
|
function createAndOpenDialog() {
|
|
|
|
dialog = dlgComponent.createObject(popupBg)
|
|
|
|
dialog.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: createAndOpenDialog()
|
|
|
|
|
2022-11-08 21:23:55 +00:00
|
|
|
Item {
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.fillHeight: true
|
|
|
|
|
|
|
|
PopupBackground {
|
2023-09-01 07:58:48 +00:00
|
|
|
id: popupBg
|
2022-11-08 21:23:55 +00:00
|
|
|
anchors.fill: parent
|
2023-09-01 07:58:48 +00:00
|
|
|
|
|
|
|
Button {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
text: "Reopen"
|
|
|
|
|
|
|
|
onClicked: createAndOpenDialog()
|
|
|
|
}
|
2022-11-08 21:23:55 +00:00
|
|
|
}
|
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
Component {
|
|
|
|
id: dlgComponent
|
|
|
|
CreateChannelPopup {
|
|
|
|
id: dialog
|
|
|
|
anchors.centerIn: parent
|
|
|
|
destroyOnClose: true
|
2024-05-03 15:51:25 +00:00
|
|
|
isEdit: ctrlIsEdit.checked
|
2023-09-01 07:58:48 +00:00
|
|
|
isDeleteable: isDeleteableCheckBox.checked
|
|
|
|
isDiscordImport: isDiscordCheckBox.checked
|
2024-05-03 15:51:25 +00:00
|
|
|
chatId: isEdit ? "_general" : ""
|
|
|
|
channelName: isEdit ? "general" : ""
|
|
|
|
channelDescription: isEdit ? "general discussion" : ""
|
2024-02-06 09:32:34 +00:00
|
|
|
activeCommunity: QtObject {
|
|
|
|
readonly property string id: "0x039c47e9837a1a7dcd00a6516399d0eb521ab0a92d512ca20a44ac6278bfdbb5c5"
|
|
|
|
readonly property string name: "test-1"
|
|
|
|
readonly property string image: ModelsData.icons.superRare
|
2024-05-03 15:51:25 +00:00
|
|
|
readonly property string color: dialog.isEdit ? "#4360DF" : "green"
|
2024-02-06 09:32:34 +00:00
|
|
|
readonly property int memberRole: 0
|
2023-09-01 07:58:48 +00:00
|
|
|
}
|
2024-02-06 09:32:34 +00:00
|
|
|
assetsModel: AssetsModel {}
|
|
|
|
channelsModel: ChannelsModel {}
|
|
|
|
collectiblesModel: CollectiblesModel {}
|
|
|
|
|
|
|
|
permissionsModel: ListModel {
|
2024-05-03 15:51:25 +00:00
|
|
|
function belongsToChat(permissionId, chatId) {
|
|
|
|
return chatId === dialog.chatId
|
|
|
|
}
|
|
|
|
|
2024-02-06 09:32:34 +00:00
|
|
|
Component.onCompleted: {
|
2024-05-03 15:51:25 +00:00
|
|
|
if (dialog.isEdit)
|
|
|
|
append(PermissionsModel.channelsOnlyPermissionsModelData)
|
2024-02-06 09:32:34 +00:00
|
|
|
}
|
2023-09-01 07:58:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
communitiesStore: QtObject {
|
|
|
|
property string discordImportChannelName
|
|
|
|
readonly property bool discordImportInProgress: false
|
|
|
|
readonly property bool discordDataExtractionInProgress: false
|
|
|
|
readonly property int discordImportErrorsCount: 0
|
|
|
|
readonly property int discordImportWarningsCount: 0
|
|
|
|
readonly property int discordOldestMessageTimestamp: 0
|
|
|
|
|
|
|
|
property var discordFileList: ListModel {
|
|
|
|
readonly property int selectedCount: count
|
|
|
|
property bool selectedFilesValid
|
|
|
|
}
|
|
|
|
|
|
|
|
property var discordCategoriesModel: ListModel {}
|
|
|
|
|
|
|
|
property var discordChannelsModel: ListModel {
|
|
|
|
property bool hasSelectedItems
|
|
|
|
readonly property int count: 32 // hide the parsing/loading spinner
|
|
|
|
}
|
|
|
|
|
|
|
|
function setFileListItems(filePaths) {
|
|
|
|
for (const filePath of filePaths) {
|
|
|
|
discordFileList.append({"filePath": filePath, errorMessage: ""})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeFileListItem(path) {
|
|
|
|
for (let i = 0; i < discordFileList.count; i++) {
|
|
|
|
const item = discordFileList.get(i)
|
|
|
|
if (item.filePath === path)
|
|
|
|
discordFileList.remove(i)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function clearFileList() {
|
|
|
|
discordFileList.clear()
|
|
|
|
discordFileList.selectedFilesValid = false
|
|
|
|
}
|
|
|
|
|
|
|
|
function clearDiscordCategoriesAndChannels() {
|
|
|
|
discordCategoriesModel.clear()
|
|
|
|
discordChannelsModel.clear()
|
|
|
|
discordChannelsModel.hasSelectedItems = false
|
|
|
|
}
|
2022-11-08 21:23:55 +00:00
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
function requestExtractChannelsAndCategories() {
|
|
|
|
discordFileList.selectedFilesValid = true
|
|
|
|
}
|
2022-11-08 21:23:55 +00:00
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
function toggleOneDiscordChannel(id) {
|
|
|
|
logs.logEvent("toggleOneDiscordChannel", ["id"], arguments)
|
|
|
|
}
|
2022-11-08 21:23:55 +00:00
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
function resetDiscordImport() {
|
|
|
|
logs.logEvent("resetDiscordImport")
|
|
|
|
}
|
2022-11-08 21:23:55 +00:00
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
function requestCancelDiscordChannelImport(id) {
|
|
|
|
logs.logEvent("requestCancelDiscordChannelImport", ["id"], arguments)
|
|
|
|
}
|
2022-11-08 21:23:55 +00:00
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
function requestImportDiscordChannel(args, timestamp) {
|
|
|
|
logs.logEvent("requestImportDiscordChannel", ["args", "timestamp"], arguments)
|
2022-11-08 21:23:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
emojiPopup: Popup {
|
|
|
|
id: inner_emojiPopup
|
2022-11-08 21:23:55 +00:00
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
parent: root
|
2022-11-08 21:23:55 +00:00
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
property var emojiSize
|
2022-11-08 21:23:55 +00:00
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
Button {
|
|
|
|
text: "😃"
|
|
|
|
onClicked: {
|
|
|
|
emojiPopup.emojiSelected(text, false)
|
|
|
|
emojiPopup.close()
|
|
|
|
}
|
|
|
|
}
|
2022-11-08 21:23:55 +00:00
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
signal emojiSelected(string emoji, bool atCu)
|
|
|
|
}
|
2022-11-08 21:23:55 +00:00
|
|
|
|
2023-09-01 07:58:48 +00:00
|
|
|
|
2024-05-03 15:51:25 +00:00
|
|
|
onCreateCommunityChannel: function(chName, chDescription, chEmoji, chColor, chCategoryId, viewOnlyCanAddReaction, hideIfPermissionsNotMet) {
|
2023-09-01 07:58:48 +00:00
|
|
|
logs.logEvent("onCreateCommunityChannel",
|
2024-05-03 15:51:25 +00:00
|
|
|
["chName", "chDescription", "chEmoji", "chColor", "chCategoryId",
|
|
|
|
"viewOnlyCanAddReaction", "hideIfPermissionsNotMet"], arguments)
|
2023-09-01 07:58:48 +00:00
|
|
|
}
|
|
|
|
|
2024-05-03 15:51:25 +00:00
|
|
|
onEditCommunityChannel: function(chName, chDescription, chEmoji, chColor, chCategoryId, viewOnlyCanAddReaction, hideIfPermissionsNotMet) {
|
2023-09-01 07:58:48 +00:00
|
|
|
logs.logEvent("onEditCommunityChannel",
|
2024-05-03 15:51:25 +00:00
|
|
|
["chName", "chDescription", "chEmoji", "chColor", "chCategoryId",
|
|
|
|
"viewOnlyCanAddReaction", "hideIfPermissionsNotMet"], arguments)
|
2023-09-01 07:58:48 +00:00
|
|
|
}
|
|
|
|
|
2024-05-03 15:51:25 +00:00
|
|
|
onDeleteCommunityChannel: () => { logs.logEvent("onDeleteCommunityChannel") }
|
2023-09-01 07:58:48 +00:00
|
|
|
}
|
2022-11-08 21:23:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LogsAndControlsPanel {
|
|
|
|
SplitView.minimumHeight: 100
|
|
|
|
SplitView.preferredHeight: 200
|
|
|
|
|
|
|
|
logsView.logText: logs.logText
|
|
|
|
|
2024-05-03 15:51:25 +00:00
|
|
|
ColumnLayout {
|
|
|
|
RowLayout {
|
|
|
|
RadioButton {
|
|
|
|
text: "Create mode"
|
|
|
|
checked: true
|
|
|
|
}
|
|
|
|
RadioButton {
|
|
|
|
id: ctrlIsEdit
|
|
|
|
text: "Edit mode"
|
|
|
|
}
|
|
|
|
RadioButton {
|
|
|
|
id: isDiscordCheckBox
|
|
|
|
text: "isDiscordImport"
|
|
|
|
onToggled: {
|
|
|
|
if (!!dialog && dialog.opened)
|
|
|
|
dialog.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Switch {
|
2022-11-08 21:23:55 +00:00
|
|
|
id: isDeleteableCheckBox
|
|
|
|
text: "isDeleteable"
|
2024-05-03 15:51:25 +00:00
|
|
|
enabled: ctrlIsEdit.checked
|
2023-09-01 07:58:48 +00:00
|
|
|
}
|
2022-11-08 21:23:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-31 12:21:14 +00:00
|
|
|
|
|
|
|
// category: Popups
|
2023-10-03 11:56:30 +00:00
|
|
|
|
|
|
|
// https://www.figma.com/file/17fc13UBFvInrLgNUKJJg5/Kuba%E2%8E%9CDesktop?node-id=2975%3A488608
|
|
|
|
// https://www.figma.com/file/17fc13UBFvInrLgNUKJJg5/Kuba%E2%8E%9CDesktop?node-id=2975%3A488256
|
|
|
|
// https://www.figma.com/file/17fc13UBFvInrLgNUKJJg5/Kuba%E2%8E%9CDesktop?node-id=2903%3A348301
|
|
|
|
// https://www.figma.com/file/17fc13UBFvInrLgNUKJJg5/Kuba%E2%8E%9CDesktop?node-id=2975%3A488848
|
|
|
|
// https://www.figma.com/file/17fc13UBFvInrLgNUKJJg5/Kuba%E2%8E%9CDesktop?node-id=2975%3A489237
|
|
|
|
// https://www.figma.com/file/17fc13UBFvInrLgNUKJJg5/Kuba%E2%8E%9CDesktop?node-id=2975%3A489607
|
|
|
|
// https://www.figma.com/file/17fc13UBFvInrLgNUKJJg5/Kuba%E2%8E%9CDesktop?node-id=2975%3A492910
|