Warning, /network/neochat/src/qml/MessageSourceSheet.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2019 Black Hat <bhat@encom.eu.org> 0002 // SPDX-FileCopyrightText: 2020 Tobias Fella <tobias.fella@kde.org> 0003 // SPDX-License-Identifier: GPL-3.0-only 0004 0005 import QtQuick 0006 import QtQuick.Controls as QQC2 0007 import QtQuick.Layouts 0008 0009 import org.kde.kirigami as Kirigami 0010 import org.kde.syntaxhighlighting 0011 0012 import org.kde.neochat 0013 0014 Kirigami.Page { 0015 id: root 0016 property string sourceText 0017 0018 topPadding: 0 0019 leftPadding: 0 0020 rightPadding: 0 0021 bottomPadding: 0 0022 0023 title: i18n("Event Source") 0024 0025 QQC2.ScrollView { 0026 id: scrollView 0027 anchors.fill: parent 0028 contentWidth: availableWidth 0029 0030 // HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890) 0031 QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff 0032 0033 QQC2.TextArea { 0034 id: sourceTextArea 0035 Layout.fillWidth: true 0036 0037 leftPadding: lineNumberColumn.width + lineNumberColumn.anchors.leftMargin + Kirigami.Units.smallSpacing * 2 0038 0039 text: root.sourceText 0040 readOnly: true 0041 textFormat: TextEdit.PlainText 0042 wrapMode: TextEdit.Wrap 0043 0044 // opt-out of whatever spell checker a styled TextArea might come with 0045 Kirigami.SpellCheck.enabled: false 0046 0047 onWidthChanged: lineModel.resetModel() 0048 onHeightChanged: lineModel.resetModel() 0049 0050 SyntaxHighlighter { 0051 textEdit: sourceTextArea 0052 definition: "JSON" 0053 repository: Repository 0054 } 0055 0056 ColumnLayout { 0057 id: lineNumberColumn 0058 0059 anchors { 0060 top: sourceTextArea.top 0061 topMargin: sourceTextArea.topPadding 0062 left: sourceTextArea.left 0063 leftMargin: Kirigami.Units.smallSpacing 0064 } 0065 spacing: 0 0066 Repeater { 0067 id: repeater 0068 model: LineModel { 0069 id: lineModel 0070 document: sourceTextArea.textDocument 0071 } 0072 delegate: QQC2.Label { 0073 id: label 0074 required property int index 0075 required property int docLineHeight 0076 Layout.fillWidth: true 0077 Layout.preferredHeight: docLineHeight 0078 topPadding: 1 0079 horizontalAlignment: Text.AlignRight 0080 text: index + 1 0081 color: Kirigami.Theme.disabledTextColor 0082 } 0083 } 0084 } 0085 0086 background: Rectangle { 0087 Kirigami.Theme.colorSet: Kirigami.Theme.View 0088 Kirigami.Theme.inherit: false 0089 color: Kirigami.Theme.backgroundColor 0090 } 0091 } 0092 } 0093 0094 Kirigami.Separator { 0095 anchors { 0096 top: parent.top 0097 bottom: parent.bottom 0098 left: parent.left 0099 leftMargin: lineNumberColumn.width + lineNumberColumn.anchors.leftMargin + Kirigami.Units.smallSpacing 0100 } 0101 } 0102 }