Fix some qml warnings

pull/1603/head
Nicolas Werner 1 year ago
parent 634a247b4c
commit 904d3f257a
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
  1. 8
      CMakeLists.txt
  2. 8
      resources/qml/EncryptionIndicator.qml
  3. 6
      resources/qml/ImageButton.qml
  4. 2
      resources/qml/Root.qml
  5. 8
      resources/qml/TopBar.qml
  6. 2
      resources/qml/UploadBox.qml
  7. 7
      resources/qml/components/AdaptiveLayout.qml
  8. 4
      resources/qml/components/AdaptiveLayoutElement.qml
  9. 18
      resources/qml/components/AvatarListTile.qml
  10. 8
      resources/qml/components/MainWindowDialog.qml
  11. 7
      resources/qml/components/ReorderableListview.qml
  12. 5
      resources/qml/delegates/Encrypted.qml
  13. 8
      resources/qml/delegates/FileMessage.qml
  14. 18
      resources/qml/delegates/ImageMessage.qml
  15. 12
      resources/qml/delegates/PlayableMediaMessage.qml
  16. 2
      resources/qml/delegates/Redacted.qml
  17. 12
      resources/qml/delegates/Reply.qml
  18. 25
      resources/qml/delegates/TextMessage.qml
  19. 13
      resources/qml/dialogs/IgnoredUsers.qml
  20. 4
      resources/qml/dialogs/RoomSettingsDialog.qml
  21. 1
      resources/qml/ui/Ripple.qml
  22. 6
      resources/qml/ui/media/MediaControls.qml
  23. 8
      resources/qml/voip/CallInviteBar.qml
  24. 8
      resources/qml/voip/ScreenShare.qml
  25. 1
      resources/qml/voip/VideoCall.qml

@ -775,7 +775,7 @@ set(QML_SOURCES
resources/qml/dialogs/RoomDirectory.qml resources/qml/dialogs/RoomDirectory.qml
resources/qml/dialogs/RoomMembers.qml resources/qml/dialogs/RoomMembers.qml
resources/qml/dialogs/AllowedRoomsSettingsDialog.qml resources/qml/dialogs/AllowedRoomsSettingsDialog.qml
resources/qml/dialogs/RoomSettings.qml resources/qml/dialogs/RoomSettingsDialog.qml
resources/qml/dialogs/UserProfile.qml resources/qml/dialogs/UserProfile.qml
resources/qml/dialogs/IgnoredUsers.qml resources/qml/dialogs/IgnoredUsers.qml
resources/qml/emoji/StickerPicker.qml resources/qml/emoji/StickerPicker.qml
@ -805,7 +805,7 @@ qt_add_qml_module(nheko
NO_RESOURCE_TARGET_PATH NO_RESOURCE_TARGET_PATH
RESOURCE_PREFIX "/" RESOURCE_PREFIX "/"
VERSION 1.1 VERSION 1.1
DEPENDENCIES QtQml QtQuick # https://bugreports.qt.io/browse/QTBUG-102554 DEPENDENCIES QtQuick QtQml.Models
QML_FILES QML_FILES
${QML_SOURCES} ${QML_SOURCES}
SOURCES SOURCES
@ -816,6 +816,10 @@ qt_add_qml_module(nheko
# #PREFIX "/" # #PREFIX "/"
#) #)
#set_target_properties(nheko PROPERTIES
# QT_QMLCACHEGEN_ARGUMENTS "--verbose"
#)
# #
# Bundle translations # Bundle translations
# #

@ -2,10 +2,10 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.12 import QtQuick
import QtQuick.Controls 2.1 import QtQuick.Controls
import QtQuick.Window 2.15 import QtQuick.Window
import im.nheko 1.0 import im.nheko
Image { Image {
id: stateImg id: stateImg

@ -4,9 +4,9 @@
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import "./ui" import "./ui"
import QtQuick 2.3 import QtQuick
import QtQuick.Controls 2.3 import QtQuick.Controls
import im.nheko 1.0 // for cursor shape import im.nheko // for cursor shape
AbstractButton { AbstractButton {
id: button id: button

@ -245,7 +245,7 @@ Pane {
} }
} }
function onOpenRoomSettingsDialog(settings) { function onOpenRoomSettingsDialog(settings) {
var component = Qt.createComponent("qrc:/resources/qml/dialogs/RoomSettings.qml"); var component = Qt.createComponent("qrc:/resources/qml/dialogs/RoomSettingsDialog.qml");
if (component.status == Component.Ready) { if (component.status == Component.Ready) {
var roomSettings = component.createObject(timelineRoot, { var roomSettings = component.createObject(timelineRoot, {
"roomSettings": settings "roomSettings": settings

@ -56,11 +56,11 @@ Pane {
Layout.row: 0 Layout.row: 0
displayName: communityName displayName: communityName
enabled: false enabled: false
height: fontMetrics.lineSpacing implicitHeight: fontMetrics.lineSpacing
implicitWidth: fontMetrics.lineSpacing
roomid: communityId roomid: communityId
url: avatarUrl.replace("mxc://", "image://MxcImage/") url: avatarUrl.replace("mxc://", "image://MxcImage/")
visible: roomid && room.parentSpace.isLoaded && ("space:" + room.parentSpace.roomid != Communities.currentTagId) visible: roomid && room.parentSpace.isLoaded && ("space:" + room.parentSpace.roomid != Communities.currentTagId)
width: fontMetrics.lineSpacing
} }
Label { Label {
id: communityLabel id: communityLabel
@ -98,11 +98,11 @@ Pane {
Layout.rowSpan: 2 Layout.rowSpan: 2
displayName: roomName displayName: roomName
enabled: false enabled: false
height: Nheko.avatarSize implicitHeight: Nheko.avatarSize
implicitWidth: Nheko.avatarSize
roomid: roomId roomid: roomId
url: avatarUrl.replace("mxc://", "image://MxcImage/") url: avatarUrl.replace("mxc://", "image://MxcImage/")
userid: isDirect ? directChatOtherUserId : "" userid: isDirect ? directChatOtherUserId : ""
width: Nheko.avatarSize
} }
Label { Label {
Layout.column: 2 Layout.column: 2

@ -2,8 +2,6 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import "./components"
import "./ui"
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.5 import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3

@ -2,10 +2,9 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.12 import QtQuick
import QtQuick.Controls 2.5 import QtQuick.Controls
import QtQuick.Layouts 1.12 import im.nheko
import im.nheko 1.0
Container { Container {
//Component.onCompleted: { //Component.onCompleted: {

@ -2,9 +2,7 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.12 import QtQuick
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.12
Item { Item {
property int minimumWidth: 100 property int minimumWidth: 100

@ -3,10 +3,9 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import ".." import ".."
import QtQuick 2.15 import QtQuick
import QtQuick.Controls 2.15 import QtQuick.Layouts
import QtQuick.Layouts 1.15 import im.nheko
import im.nheko 1.0
Rectangle { Rectangle {
id: tile id: tile
@ -36,13 +35,14 @@ Rectangle {
when: hovered.hovered && !(index == selectedIndex) when: hovered.hovered && !(index == selectedIndex)
PropertyChanges { PropertyChanges {
target: tile tile {
background: palette.dark background: palette.dark
importantText: palette.brightText importantText: palette.brightText
unimportantText: palette.brightText unimportantText: palette.brightText
bubbleBackground: palette.highlight bubbleBackground: palette.highlight
bubbleText: palette.highlightedText bubbleText: palette.highlightedText
} }
}
}, },
State { State {
@ -50,13 +50,14 @@ Rectangle {
when: index == selectedIndex when: index == selectedIndex
PropertyChanges { PropertyChanges {
target: tile tile {
background: palette.highlight background: palette.highlight
importantText: palette.highlightedText importantText: palette.highlightedText
unimportantText: palette.highlightedText unimportantText: palette.highlightedText
bubbleBackground: palette.highlightedText bubbleBackground: palette.highlightedText
bubbleText: palette.highlight bubbleText: palette.highlight
} }
}
} }
] ]
@ -75,8 +76,8 @@ Rectangle {
enabled: false enabled: false
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
height: avatarSize implicitHeight: avatarSize
width: avatarSize implicitWidth: avatarSize
url: tile.avatarUrl.replace("mxc://", "image://MxcImage/") url: tile.avatarUrl.replace("mxc://", "image://MxcImage/")
displayName: title displayName: title
crop: tile.crop crop: tile.crop
@ -88,7 +89,6 @@ Rectangle {
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: 100 Layout.minimumWidth: 100
width: parent.width - avatar.width
Layout.preferredWidth: parent.width - avatar.width Layout.preferredWidth: parent.width - avatar.width
spacing: Nheko.paddingSmall spacing: Nheko.paddingSmall

@ -2,11 +2,9 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import Qt.labs.platform 1.1 as P import QtQuick
import QtQuick 2.15 import QtQuick.Controls
import QtQuick.Controls 2.15 import im.nheko
import QtQuick.Layouts 1.3
import im.nheko 1.0
Dialog { Dialog {
default property alias inner: scroll.data default property alias inner: scroll.data

@ -2,10 +2,9 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15 import QtQuick
import QtQml.Models 2.1 import QtQml.Models
import im.nheko 1.0 import im.nheko
import ".."
Item { Item {
id: root id: root

@ -2,7 +2,6 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import ".."
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
@ -38,7 +37,7 @@ Control {
Label { Label {
id: encryptedText id: encryptedText
text: { text: {
switch (encryptionError) { switch (r.encryptionError) {
case Olm.MissingSession: case Olm.MissingSession:
return qsTr("There is no key to unlock this message. We requested the key automatically, but you can try requesting it again if you are impatient."); return qsTr("There is no key to unlock this message. We requested the key automatically, but you can try requesting it again if you are impatient.");
case Olm.MissingSessionIndex: case Olm.MissingSessionIndex:
@ -63,7 +62,7 @@ Control {
} }
Button { Button {
visible: encryptionError == Olm.MissingSession || encryptionError == Olm.MissingSessionIndex visible: r.encryptionError == Olm.MissingSession || encryptionError == Olm.MissingSessionIndex
text: qsTr("Request key") text: qsTr("Request key")
onClicked: room.requestKeyForEvent(eventId) onClicked: room.requestKeyForEvent(eventId)
} }

@ -32,8 +32,8 @@ Control {
color: palette.light color: palette.light
radius: 22 radius: 22
height: 44 Layout.preferredHeight: 44
width: 44 Layout.preferredWidth: 44
Image { Image {
id: img id: img
@ -68,7 +68,7 @@ Control {
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumWidth: implicitWidth + 1 Layout.maximumWidth: implicitWidth + 1
text: filename text: evRoot.filename
textFormat: Text.PlainText textFormat: Text.PlainText
elide: Text.ElideRight elide: Text.ElideRight
color: palette.text color: palette.text
@ -79,7 +79,7 @@ Control {
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumWidth: implicitWidth + 1 Layout.maximumWidth: implicitWidth + 1
text: filesize text: evRoot.filesize
textFormat: Text.PlainText textFormat: Text.PlainText
elide: Text.ElideRight elide: Text.ElideRight
color: palette.text color: palette.text

@ -34,38 +34,36 @@ AbstractButton {
name: "BlurhashVisible" name: "BlurhashVisible"
PropertyChanges { PropertyChanges {
target: blurhash_ blurhash_ {
opacity: (img.status != Image.Ready) || (timeline.privacyScreen.active && blurhash) ? 1 : 0 opacity: (img.status != Image.Ready) || (timeline.privacyScreen.active && blurhash) ? 1 : 0
visible: (img.status != Image.Ready) || (timeline.privacyScreen.active && blurhash) visible: (img.status != Image.Ready) || (timeline.privacyScreen.active && blurhash)
} }
}
PropertyChanges { PropertyChanges {
target: img img.opacity: 0
opacity: 0
} }
PropertyChanges { PropertyChanges {
target: mxcimage mxcimage.opacity: 0
opacity: 0
} }
}, },
State { State {
name: "ImageVisible" name: "ImageVisible"
PropertyChanges { PropertyChanges {
target: blurhash_ blurhash_ {
opacity: 0 opacity: 0
visible: false visible: false
} }
}
PropertyChanges { PropertyChanges {
target: img img.opacity: 1
opacity: 1
} }
PropertyChanges { PropertyChanges {
target: mxcimage mxcimage.opacity: 1
opacity: 1
} }
} }
] ]

@ -2,12 +2,10 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import "../"
import "../ui/media" import "../ui/media"
import QtMultimedia import QtMultimedia
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts
import im.nheko import im.nheko
Item { Item {
@ -47,7 +45,7 @@ Item {
Rectangle { Rectangle {
id: videoContainer id: videoContainer
color: type == MtxEvent.VideoMessage ? palette.window : "transparent" color: content.type == MtxEvent.VideoMessage ? palette.window : "transparent"
width: parent.width width: parent.width
height: parent.height - fileInfoLabel.height height: parent.height - fileInfoLabel.height
@ -57,14 +55,14 @@ Item {
Image { Image {
anchors.fill: parent anchors.fill: parent
source: thumbnailUrl ? thumbnailUrl.replace("mxc://", "image://MxcImage/") + "?scale" : "image://colorimage/:/icons/icons/ui/video-file.svg?" + palette.windowText source: content.thumbnailUrl ? thumbnailUrl.replace("mxc://", "image://MxcImage/") + "?scale" : "image://colorimage/:/icons/icons/ui/video-file.svg?" + palette.windowText
asynchronous: true asynchronous: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
VideoOutput { VideoOutput {
id: videoOutput id: videoOutput
visible: type == MtxEvent.VideoMessage visible: content.type == MtxEvent.VideoMessage
clip: true clip: true
anchors.fill: parent anchors.fill: parent
fillMode: VideoOutput.PreserveAspectFit fillMode: VideoOutput.PreserveAspectFit
@ -79,7 +77,7 @@ Item {
anchors.left: videoContainer.left anchors.left: videoContainer.left
anchors.right: videoContainer.right anchors.right: videoContainer.right
anchors.bottom: videoContainer.bottom anchors.bottom: videoContainer.bottom
playingVideo: type == MtxEvent.VideoMessage playingVideo: content.type == MtxEvent.VideoMessage
positionValue: mxcmedia.position positionValue: mxcmedia.position
duration: mediaLoaded ? mxcmedia.duration : content.duration duration: mediaLoaded ? mxcmedia.duration : content.duration
mediaLoaded: mxcmedia.loaded mediaLoaded: mxcmedia.loaded
@ -95,7 +93,7 @@ Item {
id: fileInfoLabel id: fileInfoLabel
anchors.top: videoContainer.bottom anchors.top: videoContainer.bottom
text: body + " [" + filesize + "]" text: content.body + " [" + filesize + "]"
textFormat: Text.RichText textFormat: Text.RichText
elide: Text.ElideRight elide: Text.ElideRight
color: palette.text color: palette.text

@ -33,7 +33,7 @@ Control {
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
Layout.maximumWidth: implicitWidth + 1 Layout.maximumWidth: implicitWidth + 1
Layout.fillWidth: true Layout.fillWidth: true
property var redactedPair: room.formatRedactedEvent(msgRoot.eventId) property var redactedPair: msgRoot.room.formatRedactedEvent(msgRoot.eventId)
text: redactedPair["first"] text: redactedPair["first"]
wrapMode: Label.WordWrap wrapMode: Label.WordWrap

@ -2,12 +2,10 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import Qt.labs.platform 1.1 as Platform import QtQuick
import QtQuick 2.12 import QtQuick.Controls
import QtQuick.Controls 2.3 import QtQuick.Window
import QtQuick.Layouts 1.2 import im.nheko
import QtQuick.Window 2.13
import im.nheko 1.0
import "../" import "../"
AbstractButton { AbstractButton {
@ -45,7 +43,7 @@ AbstractButton {
id: timelineEvent id: timelineEvent
isStateEvent: false isStateEvent: false
room: room_ room: r.room_
eventId: r.eventId eventId: r.eventId
replyTo: "" replyTo: ""
mainInset: 4 + Nheko.paddingMedium mainInset: 4 + Nheko.paddingMedium

@ -3,7 +3,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import ".." import ".."
import QtQuick.Controls
import im.nheko import im.nheko
MatrixText { MatrixText {
@ -18,28 +17,28 @@ MatrixText {
property bool fitsMetadata: false //positionAt(width,height-4) == positionAt(width-metadataWidth-10, height-4) property bool fitsMetadata: false //positionAt(width,height-4) == positionAt(width-metadataWidth-10, height-4)
// table border-collapse doesn't seem to work // table border-collapse doesn't seem to work
text: " text: `
<style type=\"text/css\"> <style type="text/css">
code { background-color: " + palette.alternateBase + "; white-space: pre-wrap; } code { background-color: ` + palette.alternateBase + `; white-space: pre-wrap; }
pre { background-color: " + palette.alternateBase + "; white-space: pre-wrap; } pre { background-color: ` + palette.alternateBase + `; white-space: pre-wrap; }
table { table {
border-width: 1px; border-width: 1px;
border-collapse: collapse; border-collapse: collapse;
border-style: solid; border-style: solid;
border-color: " + palette.text + "; border-color: ` + palette.text + `;
background-color: " + palette.alternateBase + "; background-color: ` + palette.alternateBase + `;
} }
table th, table th,
table td { table td {
padding: " + Math.ceil(fontMetrics.lineSpacing/2) + "px; padding: ` + Math.ceil(fontMetrics.lineSpacing/2) + `px;
} }
blockquote { margin-left: 1em; } blockquote { margin-left: 1em; }
" + (!Settings.mobileMode ? "span[data-mx-spoiler] { ` + (!Settings.mobileMode ? `span[data-mx-spoiler] {
color: transparent; color: transparent;
background-color: " + palette.text + "; background-color: ` + palette.text + `;
}" : "") + // TODO(Nico): Figure out how to support mobile }` : "") + // TODO(Nico): Figure out how to support mobile
"</style> `</style>
" + formatted.replace(/<del>/g, "<s>").replace(/<\/del>/g, "</s>").replace(/<strike>/g, "<s>").replace(/<\/strike>/g, "</s>") ` + formatted.replace(/<del>/g, "<s>").replace(/<\/del>/g, "</s>").replace(/<strike>/g, "<s>").replace(/<\/strike>/g, "</s>")
enabled: !isReply enabled: !isReply
font.pointSize: (Settings.enlargeEmojiOnlyMessages && isOnlyEmoji > 0 && isOnlyEmoji < 4) ? Settings.fontSize * 3 : Settings.fontSize font.pointSize: (Settings.enlargeEmojiOnlyMessages && isOnlyEmoji > 0 && isOnlyEmoji < 4) ? Settings.fontSize * 3 : Settings.fontSize

@ -2,12 +2,13 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import QtQml 2.15 import QtQml
import QtQuick 2.15 import QtQuick
import QtQuick.Controls 2.15 import QtQuick.Controls
import QtQuick.Layouts 2.15 import QtQuick.Layouts
import QtQuick.Window 2.15 import QtQuick.Window
import im.nheko 1.0 import im.nheko
import "../"
Window { Window {
id: ignoredUsers id: ignoredUsers

@ -551,8 +551,8 @@ ApplicationWindow {
id: confirmEncryptionDialog id: confirmEncryptionDialog
title: qsTr("End-to-End Encryption") title: qsTr("End-to-End Encryption")
text: qsTr("Encryption is currently experimental and things might break unexpectedly. <br> text: qsTr(`Encryption is currently experimental and things might break unexpectedly. <br>
Please take note that it can't be disabled afterwards.") Please take note that it can't be disabled afterwards.`)
modality: Qt.NonModal modality: Qt.NonModal
onAccepted: { onAccepted: {
if (roomSettings.isEncryptionEnabled) if (roomSettings.isEncryptionEnabled)

@ -3,7 +3,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick import QtQuick
import QtQuick.Controls
Item { Item {
id: ripple id: ripple

@ -198,13 +198,11 @@ Rectangle {
when: Settings.mobileMode || volumeButton.hovered || volumeSlider.hovered || volumeSlider.pressed when: Settings.mobileMode || volumeButton.hovered || volumeSlider.hovered || volumeSlider.pressed
PropertyChanges { PropertyChanges {
target: volumeSlider volumeSlider.implicitWidth: 100
Layout.preferredWidth: 100
} }
PropertyChanges { PropertyChanges {
target: volumeSlider volumeSlider.opacity: 1
opacity: 1
} }
} }

@ -3,10 +3,10 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import "../" import "../"
import QtQuick 2.9 import QtQuick
import QtQuick.Controls 2.3 import QtQuick.Controls
import QtQuick.Layouts 1.2 import QtQuick.Layouts
import im.nheko 1.0 import im.nheko
Rectangle { Rectangle {
visible: CallManager.haveCallInvite && !Settings.mobileMode visible: CallManager.haveCallInvite && !Settings.mobileMode

@ -3,10 +3,10 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import "../" import "../"
import QtQuick 2.9 import QtQuick
import QtQuick.Controls 2.3 import QtQuick.Controls
import QtQuick.Layouts 1.2 import QtQuick.Layouts
import im.nheko 1.0 import im.nheko
Popup { Popup {
modal: true modal: true

@ -2,7 +2,6 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.9
import org.freedesktop.gstreamer.GLVideoItem 1.0 import org.freedesktop.gstreamer.GLVideoItem 1.0
GstGLVideoItem { GstGLVideoItem {

Loading…
Cancel
Save