Warning, /network/neochat/src/qml/RoomMedia.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com> 0002 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0003 0004 import QtQuick 0005 import QtQuick.Controls as QQC2 0006 import QtQuick.Layouts 0007 import Qt.labs.qmlmodels 0008 0009 import org.kde.neochat 0010 0011 /** 0012 * @brief Component for visualising the loaded media items in the room. 0013 * 0014 * The component is a simple list of media delegates (videos or images) with the 0015 * ability to open them in the mamimize component. 0016 * 0017 * @note This component is only the contents, it will need to be placed in either 0018 * a drawer (desktop) or page (mobile) to be used. 0019 * 0020 * @sa RoomDrawer, RoomDrawerPage 0021 */ 0022 QQC2.ScrollView { 0023 id: root 0024 0025 /** 0026 * @brief The title that should be displayed for this component if available. 0027 */ 0028 readonly property string title: i18nc("@action:title", "Room Media") 0029 0030 /** 0031 * @brief The current room that user is viewing. 0032 */ 0033 required property NeoChatRoom currentRoom 0034 0035 required property NeoChatConnection connection 0036 0037 // HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890) 0038 QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff 0039 0040 ListView { 0041 // So that delegates can access current room properly. 0042 readonly property NeoChatRoom currentRoom: root.currentRoom 0043 0044 clip: true 0045 verticalLayoutDirection: ListView.BottomToTop 0046 0047 model: RoomManager.mediaMessageFilterModel 0048 0049 delegate: DelegateChooser { 0050 role: "type" 0051 0052 DelegateChoice { 0053 roleValue: 0//MediaMessageFilterModel.Image 0054 delegate: ImageDelegate { 0055 alwaysShowAuthor: true 0056 alwaysMaxWidth: true 0057 cardBackground: false 0058 connection: root.connection 0059 } 0060 } 0061 0062 DelegateChoice { 0063 roleValue: 1//MediaMessageFilterModel.Video 0064 delegate: VideoDelegate { 0065 alwaysShowAuthor: true 0066 alwaysMaxWidth: true 0067 cardBackground: false 0068 connection: root.connection 0069 } 0070 } 0071 } 0072 } 0073 }