summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2019-10-20 12:39:47 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2019-11-23 20:06:15 +0100
commitc37495fae29cd93b1b03e4e3689c604cc5312a18 (patch)
tree44a9fd5b0eb2c2d459ba122bd8cff739e358e4b7 /resources
parentAdd native themeing to QML (where possible) (diff)
downloadnheko-c37495fae29cd93b1b03e4e3689c604cc5312a18.tar.xz
Use a basic implementation of a DelegateChooser for compat with older Qt
The interface is taken from Qt/KDE, but the implementation is different,
because the Qt implementation depends on some Qt internals.
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/RowDelegateChooser.qml52
-rw-r--r--resources/qml/TimelineView.qml46
-rw-r--r--resources/res.qrc1
3 files changed, 54 insertions, 45 deletions
diff --git a/resources/qml/RowDelegateChooser.qml b/resources/qml/RowDelegateChooser.qml
new file mode 100644

index 00000000..b7b6bdf4 --- /dev/null +++ b/resources/qml/RowDelegateChooser.qml
@@ -0,0 +1,52 @@ +import QtQuick 2.6 +import Qt.labs.qmlmodels 1.0 +import com.github.nheko 1.0 + +import "./delegates" + +DelegateChooser { + role: "type" + width: chat.width + roleValue: model.type + + DelegateChoice { + roleValue: MtxEvent.TextMessage + TimelineRow { view: chat; TextMessage { id: kid } } + } + DelegateChoice { + roleValue: MtxEvent.NoticeMessage + TimelineRow { view: chat; NoticeMessage { id: kid } } + } + DelegateChoice { + roleValue: MtxEvent.EmoteMessage + TimelineRow { view: chat; TextMessage { id: kid } } + } + DelegateChoice { + roleValue: MtxEvent.ImageMessage + TimelineRow { view: chat; ImageMessage { id: kid } } + } + DelegateChoice { + roleValue: MtxEvent.Sticker + TimelineRow { view: chat; ImageMessage { id: kid } } + } + DelegateChoice { + roleValue: MtxEvent.FileMessage + TimelineRow { view: chat; FileMessage { id: kid } } + } + DelegateChoice { + roleValue: MtxEvent.VideoMessage + TimelineRow { view: chat; PlayableMediaMessage { id: kid } } + } + DelegateChoice { + roleValue: MtxEvent.AudioMessage + TimelineRow { view: chat; PlayableMediaMessage { id: kid } } + } + DelegateChoice { + roleValue: MtxEvent.Redacted + TimelineRow { view: chat; Redacted { id: kid } } + } + DelegateChoice { + //roleValue: MtxEvent.Redacted + TimelineRow { view: chat; Placeholder { id: kid } } + } +} diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index d1ada3ea..e09b9ed3 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml
@@ -3,7 +3,6 @@ import QtQuick.Controls 2.1 import QtQuick.Layouts 1.2 import QtGraphicalEffects 1.0 import QtQuick.Window 2.2 -import Qt.labs.qmlmodels 1.0 import com.github.nheko 1.0 @@ -91,50 +90,7 @@ Rectangle { onMovementEnded: updatePosition() spacing: 4 - delegate: DelegateChooser { - role: "type" - DelegateChoice { - roleValue: MtxEvent.TextMessage - TimelineRow { view: chat; TextMessage { id: kid } } - } - DelegateChoice { - roleValue: MtxEvent.NoticeMessage - TimelineRow { view: chat; NoticeMessage { id: kid } } - } - DelegateChoice { - roleValue: MtxEvent.EmoteMessage - TimelineRow { view: chat; TextMessage { id: kid } } - } - DelegateChoice { - roleValue: MtxEvent.ImageMessage - TimelineRow { view: chat; ImageMessage { id: kid } } - } - DelegateChoice { - roleValue: MtxEvent.Sticker - TimelineRow { view: chat; ImageMessage { id: kid } } - } - DelegateChoice { - roleValue: MtxEvent.FileMessage - TimelineRow { view: chat; FileMessage { id: kid } } - } - DelegateChoice { - roleValue: MtxEvent.VideoMessage - TimelineRow { view: chat; PlayableMediaMessage { id: kid } } - } - DelegateChoice { - roleValue: MtxEvent.AudioMessage - TimelineRow { view: chat; PlayableMediaMessage { id: kid } } - } - DelegateChoice { - roleValue: MtxEvent.Redacted - TimelineRow { view: chat; Redacted { id: kid } } - } - DelegateChoice { - //roleValue: MtxEvent.Redacted - TimelineRow { view: chat; Placeholder { id: kid } } - } - } - + delegate: RowDelegateChooser {} section { property: "section" diff --git a/resources/res.qrc b/resources/res.qrc
index 11a20e54..4816ffad 100644 --- a/resources/res.qrc +++ b/resources/res.qrc
@@ -116,6 +116,7 @@ </qresource> <qresource prefix="/"> <file>qml/TimelineView.qml</file> + <file>qml/RowDelegateChooser.qml</file> <file>qml/Avatar.qml</file> <file>qml/StatusIndicator.qml</file> <file>qml/EncryptionIndicator.qml</file>