diff --git a/imports/Spectral/Component/AutoTextField.qml b/imports/Spectral/Component/AutoTextField.qml index 134470942..ebcd037d3 100644 --- a/imports/Spectral/Component/AutoTextField.qml +++ b/imports/Spectral/Component/AutoTextField.qml @@ -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 } } diff --git a/imports/Spectral/Component/Timeline/AudioDelegate.qml b/imports/Spectral/Component/Timeline/AudioDelegate.qml index 2a7d563b5..87d2a9119 100644 --- a/imports/Spectral/Component/Timeline/AudioDelegate.qml +++ b/imports/Spectral/Component/Timeline/AudioDelegate.qml @@ -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) diff --git a/imports/Spectral/Component/Timeline/ImageDelegate.qml b/imports/Spectral/Component/Timeline/ImageDelegate.qml index 445c18cfb..4a1fe926d 100644 --- a/imports/Spectral/Component/Timeline/ImageDelegate.qml +++ b/imports/Spectral/Component/Timeline/ImageDelegate.qml @@ -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 diff --git a/imports/Spectral/Component/Timeline/MessageDelegate.qml b/imports/Spectral/Component/Timeline/MessageDelegate.qml index a17a312f3..b1cedfdd7 100644 --- a/imports/Spectral/Component/Timeline/MessageDelegate.qml +++ b/imports/Spectral/Component/Timeline/MessageDelegate.qml @@ -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() diff --git a/imports/Spectral/Component/Timeline/ReactionDelegate.qml b/imports/Spectral/Component/Timeline/ReactionDelegate.qml index 38a393fda..1a9f85117 100644 --- a/imports/Spectral/Component/Timeline/ReactionDelegate.qml +++ b/imports/Spectral/Component/Timeline/ReactionDelegate.qml @@ -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 diff --git a/imports/Spectral/Component/Timeline/VideoDelegate.qml b/imports/Spectral/Component/Timeline/VideoDelegate.qml index abc8f7717..bd22120c6 100644 --- a/imports/Spectral/Component/Timeline/VideoDelegate.qml +++ b/imports/Spectral/Component/Timeline/VideoDelegate.qml @@ -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 diff --git a/imports/Spectral/Dialog/AccountDetailDialog.qml b/imports/Spectral/Dialog/AccountDetailDialog.qml index 75b598b8a..a72d31da5 100644 --- a/imports/Spectral/Dialog/AccountDetailDialog.qml +++ b/imports/Spectral/Dialog/AccountDetailDialog.qml @@ -39,7 +39,7 @@ Dialog { height: 48 source: user.avatarMediaId - hint: user.displayName || "No Name" + hint: user.displayName ?? "" Menu { id: contextMenu diff --git a/imports/Spectral/Effect/ElevationEffect.qml b/imports/Spectral/Effect/ElevationEffect.qml index 0299fd5c2..d5aa66505 100644 --- a/imports/Spectral/Effect/ElevationEffect.qml +++ b/imports/Spectral/Effect/ElevationEffect.qml @@ -135,7 +135,7 @@ Item { glowRadius: modelData.blur/2 spread: 0.05 color: _shadowColors[index] - cornerRadius: modelData.blur + (effect.sourceItem.radius || 0) + cornerRadius: modelData.blur + (effect.sourceItem.radius ?? 0) } } diff --git a/imports/Spectral/Panel/RoomListPanel.qml b/imports/Spectral/Panel/RoomListPanel.qml index cbd64b636..d3ab40e4c 100644 --- a/imports/Spectral/Panel/RoomListPanel.qml +++ b/imports/Spectral/Panel/RoomListPanel.qml @@ -224,7 +224,7 @@ Item { Layout.fillHeight: true source: avatar - hint: name || "No Name" + hint: name ?? "" } ColumnLayout { @@ -236,7 +236,7 @@ Item { Layout.fillWidth: true Layout.fillHeight: true - text: name || "No Name" + text: name ?? "" color: MPalette.foreground font.pixelSize: 16 font.bold: unreadCount >= 0 diff --git a/imports/Spectral/Panel/RoomPanelInput.qml b/imports/Spectral/Panel/RoomPanelInput.qml index 256f9dd46..a3ffa1ebe 100644 --- a/imports/Spectral/Panel/RoomPanelInput.qml +++ b/imports/Spectral/Panel/RoomPanelInput.qml @@ -130,9 +130,9 @@ Control { keyNavigationWraps: true delegate: Control { - property string autoCompleteText: modelData.displayName || modelData.unicode + property string autoCompleteText: modelData.displayName ?? modelData.unicode property bool isEmoji: modelData.unicode != null - readonly property bool highlighted: autoCompleteListView.currentIndex === index + readonly property bool highlighted: autoCompleteListView.currentIndex == index height: 36 padding: 6 @@ -140,7 +140,7 @@ Control { background: Rectangle { visible: !isEmoji color: highlighted ? border.color : "transparent" - border.color: isEmoji ? Material.accent : modelData.color + border.color: isEmoji ? MPalette.accent : modelData.color border.width: 2 radius: height / 2 } @@ -164,7 +164,7 @@ Control { Layout.preferredHeight: 24 visible: !isEmoji - source: modelData.avatarMediaId || null + source: modelData.avatarMediaId ?? null color: modelData.color ? Qt.darker(modelData.color, 1.1) : MPalette.accent }