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

View File

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

View File

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

View File

@@ -43,6 +43,7 @@ ecm_add_qml_module(MessageContent GENERATE_PLUGIN_SOURCE
ThreadBodyComponent.qml ThreadBodyComponent.qml
VideoComponent.qml VideoComponent.qml
SOURCES SOURCES
messageattached.cpp
contentprovider.cpp contentprovider.cpp
mediasizehelper.cpp mediasizehelper.cpp
pollhandler.cpp pollhandler.cpp
@@ -53,6 +54,7 @@ ecm_add_qml_module(MessageContent GENERATE_PLUGIN_SOURCE
models/reactionmodel.cpp models/reactionmodel.cpp
models/threadmodel.cpp models/threadmodel.cpp
models/eventmessagecontentmodel.cpp models/eventmessagecontentmodel.cpp
models/messagecontentfiltermodel.cpp
RESOURCES RESOURCES
images/bike.svg images/bike.svg
images/bus.svg images/bus.svg
@@ -81,6 +83,9 @@ ecm_add_qml_module(MessageContent GENERATE_PLUGIN_SOURCE
images/walk.svg images/walk.svg
DEPENDENCIES DEPENDENCIES
QtQuick QtQuick
IMPORTS
org.kde.neochat.libneochat
io.github.quotient_im.libquotient
) )
configure_file(config-neochat.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-neochat.h) 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 when: root.fileTransferInfo.completed && autoOpenFile
PropertyChanges { PropertyChanges {
target: openButton openButton.icon.name: "document-open"
icon.name: "document-open" openButton.onClicked: openSavedFile()
onClicked: openSavedFile() downloadButton {
} icon.name: "download"
QQC2.ToolTip.text: i18nc("tooltip for a button on a message; offers ability to download its file", "Download")
PropertyChanges { onClicked: saveFileAs()
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()
} }
}, },
State { State {
@@ -90,15 +87,12 @@ ColumnLayout {
when: root.fileTransferInfo.completed && !autoOpenFile when: root.fileTransferInfo.completed && !autoOpenFile
PropertyChanges { PropertyChanges {
target: openButton openButton.visible: false
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")
PropertyChanges { onClicked: openSavedFile()
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()
} }
}, },
State { State {
@@ -106,19 +100,13 @@ ColumnLayout {
when: root.fileTransferInfo.active when: root.fileTransferInfo.active
PropertyChanges { PropertyChanges {
target: openButton sizeLabel.text: i18nc("file download progress", "%1 / %2", Format.formatByteSize(root.fileTransferInfo.progress), Format.formatByteSize(root.fileTransferInfo.total))
visible: false openButton.visible: false
} downloadButton {
icon.name: "media-playback-stop"
PropertyChanges { QQC2.ToolTip.text: i18nc("tooltip for a button on a message; stops downloading the message's file", "Stop Download")
target: sizeLabel onClicked: Message.room.cancelFileTransfer(root.eventId)
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)
} }
} }
] ]

View File

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

View File

@@ -23,12 +23,10 @@ ecm_add_qml_module(Timeline GENERATE_PLUGIN_SOURCE
TypingPane.qml TypingPane.qml
DelegateContextMenu.qml DelegateContextMenu.qml
SOURCES SOURCES
messageattached.cpp
messagedelegate.cpp messagedelegate.cpp
timelinedelegate.cpp timelinedelegate.cpp
enums/delegatetype.h enums/delegatetype.h
models/mediamessagefiltermodel.cpp models/mediamessagefiltermodel.cpp
models/messagecontentfiltermodel.cpp
models/messagefiltermodel.cpp models/messagefiltermodel.cpp
models/messagemodel.cpp models/messagemodel.cpp
models/pinnedmessagemodel.cpp models/pinnedmessagemodel.cpp
@@ -39,6 +37,8 @@ ecm_add_qml_module(Timeline GENERATE_PLUGIN_SOURCE
models/webshortcutmodel.cpp models/webshortcutmodel.cpp
DEPENDENCIES DEPENDENCIES
QtQuick 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) 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-FileCopyrightText: 2020 Black Hat <bhat@encom.eu.org>
// SPDX-License-Identifier: GPL-3.0-only // SPDX-License-Identifier: GPL-3.0-only
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Controls as QQC2 import QtQuick.Controls as QQC2
import QtQuick.Layouts
import Qt.labs.qmlmodels
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.components as KirigamiComponents import org.kde.kirigamiaddons.components as KirigamiComponents
import org.kde.neochat import org.kde.neochat
import org.kde.neochat.libneochat as LibNeoChat
/** /**
* @brief The base delegate for all messages in the timeline. * @brief The base delegate for all messages in the timeline.