Add devtools button to account menu
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user