Use null coalescing.
This commit is contained in:
@@ -26,7 +26,7 @@ TextField {
|
||||
states: [
|
||||
State {
|
||||
name: "shown"
|
||||
when: textField.text.length !== 0 || textField.activeFocus
|
||||
when: textField.text.length != 0 || textField.activeFocus
|
||||
PropertyChanges { target: floatingPlaceholder; scale: 0.8 }
|
||||
PropertyChanges { target: floatingPlaceholder; anchors.topMargin: -floatingPlaceholder.height * 0.4 }
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ RowLayout {
|
||||
}
|
||||
|
||||
Label {
|
||||
readonly property int duration: content.info.duration || audio.duration || 0
|
||||
readonly property int duration: content.info.duration ?? audio.duration ?? 0
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
@@ -193,14 +193,12 @@ RowLayout {
|
||||
}
|
||||
}
|
||||
|
||||
function openSavedFile()
|
||||
{
|
||||
function openSavedFile() {
|
||||
if (Qt.openUrlExternally(progressInfo.localPath)) return;
|
||||
if (Qt.openUrlExternally(progressInfo.localDir)) return;
|
||||
}
|
||||
|
||||
function humanSize(duration)
|
||||
{
|
||||
function humanSize(duration) {
|
||||
if (!duration)
|
||||
return qsTr("Unknown", "Unknown duration")
|
||||
if (duration < 1000)
|
||||
|
||||
@@ -68,7 +68,7 @@ RowLayout {
|
||||
}
|
||||
|
||||
Image {
|
||||
readonly property bool isThumbnail: !(content.info.thumbnail_info == null || content.thumbnailMediaId == null)
|
||||
readonly property bool isThumbnail: content.info.thumbnail_info && content.thumbnailMediaId
|
||||
readonly property var info: isThumbnail ? content.info.thumbnail_info : content.info
|
||||
readonly property string mediaId: isThumbnail ? content.thumbnailMediaId : content.mediaId
|
||||
readonly property int maxWidth: messageListView.width - (!sentByMe ? 36 + root.spacing : 0) - 48
|
||||
|
||||
@@ -15,9 +15,9 @@ ColumnLayout {
|
||||
readonly property bool avatarVisible: !sentByMe && showAuthor
|
||||
readonly property bool sentByMe: author.isLocalUser
|
||||
readonly property bool darkBackground: !sentByMe
|
||||
readonly property bool replyVisible: reply || false
|
||||
readonly property bool failed: marks === EventStatus.SendingFailed
|
||||
readonly property color authorColor: eventType === "notice" ? MPalette.primary : author.color
|
||||
readonly property bool replyVisible: reply ?? false
|
||||
readonly property bool failed: marks == EventStatus.SendingFailed
|
||||
readonly property color authorColor: eventType == "notice" ? MPalette.primary : author.color
|
||||
readonly property color replyAuthorColor: replyVisible ? reply.author.color : MPalette.accent
|
||||
|
||||
signal saveFileAs()
|
||||
|
||||
@@ -4,7 +4,7 @@ import QtQuick.Layouts 1.12
|
||||
import Spectral.Setting 0.1
|
||||
|
||||
Flow {
|
||||
visible: (reaction && reaction.length > 0) || false
|
||||
visible: (reaction && reaction.length > 0) ?? false
|
||||
|
||||
spacing: 8
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ RowLayout {
|
||||
}
|
||||
|
||||
Image {
|
||||
readonly property bool isThumbnail: !(content.info.thumbnail_info == null || content.thumbnailMediaId == null)
|
||||
readonly property bool isThumbnail: content.info.thumbnail_info && content.thumbnailMediaId
|
||||
readonly property var info: isThumbnail ? content.info.thumbnail_info : content.info
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
Reference in New Issue
Block a user