Implement basic developer tools
This commit is contained in:
@@ -17,7 +17,7 @@ Kirigami.Page {
|
||||
rightPadding: 0
|
||||
bottomPadding: 0
|
||||
|
||||
title: i18n("Message Source")
|
||||
title: i18n("Event Source")
|
||||
|
||||
QQC2.ScrollView {
|
||||
anchors.fill: parent
|
||||
|
||||
34
src/qml/Page/DevtoolsPage.qml
Normal file
34
src/qml/Page/DevtoolsPage.qml
Normal file
@@ -0,0 +1,34 @@
|
||||
// SPDX-FileCopyrightText: 2022 Tobias Fella <fella@posteo.de>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15 as QQC2
|
||||
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
import org.kde.neochat 1.0
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
id: devtoolsPage
|
||||
|
||||
property var room
|
||||
|
||||
title: i18n("Room State - %1", room.displayName)
|
||||
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
model: StateModel {
|
||||
room: devtoolsPage.room
|
||||
}
|
||||
|
||||
delegate: Kirigami.BasicListItem {
|
||||
text: model.type
|
||||
subtitle: model.stateKey
|
||||
onClicked: applicationWindow().pageStack.pushDialogLayer('qrc:/MessageSourceSheet.qml', {
|
||||
sourceText: model.source
|
||||
}, {
|
||||
title: i18n("Event Source"),
|
||||
width: Kirigami.Units.gridUnit * 25
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,24 @@ Kirigami.OverlayDrawer {
|
||||
text: i18n("Room information")
|
||||
level: 1
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
id: devtoolsButton
|
||||
|
||||
Layout.alignment: Qt.AlignRight
|
||||
icon.name: "tools"
|
||||
text: i18n("Open developer tools")
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
visible: Config.developerTools && Controller.quotientMinorVersion > 6
|
||||
|
||||
onClicked: {
|
||||
applicationWindow().pageStack.layers.push("qrc:/DevtoolsPage.qml", {room: room}, {title: i18n("Developer Tools")})
|
||||
roomDrawer.close();
|
||||
}
|
||||
|
||||
QQC2.ToolTip {
|
||||
text: devtoolsButton.text
|
||||
}
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
id: inviteButton
|
||||
|
||||
|
||||
@@ -174,5 +174,25 @@ Kirigami.ScrollablePage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MobileForm.FormCard {
|
||||
Layout.topMargin: Kirigami.Units.largeSpacing
|
||||
Layout.fillWidth: true
|
||||
contentItem: ColumnLayout {
|
||||
spacing: 0
|
||||
MobileForm.FormCardHeader {
|
||||
title: i18n("Developer Settings")
|
||||
}
|
||||
MobileForm.FormCheckDelegate {
|
||||
text: i18n("Enable Developer Tools")
|
||||
checked: Config.developerTools
|
||||
enabled: !Config.isDeveloperToolsImmutable
|
||||
onToggled: {
|
||||
Config.developerTools = checked
|
||||
Config.save()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user