feat(CreateChannelPopup): inherit the channel color from community color
- if there's a valid community info and the color is non-empty, inherit it when creating a new channel - also fix the color picker button height - adjust the SB page with separate "create" and "edit" options Fixes #14570
This commit is contained in:
parent
953fff0e68
commit
d703d0e87f
|
@ -49,18 +49,17 @@ SplitView {
|
||||||
id: dialog
|
id: dialog
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
destroyOnClose: true
|
destroyOnClose: true
|
||||||
isEdit: true
|
isEdit: ctrlIsEdit.checked
|
||||||
isDeleteable: isDeleteableCheckBox.checked
|
isDeleteable: isDeleteableCheckBox.checked
|
||||||
isDiscordImport: isDiscordCheckBox.checked
|
isDiscordImport: isDiscordCheckBox.checked
|
||||||
chatId: "_general"
|
chatId: isEdit ? "_general" : ""
|
||||||
channelName: "general"
|
channelName: isEdit ? "general" : ""
|
||||||
channelDescription: "general discussion"
|
channelDescription: isEdit ? "general discussion" : ""
|
||||||
channelColor: "#4360DF"
|
|
||||||
activeCommunity: QtObject {
|
activeCommunity: QtObject {
|
||||||
readonly property string id: "0x039c47e9837a1a7dcd00a6516399d0eb521ab0a92d512ca20a44ac6278bfdbb5c5"
|
readonly property string id: "0x039c47e9837a1a7dcd00a6516399d0eb521ab0a92d512ca20a44ac6278bfdbb5c5"
|
||||||
readonly property string name: "test-1"
|
readonly property string name: "test-1"
|
||||||
readonly property string image: ModelsData.icons.superRare
|
readonly property string image: ModelsData.icons.superRare
|
||||||
readonly property string color: "#4360DF"
|
readonly property string color: dialog.isEdit ? "#4360DF" : "green"
|
||||||
readonly property int memberRole: 0
|
readonly property int memberRole: 0
|
||||||
}
|
}
|
||||||
assetsModel: AssetsModel {}
|
assetsModel: AssetsModel {}
|
||||||
|
@ -68,8 +67,12 @@ SplitView {
|
||||||
collectiblesModel: CollectiblesModel {}
|
collectiblesModel: CollectiblesModel {}
|
||||||
|
|
||||||
permissionsModel: ListModel {
|
permissionsModel: ListModel {
|
||||||
id: permissionsModel
|
function belongsToChat(permissionId, chatId) {
|
||||||
|
return chatId === dialog.chatId
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
if (dialog.isEdit)
|
||||||
append(PermissionsModel.channelsOnlyPermissionsModelData)
|
append(PermissionsModel.channelsOnlyPermissionsModelData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,19 +162,19 @@ SplitView {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onCreateCommunityChannel: function(chName, chDescription, chEmoji, chColor, chCategoryId) {
|
onCreateCommunityChannel: function(chName, chDescription, chEmoji, chColor, chCategoryId, viewOnlyCanAddReaction, hideIfPermissionsNotMet) {
|
||||||
logs.logEvent("onCreateCommunityChannel",
|
logs.logEvent("onCreateCommunityChannel",
|
||||||
["chName", "chDescription", "chEmoji", "chColor", "chCategoryId"], arguments)
|
["chName", "chDescription", "chEmoji", "chColor", "chCategoryId",
|
||||||
|
"viewOnlyCanAddReaction", "hideIfPermissionsNotMet"], arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
onEditCommunityChannel: function(chName, chDescription, chEmoji, chColor, chCategoryId) {
|
onEditCommunityChannel: function(chName, chDescription, chEmoji, chColor, chCategoryId, viewOnlyCanAddReaction, hideIfPermissionsNotMet) {
|
||||||
logs.logEvent("onEditCommunityChannel",
|
logs.logEvent("onEditCommunityChannel",
|
||||||
["chName", "chDescription", "chEmoji", "chColor", "chCategoryId"], arguments)
|
["chName", "chDescription", "chEmoji", "chColor", "chCategoryId",
|
||||||
|
"viewOnlyCanAddReaction", "hideIfPermissionsNotMet"], arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
onDeleteCommunityChannel: () => {
|
onDeleteCommunityChannel: () => { logs.logEvent("onDeleteCommunityChannel") }
|
||||||
logs.logEvent("onDeleteCommunityChannel")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,12 +185,17 @@ SplitView {
|
||||||
|
|
||||||
logsView.logText: logs.logText
|
logsView.logText: logs.logText
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
CheckBox {
|
RadioButton {
|
||||||
id: isDeleteableCheckBox
|
text: "Create mode"
|
||||||
text: "isDeleteable"
|
checked: true
|
||||||
}
|
}
|
||||||
CheckBox {
|
RadioButton {
|
||||||
|
id: ctrlIsEdit
|
||||||
|
text: "Edit mode"
|
||||||
|
}
|
||||||
|
RadioButton {
|
||||||
id: isDiscordCheckBox
|
id: isDiscordCheckBox
|
||||||
text: "isDiscordImport"
|
text: "isDiscordImport"
|
||||||
onToggled: {
|
onToggled: {
|
||||||
|
@ -196,6 +204,12 @@ SplitView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Switch {
|
||||||
|
id: isDeleteableCheckBox
|
||||||
|
text: "isDeleteable"
|
||||||
|
enabled: ctrlIsEdit.checked
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ ColumnLayout {
|
||||||
|
|
||||||
StatusPickerButton {
|
StatusPickerButton {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 44
|
||||||
|
|
||||||
property string validationError: ""
|
property string validationError: ""
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ QtObject {
|
||||||
|
|
||||||
// Channel permissions model containing the temporarely edited permissions
|
// Channel permissions model containing the temporarely edited permissions
|
||||||
property WritableProxyModel channelPermissionsModel: WritableProxyModel {
|
property WritableProxyModel channelPermissionsModel: WritableProxyModel {
|
||||||
sourceModel: filteredPermissionsModel
|
sourceModel: d.filteredPermissionsModel
|
||||||
}
|
}
|
||||||
|
|
||||||
// Channels model containing the temporarely edited channel
|
// Channels model containing the temporarely edited channel
|
||||||
|
|
|
@ -41,7 +41,7 @@ StatusStackModal {
|
||||||
property string channelName: ""
|
property string channelName: ""
|
||||||
property string channelDescription: ""
|
property string channelDescription: ""
|
||||||
property string channelEmoji: ""
|
property string channelEmoji: ""
|
||||||
property string channelColor: ""
|
property string channelColor: d.communityDetails.color !== "" ? d.communityDetails.color : ""
|
||||||
property bool emojiPopupOpened: false
|
property bool emojiPopupOpened: false
|
||||||
property var emojiPopup: null
|
property var emojiPopup: null
|
||||||
readonly property int communityColorValidator: Utils.Validate.NoEmpty
|
readonly property int communityColorValidator: Utils.Validate.NoEmpty
|
||||||
|
@ -103,7 +103,7 @@ StatusStackModal {
|
||||||
d.hideIfPermissionsNotMet !== root.hideIfPermissionsNotMet ||
|
d.hideIfPermissionsNotMet !== root.hideIfPermissionsNotMet ||
|
||||||
nameInput.input.text !== root.channelName ||
|
nameInput.input.text !== root.channelName ||
|
||||||
descriptionTextArea.text !== root.channelDescription ||
|
descriptionTextArea.text !== root.channelDescription ||
|
||||||
colorPanel.color.toString().toUpperCase() !== root.channelColor ||
|
!Qt.colorEqual(colorPanel.color, root.channelColor) ||
|
||||||
nameInput.input.asset.emoji !== root.channelEmoji
|
nameInput.input.asset.emoji !== root.channelEmoji
|
||||||
|
|
||||||
property int currentPage: CreateChannelPopup.CurrentPage.ChannelDetails
|
property int currentPage: CreateChannelPopup.CurrentPage.ChannelDetails
|
||||||
|
@ -252,8 +252,6 @@ StatusStackModal {
|
||||||
|
|
||||||
nextButton: StatusButton {
|
nextButton: StatusButton {
|
||||||
objectName: "createOrEditCommunityChannelBtn"
|
objectName: "createOrEditCommunityChannelBtn"
|
||||||
font.weight: Font.Medium
|
|
||||||
height: 44
|
|
||||||
visible: !d.colorPickerOpened
|
visible: !d.colorPickerOpened
|
||||||
enabled: typeof(currentItem.canGoNext) == "undefined" || currentItem.canGoNext
|
enabled: typeof(currentItem.canGoNext) == "undefined" || currentItem.canGoNext
|
||||||
text: !!currentItem.nextButtonText ? currentItem.nextButtonText :
|
text: !!currentItem.nextButtonText ? currentItem.nextButtonText :
|
||||||
|
@ -271,8 +269,6 @@ StatusStackModal {
|
||||||
|
|
||||||
finishButton: StatusButton {
|
finishButton: StatusButton {
|
||||||
objectName: "createChannelNextBtn"
|
objectName: "createChannelNextBtn"
|
||||||
font.weight: Font.Medium
|
|
||||||
height: 44
|
|
||||||
text: (typeof currentItem.nextButtonText !== "undefined") ? currentItem.nextButtonText :
|
text: (typeof currentItem.nextButtonText !== "undefined") ? currentItem.nextButtonText :
|
||||||
qsTr("Import chat history")
|
qsTr("Import chat history")
|
||||||
enabled: typeof(currentItem.canGoNext) == "undefined" || currentItem.canGoNext
|
enabled: typeof(currentItem.canGoNext) == "undefined" || currentItem.canGoNext
|
||||||
|
@ -289,9 +285,7 @@ StatusStackModal {
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property StatusButton clearFilesButton: StatusButton {
|
readonly property StatusButton clearFilesButton: StatusButton {
|
||||||
font.weight: Font.Medium
|
|
||||||
text: qsTr("Clear all")
|
text: qsTr("Clear all")
|
||||||
height: 44
|
|
||||||
type: StatusBaseButton.Type.Danger
|
type: StatusBaseButton.Type.Danger
|
||||||
visible: typeof currentItem.isFileListView !== "undefined" && currentItem.isFileListView
|
visible: typeof currentItem.isFileListView !== "undefined" && currentItem.isFileListView
|
||||||
enabled: !fileListView.fileListModelEmpty && !root.communitiesStore.discordDataExtractionInProgress
|
enabled: !fileListView.fileListModelEmpty && !root.communitiesStore.discordDataExtractionInProgress
|
||||||
|
@ -348,7 +342,6 @@ StatusStackModal {
|
||||||
if (root.channelEmoji) {
|
if (root.channelEmoji) {
|
||||||
nameInput.input.asset.emoji = root.channelEmoji
|
nameInput.input.asset.emoji = root.channelEmoji
|
||||||
}
|
}
|
||||||
colorPanel.color = root.channelColor
|
|
||||||
} else {
|
} else {
|
||||||
nameInput.input.asset.isLetterIdenticon = true;
|
nameInput.input.asset.isLetterIdenticon = true;
|
||||||
}
|
}
|
||||||
|
@ -452,7 +445,6 @@ StatusStackModal {
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
text: qsTr("Refer to this <a href='https://github.com/Tyrrrz/DiscordChatExporter/blob/master/.docs/Readme.md'>documentation</a> if you have any queries")
|
text: qsTr("Refer to this <a href='https://github.com/Tyrrrz/DiscordChatExporter/blob/master/.docs/Readme.md'>documentation</a> if you have any queries")
|
||||||
onLinkActivated: Global.openLink(link)
|
onLinkActivated: Global.openLink(link)
|
||||||
onHoveredLinkChanged: print(hoveredLink)
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.NoButton
|
acceptedButtons: Qt.NoButton
|
||||||
|
@ -705,7 +697,7 @@ StatusStackModal {
|
||||||
input.letterIconName = text
|
input.letterIconName = text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
input.asset.color: colorPanel.color.toString()
|
input.asset.color: colorPanel.color
|
||||||
input.rightComponent: StatusRoundButton {
|
input.rightComponent: StatusRoundButton {
|
||||||
objectName: "StatusChannelPopup_emojiButton"
|
objectName: "StatusChannelPopup_emojiButton"
|
||||||
implicitWidth: 32
|
implicitWidth: 32
|
||||||
|
@ -747,6 +739,7 @@ StatusStackModal {
|
||||||
|
|
||||||
property string validationError: ""
|
property string validationError: ""
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
height: 44
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
bgColor: colorPanel.colorSelected ? colorPanel.color : Theme.palette.baseColor2
|
bgColor: colorPanel.colorSelected ? colorPanel.color : Theme.palette.baseColor2
|
||||||
contentColor: colorPanel.colorSelected ? Theme.palette.white : Theme.palette.baseColor1
|
contentColor: colorPanel.colorSelected ? Theme.palette.white : Theme.palette.baseColor1
|
||||||
|
@ -909,8 +902,8 @@ StatusStackModal {
|
||||||
leftPadding: 16
|
leftPadding: 16
|
||||||
rightPadding: 16
|
rightPadding: 16
|
||||||
height: Math.min(parent.height, 624)
|
height: Math.min(parent.height, 624)
|
||||||
property bool colorSelected: root.isEdit && root.channelColor
|
property bool colorSelected: !!root.channelColor && root.channelColor != Theme.palette.primaryColor1
|
||||||
color: root.isEdit && root.channelColor ? root.channelColor : Theme.palette.primaryColor1
|
color: root.channelColor || Theme.palette.primaryColor1
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
colorSelected = true; d.colorPickerOpened = false; d.currentPage = CreateChannelPopup.CurrentPage.ChannelDetails;
|
colorSelected = true; d.colorPickerOpened = false; d.currentPage = CreateChannelPopup.CurrentPage.ChannelDetails;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue