diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-06-02 01:29:05 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-06-08 22:32:07 +0200 |
commit | 54e2295c214874a316d22eaedaf5c2db17b59df0 (patch) | |
tree | 2c88e09be38e2758dfcd3fe6732da484f99d94c5 /resources/qml/delegates | |
parent | First runnable qt6 Nheko (diff) | |
download | nheko-54e2295c214874a316d22eaedaf5c2db17b59df0.tar.xz |
Fix palette access and QMediaPlayer errors
Diffstat (limited to '')
-rw-r--r-- | resources/qml/delegates/Encrypted.qml | 5 | ||||
-rw-r--r-- | resources/qml/delegates/EncryptionEnabled.qml | 6 | ||||
-rw-r--r-- | resources/qml/delegates/FileMessage.qml | 8 | ||||
-rw-r--r-- | resources/qml/delegates/ImageMessage.qml | 12 | ||||
-rw-r--r-- | resources/qml/delegates/MessageDelegate.qml | 8 | ||||
-rw-r--r-- | resources/qml/delegates/NoticeMessage.qml | 2 | ||||
-rw-r--r-- | resources/qml/delegates/Pill.qml | 4 | ||||
-rw-r--r-- | resources/qml/delegates/Placeholder.qml | 2 | ||||
-rw-r--r-- | resources/qml/delegates/PlayableMediaMessage.qml | 8 | ||||
-rw-r--r-- | resources/qml/delegates/Redacted.qml | 6 | ||||
-rw-r--r-- | resources/qml/delegates/Reply.qml | 6 | ||||
-rw-r--r-- | resources/qml/delegates/TextMessage.qml | 14 |
12 files changed, 39 insertions, 42 deletions
diff --git a/resources/qml/delegates/Encrypted.qml b/resources/qml/delegates/Encrypted.qml index 74e1cb0d..fdfe958e 100644 --- a/resources/qml/delegates/Encrypted.qml +++ b/resources/qml/delegates/Encrypted.qml @@ -18,7 +18,7 @@ Rectangle { width: parent.width? parent.width : 0 implicitWidth: encryptedText.implicitWidth+24+Nheko.paddingMedium*3 // Column doesn't provide a useful implicitWidth, should be replaced by ColumnLayout height: contents.implicitHeight + Nheko.paddingMedium * 2 - color: Nheko.colors.alternateBase + color: palette.alternateBase RowLayout { id: contents @@ -58,12 +58,11 @@ Rectangle { return qsTr("Unknown decryption error"); } } - color: Nheko.colors.text + color: palette.text width: parent.width } Button { - palette: Nheko.colors visible: encryptionError == Olm.MissingSession || encryptionError == Olm.MissingSessionIndex text: qsTr("Request key") onClicked: room.requestKeyForEvent(eventId) diff --git a/resources/qml/delegates/EncryptionEnabled.qml b/resources/qml/delegates/EncryptionEnabled.qml index e38be4b0..c8671c84 100644 --- a/resources/qml/delegates/EncryptionEnabled.qml +++ b/resources/qml/delegates/EncryptionEnabled.qml @@ -17,7 +17,7 @@ Rectangle { width: parent.width ? Math.min(parent.width, 700) : 0 anchors.horizontalCenter: parent.horizontalCenter height: contents.implicitHeight + Nheko.paddingMedium * 2 - color: Nheko.colors.alternateBase + color: palette.alternateBase border.color: Nheko.theme.green border.width: 2 @@ -43,13 +43,13 @@ Rectangle { text: qsTr("%1 enabled end-to-end encryption").arg(r.username) font.bold: true font.pointSize: 14 - color: Nheko.colors.text + color: palette.text width: parent.width } MatrixText { text: qsTr("Encryption keeps your messages safe by only allowing the people you sent the message to to read it. For extra security, if you want to make sure you are talking to the right people, you can verify them in real life.") - color: Nheko.colors.text + color: palette.text width: parent.width } diff --git a/resources/qml/delegates/FileMessage.qml b/resources/qml/delegates/FileMessage.qml index b3c44af2..e63ca8e3 100644 --- a/resources/qml/delegates/FileMessage.qml +++ b/resources/qml/delegates/FileMessage.qml @@ -27,7 +27,7 @@ Item { Rectangle { id: button - color: Nheko.colors.light + color: palette.light radius: 22 height: 44 width: 44 @@ -67,7 +67,7 @@ Item { text: filename textFormat: Text.PlainText elide: Text.ElideRight - color: Nheko.colors.text + color: palette.text } Text { @@ -77,7 +77,7 @@ Item { text: filesize textFormat: Text.PlainText elide: Text.ElideRight - color: Nheko.colors.text + color: palette.text } } @@ -85,7 +85,7 @@ Item { } Rectangle { - color: Nheko.colors.alternateBase + color: palette.alternateBase z: -1 radius: 10 anchors.fill: parent diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml index bed4b659..20d727c3 100644 --- a/resources/qml/delegates/ImageMessage.qml +++ b/resources/qml/delegates/ImageMessage.qml @@ -22,7 +22,7 @@ AbstractButton { property int tempWidth: originalWidth < 1? 400: originalWidth implicitWidth: Math.round(tempWidth*Math.min((timelineView.height/divisor)/(tempWidth*proportionalHeight), 1)) - width: Math.min(parent.width,implicitWidth) + width: Math.min(parent?.width ?? 2000,implicitWidth) height: width*proportionalHeight hoverEnabled: true @@ -106,14 +106,14 @@ AbstractButton { ] property int metadataWidth - property bool fitsMetadata: (parent.width - width) > metadataWidth+4 + property bool fitsMetadata: parent != null ? (parent.width - width) > metadataWidth+4 : false Image { id: img visible: !mxcimage.loaded anchors.fill: parent - source: url.replace("mxc://", "image://MxcImage/") + "?scale" + source: url != "" ? (url.replace("mxc://", "image://MxcImage/") + "?scale") : "" asynchronous: true fillMode: Image.PreserveAspectFit smooth: true @@ -137,7 +137,7 @@ AbstractButton { id: blurhash_ anchors.fill: parent - source: blurhash ? ("image://blurhash/" + blurhash) : ("image://colorimage/:/icons/icons/ui/image-failed.svg?" + Nheko.colors.buttonText) + source: blurhash ? ("image://blurhash/" + blurhash) : ("image://colorimage/:/icons/icons/ui/image-failed.svg?" + palette.buttonText) asynchronous: true fillMode: Image.PreserveAspectFit sourceSize.width: parent.width * Screen.devicePixelRatio @@ -158,7 +158,7 @@ AbstractButton { width: parent.width implicitHeight: imgcaption.implicitHeight anchors.bottom: overlay.bottom - color: Nheko.colors.window + color: palette.window opacity: 0.75 } @@ -171,7 +171,7 @@ AbstractButton { verticalAlignment: Text.AlignVCenter // See this MSC: https://github.com/matrix-org/matrix-doc/pull/2530 text: filename ? filename : body - color: Nheko.colors.text + color: palette.text } } diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml index c0bcec0d..cd8109b4 100644 --- a/resources/qml/delegates/MessageDelegate.qml +++ b/resources/qml/delegates/MessageDelegate.qml @@ -13,7 +13,7 @@ Item { required property bool isReply property bool keepFullText: !isReply property alias child: chooser.child - implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : 0 + //implicitWidth: chooser.child?.implicitWidth ?? 0 required property double proportionalHeight required property int type required property string typeString @@ -48,7 +48,7 @@ Item { roleValue: type //anchors.fill: parent - width: parent.width? parent.width: 0 // this should get rid of "cannot read property 'width' of null" + width: parent?.width ?? 0 // this should get rid of "cannot read property 'width' of null" DelegateChoice { roleValue: MtxEvent.UnknownEvent @@ -78,7 +78,6 @@ Item { } Button { - palette: Nheko.colors Layout.alignment: Qt.AlignHCenter text: qsTr("Go to replacement room") onClicked: room.joinReplacementRoom(eventId) @@ -149,7 +148,7 @@ Item { NoticeMessage { formatted: TimelineManager.escapeEmoji(d.userName) + " " + d.formattedBody - color: TimelineManager.userColor(d.userId, Nheko.colors.base) + color: TimelineManager.userColor(d.userId, palette.base) body: d.body isOnlyEmoji: d.isOnlyEmoji isReply: d.isReply @@ -617,7 +616,6 @@ Item { Button { visible: d.relatedEventCacheBuster, room.showAcceptKnockButton(d.eventId) - palette: Nheko.colors Layout.alignment: Qt.AlignHCenter text: qsTr("Allow them in") onClicked: room.acceptKnock(eventId) diff --git a/resources/qml/delegates/NoticeMessage.qml b/resources/qml/delegates/NoticeMessage.qml index d62afb96..88efe7b7 100644 --- a/resources/qml/delegates/NoticeMessage.qml +++ b/resources/qml/delegates/NoticeMessage.qml @@ -9,7 +9,7 @@ import im.nheko 1.0 TextMessage { property bool isStateEvent font.italic: true - color: Nheko.colors.buttonText + color: palette.buttonText font.pointSize: isStateEvent? 0.8*Settings.fontSize : Settings.fontSize horizontalAlignment: isStateEvent? Text.AlignHCenter : undefined } diff --git a/resources/qml/delegates/Pill.qml b/resources/qml/delegates/Pill.qml index b60781cb..3f981d4d 100644 --- a/resources/qml/delegates/Pill.qml +++ b/resources/qml/delegates/Pill.qml @@ -8,14 +8,14 @@ import im.nheko 1.0 Label { property bool isStateEvent - color: Nheko.colors.text + color: palette.text horizontalAlignment: Text.AlignHCenter height: Math.round(fontMetrics.height * 1.4) width: contentWidth * 1.2 background: Rectangle { radius: parent.height / 2 - color: Nheko.colors.alternateBase + color: palette.alternateBase } } diff --git a/resources/qml/delegates/Placeholder.qml b/resources/qml/delegates/Placeholder.qml index 08008765..66e28c03 100644 --- a/resources/qml/delegates/Placeholder.qml +++ b/resources/qml/delegates/Placeholder.qml @@ -10,5 +10,5 @@ MatrixText { text: qsTr("unimplemented event: ") + typeString // width: parent.width - color: Nheko.inactiveColors.text + color: palette.inactive.text } diff --git a/resources/qml/delegates/PlayableMediaMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml index 1131856f..60a61372 100644 --- a/resources/qml/delegates/PlayableMediaMessage.qml +++ b/resources/qml/delegates/PlayableMediaMessage.qml @@ -47,7 +47,7 @@ Item { Rectangle { id: videoContainer - color: type == MtxEvent.VideoMessage ? Nheko.colors.window : "transparent" + color: type == MtxEvent.VideoMessage ? palette.window : "transparent" width: parent.width height: parent.height - fileInfoLabel.height @@ -57,7 +57,7 @@ Item { Image { anchors.fill: parent - source: thumbnailUrl ? thumbnailUrl.replace("mxc://", "image://MxcImage/") + "?scale" : "image://colorimage/:/icons/icons/ui/video-file.svg?" + Nheko.colors.windowText + source: thumbnailUrl ? thumbnailUrl.replace("mxc://", "image://MxcImage/") + "?scale" : "image://colorimage/:/icons/icons/ui/video-file.svg?" + palette.windowText asynchronous: true fillMode: Image.PreserveAspectFit @@ -99,10 +99,10 @@ Item { text: body + " [" + filesize + "]" textFormat: Text.RichText elide: Text.ElideRight - color: Nheko.colors.text + color: palette.text background: Rectangle { - color: Nheko.colors.base + color: palette.base } } diff --git a/resources/qml/delegates/Redacted.qml b/resources/qml/delegates/Redacted.qml index 74d4e015..4a9700dc 100644 --- a/resources/qml/delegates/Redacted.qml +++ b/resources/qml/delegates/Redacted.qml @@ -13,7 +13,7 @@ Rectangle{ implicitWidth: redactedLayout.implicitWidth + 2 * Nheko.paddingMedium width: Math.min(parent.width,implicitWidth+1) radius: fontMetrics.lineSpacing / 2 + 2 * Nheko.paddingSmall - color: Nheko.colors.alternateBase + color: palette.alternateBase property int metadataWidth property bool fitsMetadata: parent.width - redactedLayout.width > metadataWidth + 4 @@ -28,7 +28,7 @@ Rectangle{ Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.preferredWidth: fontMetrics.font.pixelSize Layout.preferredHeight: fontMetrics.font.pixelSize - source: "image://colorimage/:/icons/icons/ui/delete.svg?" + Nheko.colors.text + source: "image://colorimage/:/icons/icons/ui/delete.svg?" + palette.text } Label { id: redactedLabel @@ -39,7 +39,7 @@ Rectangle{ property var redactedPair: room.formatRedactedEvent(eventId) text: redactedPair["first"] wrapMode: Label.WordWrap - color: Nheko.colors.text + color: palette.text ToolTip.text: redactedPair["second"] ToolTip.visible: hh.hovered diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml index c593a4f8..94128960 100644 --- a/resources/qml/delegates/Reply.qml +++ b/resources/qml/delegates/Reply.qml @@ -54,7 +54,7 @@ AbstractButton { anchors.top: replyContainer.top anchors.bottom: replyContainer.bottom width: 4 - color: TimelineManager.userColor(userId, Nheko.colors.base) + color: TimelineManager.userColor(userId, palette.base) } onClicked: { @@ -135,8 +135,8 @@ AbstractButton { z: -1 anchors.fill: replyContainer - property color userColor: TimelineManager.userColor(userId, Nheko.colors.base) - property color bgColor: Nheko.colors.base + property color userColor: TimelineManager.userColor(userId, palette.base) + property color bgColor: palette.base color: Qt.tint(bgColor, Qt.hsla(userColor.hslHue, 0.5, userColor.hslLightness, 0.1)) } diff --git a/resources/qml/delegates/TextMessage.qml b/resources/qml/delegates/TextMessage.qml index eb46a9ac..39e8b1a8 100644 --- a/resources/qml/delegates/TextMessage.qml +++ b/resources/qml/delegates/TextMessage.qml @@ -19,15 +19,15 @@ MatrixText { // table border-collapse doesn't seem to work text: " <style type=\"text/css\"> - a { color:" + Nheko.colors.link + ";} - code { background-color: " + Nheko.colors.alternateBase + "; white-space: pre-wrap; } - pre { background-color: " + Nheko.colors.alternateBase + "; white-space: pre-wrap; } + a { color:" + palette.link + ";} + code { background-color: " + palette.alternateBase + "; white-space: pre-wrap; } + pre { background-color: " + palette.alternateBase + "; white-space: pre-wrap; } table { border-width: 1px; border-collapse: collapse; border-style: solid; - border-color: " + Nheko.colors.text + "; - background-color: " + Nheko.colors.alternateBase + "; + border-color: " + palette.text + "; + background-color: " + palette.alternateBase + "; } table th, table td { @@ -36,11 +36,11 @@ MatrixText { blockquote { margin-left: 1em; } " + (!Settings.mobileMode ? "span[data-mx-spoiler] { color: transparent; - background-color: " + Nheko.colors.text + "; + background-color: " + palette.text + "; }" : "") + // TODO(Nico): Figure out how to support mobile "</style> " + formatted.replace(/<del>/g, "<s>").replace(/<\/del>/g, "</s>").replace(/<strike>/g, "<s>").replace(/<\/strike>/g, "</s>") - width: parent.width + width: parent?.width ?? 0 height: !keepFullText ? Math.round(Math.min(timelineView.height / 8, implicitHeight)) : implicitHeight clip: !keepFullText selectByMouse: !Settings.mobileMode && !isReply |