mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
Organize qml files a bit
This commit is contained in:
parent
e52ff609ed
commit
2055c75f8b
13 changed files with 35 additions and 37 deletions
|
@ -70,6 +70,7 @@ include(LMDB)
|
|||
# Discover Qt dependencies.
|
||||
#
|
||||
find_package(Qt5 COMPONENTS Core Widgets LinguistTools Concurrent Svg Multimedia Qml QuickControls2 REQUIRED)
|
||||
find_package(Qt5QuickCompiler)
|
||||
find_package(Qt5DBus)
|
||||
|
||||
if (APPLE)
|
||||
|
|
|
@ -21,4 +21,9 @@ if(NOT EXISTS ${_qrc})
|
|||
endif()
|
||||
|
||||
qt5_add_resources(LANG_QRC ${_qrc})
|
||||
qt5_add_resources(QRC resources/res.qrc)
|
||||
#qt5_add_resources(QRC resources/res.qrc)
|
||||
if(Qt5QuickCompiler_FOUND)
|
||||
qtquick_compiler_add_resources(QRC resources/res.qrc)
|
||||
else()
|
||||
qt5_add_resources(QRC resources/res.qrc)
|
||||
endif()
|
||||
|
|
|
@ -30,6 +30,7 @@ Rectangle {
|
|||
id: img
|
||||
anchors.fill: parent
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: OpacityMask {
|
||||
|
|
|
@ -6,29 +6,22 @@ import QtQuick.Window 2.2
|
|||
|
||||
import com.github.nheko 1.0
|
||||
|
||||
import ".."
|
||||
import "./delegates"
|
||||
|
||||
RowLayout {
|
||||
property var view: undefined
|
||||
default property alias data: contentItem.data
|
||||
property var view: chat
|
||||
|
||||
height: kid.height // TODO: fix this, we shouldn't need to give the child of contentItem this id!
|
||||
anchors.leftMargin: avatarSize + 4
|
||||
anchors.rightMargin: scrollbar.width
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: scrollbar.width
|
||||
|
||||
function isFullyVisible() {
|
||||
return (y - view.contentY - 1) + height < view.height
|
||||
}
|
||||
function getIndex() {
|
||||
return index;
|
||||
}
|
||||
height: contentItem.height
|
||||
|
||||
Item {
|
||||
id: contentItem
|
||||
MessageDelegate {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
id: contentItem
|
||||
}
|
||||
|
||||
StatusIndicator {
|
|
@ -90,14 +90,13 @@ Rectangle {
|
|||
onMovementEnded: updatePosition()
|
||||
|
||||
spacing: 4
|
||||
delegate: RowDelegateChooser {
|
||||
delegate: TimelineRow {
|
||||
function isFullyVisible() {
|
||||
return height > 1 && (y - chat.contentY - 1) + height < chat.height
|
||||
}
|
||||
function getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
section {
|
||||
|
|
|
@ -5,7 +5,7 @@ Rectangle {
|
|||
radius: 10
|
||||
color: colors.dark
|
||||
height: row.height + 24
|
||||
width: parent.width
|
||||
width: parent ? parent.width : undefined
|
||||
|
||||
RowLayout {
|
||||
id: row
|
||||
|
|
|
@ -3,7 +3,7 @@ import QtQuick 2.6
|
|||
import com.github.nheko 1.0
|
||||
|
||||
Item {
|
||||
width: Math.min(parent.width, model.width)
|
||||
width: Math.min(parent ? parent.width : undefined, model.width)
|
||||
height: width * model.proportionalHeight
|
||||
|
||||
Image {
|
||||
|
|
|
@ -2,50 +2,49 @@ import QtQuick 2.6
|
|||
import Qt.labs.qmlmodels 1.0
|
||||
import com.github.nheko 1.0
|
||||
|
||||
import "./delegates"
|
||||
|
||||
DelegateChooser {
|
||||
//role: "type" //< not supported in our custom implementation, have to use roleValue
|
||||
width: chat.width
|
||||
roleValue: model.type
|
||||
|
||||
width: parent.width
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: MtxEvent.TextMessage
|
||||
TimelineRow { view: chat; TextMessage { id: kid } }
|
||||
TextMessage {}
|
||||
}
|
||||
DelegateChoice {
|
||||
roleValue: MtxEvent.NoticeMessage
|
||||
TimelineRow { view: chat; NoticeMessage { id: kid } }
|
||||
NoticeMessage {}
|
||||
}
|
||||
DelegateChoice {
|
||||
roleValue: MtxEvent.EmoteMessage
|
||||
TimelineRow { view: chat; TextMessage { id: kid } }
|
||||
TextMessage {}
|
||||
}
|
||||
DelegateChoice {
|
||||
roleValue: MtxEvent.ImageMessage
|
||||
TimelineRow { view: chat; ImageMessage { id: kid } }
|
||||
ImageMessage {}
|
||||
}
|
||||
DelegateChoice {
|
||||
roleValue: MtxEvent.Sticker
|
||||
TimelineRow { view: chat; ImageMessage { id: kid } }
|
||||
ImageMessage {}
|
||||
}
|
||||
DelegateChoice {
|
||||
roleValue: MtxEvent.FileMessage
|
||||
TimelineRow { view: chat; FileMessage { id: kid } }
|
||||
FileMessage {}
|
||||
}
|
||||
DelegateChoice {
|
||||
roleValue: MtxEvent.VideoMessage
|
||||
TimelineRow { view: chat; PlayableMediaMessage { id: kid } }
|
||||
PlayableMediaMessage {}
|
||||
}
|
||||
DelegateChoice {
|
||||
roleValue: MtxEvent.AudioMessage
|
||||
TimelineRow { view: chat; PlayableMediaMessage { id: kid } }
|
||||
PlayableMediaMessage {}
|
||||
}
|
||||
DelegateChoice {
|
||||
roleValue: MtxEvent.Redacted
|
||||
TimelineRow { view: chat; Redacted { id: kid } }
|
||||
Redacted {}
|
||||
}
|
||||
DelegateChoice {
|
||||
TimelineRow { view: chat; Placeholder { id: kid } }
|
||||
Placeholder {}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ TextEdit {
|
|||
textFormat: TextEdit.RichText
|
||||
readOnly: true
|
||||
wrapMode: Text.Wrap
|
||||
width: parent.width
|
||||
width: parent ? parent.width : undefined
|
||||
selectByMouse: true
|
||||
font.italic: true
|
||||
color: inactiveColors.text
|
||||
|
|
|
@ -5,6 +5,6 @@ Label {
|
|||
text: qsTr("unimplemented event: ") + model.type
|
||||
textFormat: Text.PlainText
|
||||
wrapMode: Text.Wrap
|
||||
width: parent.width
|
||||
width: parent ? parent.width : undefined
|
||||
color: inactiveColors.text
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ Rectangle {
|
|||
radius: 10
|
||||
color: colors.dark
|
||||
height: content.height + 24
|
||||
width: parent.width
|
||||
width: parent ? parent.width : undefined
|
||||
|
||||
Column {
|
||||
id: content
|
||||
|
|
|
@ -5,7 +5,7 @@ TextEdit {
|
|||
textFormat: TextEdit.RichText
|
||||
readOnly: true
|
||||
wrapMode: Text.Wrap
|
||||
width: parent.width
|
||||
width: parent ? parent.width : undefined
|
||||
selectByMouse: true
|
||||
color: colors.text
|
||||
}
|
||||
|
|
|
@ -116,11 +116,11 @@
|
|||
</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>
|
||||
<file>qml/delegates/TimelineRow.qml</file>
|
||||
<file>qml/TimelineRow.qml</file>
|
||||
<file>qml/delegates/MessageDelegate.qml</file>
|
||||
<file>qml/delegates/TextMessage.qml</file>
|
||||
<file>qml/delegates/NoticeMessage.qml</file>
|
||||
<file>qml/delegates/ImageMessage.qml</file>
|
||||
|
|
Loading…
Reference in a new issue