Warning, /utilities/mycroft-plasmoid/plasmoid/contents/ui/ConversationDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*  Copyright 2019 Aditya Mehra <aix.m@outlook.com>
0002     Copyright 2018 Marco Martin <mart@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Lesser General Public
0006     License as published by the Free Software Foundation; either
0007     version 2.1 of the License, or (at your option) version 3, or any
0008     later version accepted by the membership of KDE e.V. (or its
0009     successor approved by the membership of KDE e.V.), which shall
0010     act as a proxy defined in Section 6 of version 3 of the license.
0011     
0012     This library is distributed in the hope that it will be useful,
0013     but WITHOUT ANY WARRANTY; without even the implied warranty of
0014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015     Lesser General Public License for more details.
0016     
0017     You should have received a copy of the GNU Lesser General Public
0018     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0019 */
0020 
0021 import QtQuick 2.9
0022 import QtGraphicalEffects 1.0
0023 import QtQuick.Controls 2.2 as Controls
0024 import QtQuick.Layouts 1.3
0025 
0026 import org.kde.plasma.plasmoid 2.0
0027 import org.kde.plasma.core 2.0 as PlasmaCore
0028 import org.kde.kirigami 2.5 as Kirigami
0029 
0030 Item {
0031     id: root
0032 
0033     width: parent.width - Kirigami.Units.largeSpacing
0034     height: delegate.height
0035 
0036     Controls.Control {
0037         id: delegate
0038 
0039         anchors {
0040             top: parent.top
0041             left: model.inbound ? parent.left : undefined
0042             right: model.inbound ? undefined : parent.right
0043             margins: Kirigami.Units.smallSpacing
0044         }
0045 
0046         padding: Kirigami.Units.gridUnit/2
0047 
0048         width: Math.min(implicitWidth, parent.width - Kirigami.Units.smallSpacing*2)
0049 
0050         contentItem: Controls.Label {
0051             text: model.text
0052             wrapMode: Text.WordWrap
0053         }
0054         background: Rectangle {
0055             radius: Kirigami.Units.gridUnit/2
0056             color: Kirigami.Theme.backgroundColor
0057 
0058             Rectangle {
0059                 anchors {
0060                     left: model.inbound ? parent.left : undefined
0061                     top: model.inbound ? parent.top : undefined
0062                     right: model.inbound ? undefined : parent.right
0063                     bottom: model.inbound ? undefined : parent.bottom
0064                 }
0065                 width: Kirigami.Units.gridUnit
0066                 height: width
0067                 color: Kirigami.Theme.backgroundColor
0068             }
0069 
0070             layer.enabled: true
0071             layer.effect: DropShadow {
0072                 horizontalOffset: 0
0073                 verticalOffset: Kirigami.Units.gridUnit/8
0074                 radius: Kirigami.Units.gridUnit/2
0075                 samples: 32
0076                 color: Qt.rgba(0, 0, 0, 0.5)
0077             }
0078         }
0079     }
0080 }