Add devtools button to account menu

This commit is contained in:
Tobias Fella
2024-03-02 19:06:08 +01:00
parent 10e3ab1f78
commit 1249304907
4 changed files with 22 additions and 1 deletions

View File

@@ -39,6 +39,9 @@ void StateModel::loadState()
{
beginResetModel();
m_stateEvents.clear();
if (!m_room) {
return;
}
const auto keys = m_room->currentState().events().keys();
for (const auto &[type, stateKey] : keys) {
if (!m_stateEvents.contains(type)) {

View File

@@ -68,7 +68,7 @@ Q_SIGNALS:
void roomChanged();
private:
NeoChatRoom *m_room = nullptr;
QPointer<NeoChatRoom> m_room;
/**
* @brief A map from state event type to number of events of that type

View File

@@ -50,6 +50,18 @@ QQC2.Menu {
height: Kirigami.Units.gridUnit * 42
})
}
QQC2.MenuItem {
text: i18n("Open developer tools")
icon.name: "tools"
visible: Config.developerTools
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'DevtoolsPage.qml'), {
connection: root.connection
}, {
title: i18nc("@title:window", "Developer Tools"),
width: Kirigami.Units.gridUnit * 50,
height: Kirigami.Units.gridUnit * 42
})
}
QQC2.MenuItem {
text: i18n("Logout")
icon.name: "list-remove-user"

View File

@@ -39,9 +39,12 @@ ColumnLayout {
}
FormCard.FormHeader {
title: i18n("Room Account Data")
visible: roomAccountData.count > 0
}
FormCard.FormCard {
visible: roomAccountData.count > 0
Repeater {
id: roomAccountData
model: root.room.accountDataEventTypes
delegate: FormCard.FormButtonDelegate {
text: modelData
@@ -57,9 +60,12 @@ ColumnLayout {
FormCard.FormHeader {
id: stateEventListHeader
title: i18n("Room State")
visible: roomState.count > 0
}
FormCard.FormCard {
visible: roomState.count > 0
Repeater {
id: roomState
model: StateModel {
id: stateModel
room: root.room