Modernize PropertyChanges
This commit is contained in:
committed by
Tobias Fella
parent
657c8a0dcd
commit
e09e4fb7dc
@@ -23,72 +23,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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -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()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user