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         clip: true
0042         verticalLayoutDirection: ListView.BottomToTop
0043 
0044         model: RoomManager.mediaMessageFilterModel
0045 
0046         delegate: DelegateChooser {
0047             role: "type"
0048 
0049             DelegateChoice {
0050                 roleValue: 0//MediaMessageFilterModel.Image
0051                 delegate: ImageDelegate {
0052                     alwaysShowAuthor: true
0053                     alwaysMaxWidth: true
0054                     cardBackground: false
0055                     room: root.currentRoom
0056                 }
0057             }
0058 
0059             DelegateChoice {
0060                 roleValue: 1//MediaMessageFilterModel.Video
0061                 delegate: VideoDelegate {
0062                     alwaysShowAuthor: true
0063                     alwaysMaxWidth: true
0064                     cardBackground: false
0065                     room: root.currentRoom
0066                 }
0067             }
0068         }
0069     }
0070 }