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
|
|
|
|
|
|
|
import Storybook 1.0
|
|
|
|
|
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
|
|
|
|
modal: false
|
|
|
|
closePolicy: Popup.NoAutoClose
|
|
|
|
destroyOnClose: true
|
|
|
|
|
|
|
|
isEdit: isEditCheckBox.checked
|
|
|
|
isDeleteable: isDeleteableCheckBox.checked
|
|
|
|
isDiscordImport: isDiscordCheckBox.checked
|
|
|
|
|
|
|
|
Binding on channelName {
|
|
|
|
value: "test-channel"
|
|
|
|
when: dialog.isEdit
|
|
|
|
restoreMode: Binding.RestoreBindingOrValue
|
|
|
|
}
|
|
|
|
|
|
|
|
Binding on channelDescription {
|
|
|
|
value: "TEST TEST TEST"
|
|
|
|
when: dialog.isEdit
|
|
|
|
restoreMode: Binding.RestoreBindingOrValue
|
|
|
|
}
|
|
|
|
|
|
|
|
Binding on channelColor {
|
|
|
|
value: "pink"
|
|
|
|
when: dialog.isEdit
|
|
|
|
restoreMode: Binding.RestoreBindingOrValue
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
onCreateCommunityChannel: function(chName, chDescription, chEmoji, chColor, chCategoryId) {
|
|
|
|
logs.logEvent("onCreateCommunityChannel",
|
|
|
|
["chName", "chDescription", "chEmoji", "chColor", "chCategoryId"], arguments)
|
|
|
|
}
|
|
|
|
|
|
|
|
onEditCommunityChannel: function(chName, chDescription, chEmoji, chColor, chCategoryId) {
|
|
|
|
logs.logEvent("onEditCommunityChannel",
|
|
|
|
["chName", "chDescription", "chEmoji", "chColor", "chCategoryId"], arguments)
|
|
|
|
}
|
|
|
|
|
|
|
|
onDeleteCommunityChannel: () => {
|
|
|
|
logs.logEvent("onDeleteCommunityChannel")
|
|
|
|
}
|
|
|
|
}
|
2022-11-08 21:23:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LogsAndControlsPanel {
|
|
|
|
SplitView.minimumHeight: 100
|
|
|
|
SplitView.preferredHeight: 200
|
|
|
|
|
|
|
|
logsView.logText: logs.logText
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
CheckBox {
|
|
|
|
id: isEditCheckBox
|
|
|
|
text: "isEdit"
|
2023-09-01 07:58:48 +00:00
|
|
|
onToggled: if (checked) isDiscordCheckBox.checked = false
|
2022-11-08 21:23:55 +00:00
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id: isDeleteableCheckBox
|
|
|
|
enabled: isEditCheckBox.checked
|
|
|
|
text: "isDeleteable"
|
|
|
|
}
|
2023-09-01 07:58:48 +00:00
|
|
|
CheckBox {
|
|
|
|
id: isDiscordCheckBox
|
|
|
|
enabled: !isEditCheckBox.checked
|
|
|
|
text: "isDiscordImport"
|
|
|
|
onToggled: {
|
|
|
|
if (!!dialog && dialog.opened)
|
|
|
|
dialog.close()
|
|
|
|
}
|
|
|
|
}
|
2022-11-08 21:23:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-31 12:21:14 +00:00
|
|
|
|
|
|
|
// category: Popups
|