Compare commits

...

4 Commits

Author SHA1 Message Date
Tobias Fella
604c652821 Use Quotient qml module 2025-09-15 16:48:44 +02:00
Tobias Fella
cc2daa2021 Use PageStack.closeDialog attached function 2025-09-15 16:47:55 +02:00
Tobias Fella
e2de5b5f00 Fix qml warnings in key verification 2025-09-15 16:47:21 +02:00
Tobias Fella
1896d69253 Modernize PropertyChanges 2025-09-15 16:15:08 +02:00
13 changed files with 71 additions and 124 deletions

View File

@@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2022 Tobias Fella <tobias.fella@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
@@ -8,8 +10,8 @@ import QtQuick.Window
import QtQml
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.delegates as Delegates
import org.kde.neochat
import io.github.quotient_im.libquotient
Kirigami.Page {
id: root
@@ -23,72 +25,63 @@ Kirigami.Page {
name: "cancelled"
when: root.session.state === KeyVerificationSession.CANCELED
PropertyChanges {
target: stateLoader
sourceComponent: verificationCanceled
stateLoader.sourceComponent: verificationCanceled
}
},
State {
name: "waitingForVerification"
when: root.session.state === KeyVerificationSession.WAITINGFORVERIFICATION
PropertyChanges {
target: stateLoader
sourceComponent: emojiSas
stateLoader.sourceComponent: emojiSas
}
},
State {
name: "waitingForReady"
when: root.session.state === KeyVerificationSession.WAITINGFORREADY
PropertyChanges {
target: stateLoader
sourceComponent: message
stateLoader.sourceComponent: message
}
},
State {
name: "incoming"
when: root.session.state === KeyVerificationSession.INCOMING
PropertyChanges {
target: stateLoader
sourceComponent: message
stateLoader.sourceComponent: message
}
},
State {
name: "waitingForKey"
when: root.session.state === KeyVerificationSession.WAITINGFORKEY
PropertyChanges {
target: stateLoader
sourceComponent: message
stateLoader.sourceComponent: message
}
},
State {
name: "waitingForAccept"
when: root.session.state === KeyVerificationSession.WAITINGFORACCEPT
PropertyChanges {
target: stateLoader
sourceComponent: message
stateLoader.sourceComponent: message
}
},
State {
name: "waitingForMac"
when: root.session.state === KeyVerificationSession.WAITINGFORMAC
PropertyChanges {
target: stateLoader
sourceComponent: message
stateLoader.sourceComponent: message
}
},
State {
name: "ready"
when: root.session.state === KeyVerificationSession.READY
PropertyChanges {
target: stateLoader
sourceComponent: chooseVerificationComponent
stateLoader.sourceComponent: chooseVerificationComponent
}
},
State {
name: "done"
when: root.session.state === KeyVerificationSession.DONE
PropertyChanges {
target: stateLoader
sourceComponent: message
stateLoader.sourceComponent: message
}
}
]
@@ -172,7 +165,7 @@ Kirigami.Page {
}
}
isDone: root.session.state === KeyVerificationSession.DONE
onDone: root.closeDialog()
onDone: root.Kirigami.PageStack.closeDialog()
}
}

View File

@@ -5,6 +5,7 @@ import QtQuick
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
import io.github.quotient_im.libquotient
import org.kde.neochat

View File

@@ -5,6 +5,7 @@ import QtQuick
import QtQml
import org.kde.neochat
import io.github.quotient_im.libquotient
VerificationMessage {
id: root

View File

@@ -53,22 +53,19 @@ ColumnLayout {
when: !root.fileTransferInfo.completed && !root.fileTransferInfo.active
PropertyChanges {
target: playButton
icon.name: "media-playback-start"
onClicked: Message.room.downloadFile(root.eventId)
playButton.icon.name: "media-playback-start"
playButton.onClicked: Message.room.downloadFile(root.eventId)
}
},
State {
name: "downloading"
when: root.fileTransferInfo.active && !root.fileTransferInfo.completed
PropertyChanges {
target: downloadBar
visible: true
downloadBar.visible: true
}
PropertyChanges {
target: playButton
icon.name: "media-playback-stop"
onClicked: {
playButton.icon.name: "media-playback-stop"
playButton.onClicked: {
Message.room.cancelFileTransfer(root.eventId);
}
}
@@ -77,9 +74,8 @@ ColumnLayout {
name: "paused"
when: root.fileTransferInfo.completed && (audio.playbackState === MediaPlayer.StoppedState || audio.playbackState === MediaPlayer.PausedState)
PropertyChanges {
target: playButton
icon.name: "media-playback-start"
onClicked: {
playButton.icon.name: "media-playback-start"
playButton.onClicked: {
audio.source = root.fileTransferInfo.localPath;
MediaManager.startPlayback();
audio.play();
@@ -91,11 +87,8 @@ ColumnLayout {
when: root.fileTransferInfo.completed && audio.playbackState === MediaPlayer.PlayingState
PropertyChanges {
target: playButton
icon.name: "media-playback-pause"
onClicked: audio.pause()
playButton.icon.name: "media-playback-pause"
playButton.onClicked: audio.pause()
}
}
]

View File

@@ -43,6 +43,7 @@ ecm_add_qml_module(MessageContent GENERATE_PLUGIN_SOURCE
ThreadBodyComponent.qml
VideoComponent.qml
SOURCES
messageattached.cpp
contentprovider.cpp
mediasizehelper.cpp
pollhandler.cpp
@@ -53,6 +54,7 @@ ecm_add_qml_module(MessageContent GENERATE_PLUGIN_SOURCE
models/reactionmodel.cpp
models/threadmodel.cpp
models/eventmessagecontentmodel.cpp
models/messagecontentfiltermodel.cpp
RESOURCES
images/bike.svg
images/bus.svg
@@ -81,6 +83,9 @@ ecm_add_qml_module(MessageContent GENERATE_PLUGIN_SOURCE
images/walk.svg
DEPENDENCIES
QtQuick
IMPORTS
org.kde.neochat.libneochat
io.github.quotient_im.libquotient
)
configure_file(config-neochat.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-neochat.h)

View File

@@ -73,16 +73,13 @@ ColumnLayout {
when: root.fileTransferInfo.completed && autoOpenFile
PropertyChanges {
target: openButton
icon.name: "document-open"
onClicked: openSavedFile()
}
PropertyChanges {
target: downloadButton
icon.name: "download"
QQC2.ToolTip.text: i18nc("tooltip for a button on a message; offers ability to download its file", "Download")
onClicked: saveFileAs()
openButton.icon.name: "document-open"
openButton.onClicked: openSavedFile()
downloadButton {
icon.name: "download"
QQC2.ToolTip.text: i18nc("tooltip for a button on a message; offers ability to download its file", "Download")
onClicked: saveFileAs()
}
}
},
State {
@@ -90,15 +87,12 @@ ColumnLayout {
when: root.fileTransferInfo.completed && !autoOpenFile
PropertyChanges {
target: openButton
visible: false
}
PropertyChanges {
target: downloadButton
icon.name: "document-open"
QQC2.ToolTip.text: i18nc("tooltip for a button on a message; offers ability to open its downloaded file with an appropriate application", "Open File")
onClicked: openSavedFile()
openButton.visible: false
downloadButton {
icon.name: "document-open"
QQC2.ToolTip.text: i18nc("tooltip for a button on a message; offers ability to open its downloaded file with an appropriate application", "Open File")
onClicked: openSavedFile()
}
}
},
State {
@@ -106,19 +100,13 @@ ColumnLayout {
when: root.fileTransferInfo.active
PropertyChanges {
target: openButton
visible: false
}
PropertyChanges {
target: sizeLabel
text: i18nc("file download progress", "%1 / %2", Format.formatByteSize(root.fileTransferInfo.progress), Format.formatByteSize(root.fileTransferInfo.total))
}
PropertyChanges {
target: downloadButton
icon.name: "media-playback-stop"
QQC2.ToolTip.text: i18nc("tooltip for a button on a message; stops downloading the message's file", "Stop Download")
onClicked: Message.room.cancelFileTransfer(root.eventId)
sizeLabel.text: i18nc("file download progress", "%1 / %2", Format.formatByteSize(root.fileTransferInfo.progress), Format.formatByteSize(root.fileTransferInfo.total))
openButton.visible: false
downloadButton {
icon.name: "media-playback-stop"
QQC2.ToolTip.text: i18nc("tooltip for a button on a message; stops downloading the message's file", "Stop Download")
onClicked: Message.room.cancelFileTransfer(root.eventId)
}
}
}
]

View File

@@ -75,37 +75,25 @@ Video {
name: "notDownloaded"
when: !root.fileTransferInfo.completed && !root.fileTransferInfo.active
PropertyChanges {
target: videoLabel
visible: true
}
PropertyChanges {
target: mediaThumbnail
visible: true
videoLabel.visible: true
mediaThumbnail.visible: true
}
},
State {
name: "downloading"
when: root.fileTransferInfo.active && !root.fileTransferInfo.completed && (Controller.isImageShown(root.eventId) || !NeoChatConfig.hideImages)
PropertyChanges {
target: downloadBar
visible: true
}
PropertyChanges {
target: mediaThumbnail
visible: true
downloadBar.visible: true
mediaThumbnail.visible: true
}
},
State {
name: "paused"
when: root.fileTransferInfo.completed && root.playbackState === MediaPlayer.PausedState && (Controller.isImageShown(root.eventId) || !NeoChatConfig.hideImages)
PropertyChanges {
target: videoControls
stateVisible: true
}
PropertyChanges {
target: playButton
icon.name: "media-playback-start"
onClicked: {
videoControls.stateVisible: true
playButton.icon.name: "media-playback-start"
playButton.onClicked: {
MediaManager.startPlayback();
root.play();
}
@@ -115,34 +103,20 @@ Video {
name: "playing"
when: root.fileTransferInfo.completed && root.playbackState === MediaPlayer.PlayingState && (Controller.isImageShown(root.eventId) || !NeoChatConfig.hideImages)
PropertyChanges {
target: videoControls
stateVisible: true
}
PropertyChanges {
target: playButton
icon.name: "media-playback-pause"
onClicked: root.pause()
videoControls.stateVisible: true
playButton.icon.name: "media-playback-pause"
playButton.onClicked: root.pause()
}
},
State {
name: "stopped"
when: root.fileTransferInfo.completed && root.playbackState === MediaPlayer.StoppedState && (Controller.isImageShown(root.eventId) || !NeoChatConfig.hideImages)
PropertyChanges {
target: videoControls
stateVisible: true
}
PropertyChanges {
target: mediaThumbnail
visible: true
}
PropertyChanges {
target: videoLabel
visible: true
}
PropertyChanges {
target: playButton
icon.name: "media-playback-start"
onClicked: {
videoControls.stateVisible: true
mediaThumbnail.visible: true
videoLabel.visible: true
playButton.icon.name: "media-playback-start"
playButton.onClicked: {
MediaManager.startPlayback();
root.play();
}
@@ -151,16 +125,9 @@ Video {
State {
name: "hidden"
PropertyChanges {
target: mediaThumbnail
visible: false
}
PropertyChanges {
target: videoControls
visible: false
}
PropertyChanges {
target: hidden
visible: true
mediaThumbnail.visible: false
videoControls.visible: false
hidden.visible: true
}
}
]

View File

@@ -23,12 +23,10 @@ ecm_add_qml_module(Timeline GENERATE_PLUGIN_SOURCE
TypingPane.qml
DelegateContextMenu.qml
SOURCES
messageattached.cpp
messagedelegate.cpp
timelinedelegate.cpp
enums/delegatetype.h
models/mediamessagefiltermodel.cpp
models/messagecontentfiltermodel.cpp
models/messagefiltermodel.cpp
models/messagemodel.cpp
models/pinnedmessagemodel.cpp
@@ -39,6 +37,8 @@ ecm_add_qml_module(Timeline GENERATE_PLUGIN_SOURCE
models/webshortcutmodel.cpp
DEPENDENCIES
QtQuick
org.kde.neochat.libneochat
io.github.quotient_im.libquotient
)
target_include_directories(Timeline PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/enums ${CMAKE_CURRENT_SOURCE_DIR}/models)

View File

@@ -1,16 +1,15 @@
// SPDX-FileCopyrightText: 2020 Black Hat <bhat@encom.eu.org>
// SPDX-License-Identifier: GPL-3.0-only
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import Qt.labs.qmlmodels
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.components as KirigamiComponents
import org.kde.neochat
import org.kde.neochat.libneochat as LibNeoChat
/**
* @brief The base delegate for all messages in the timeline.