Add devtools button to account menu
This commit is contained in:
@@ -39,6 +39,9 @@ void StateModel::loadState()
|
|||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_stateEvents.clear();
|
m_stateEvents.clear();
|
||||||
|
if (!m_room) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const auto keys = m_room->currentState().events().keys();
|
const auto keys = m_room->currentState().events().keys();
|
||||||
for (const auto &[type, stateKey] : keys) {
|
for (const auto &[type, stateKey] : keys) {
|
||||||
if (!m_stateEvents.contains(type)) {
|
if (!m_stateEvents.contains(type)) {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ Q_SIGNALS:
|
|||||||
void roomChanged();
|
void roomChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NeoChatRoom *m_room = nullptr;
|
QPointer<NeoChatRoom> m_room;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A map from state event type to number of events of that type
|
* @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
|
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 {
|
QQC2.MenuItem {
|
||||||
text: i18n("Logout")
|
text: i18n("Logout")
|
||||||
icon.name: "list-remove-user"
|
icon.name: "list-remove-user"
|
||||||
|
|||||||
@@ -39,9 +39,12 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
FormCard.FormHeader {
|
FormCard.FormHeader {
|
||||||
title: i18n("Room Account Data")
|
title: i18n("Room Account Data")
|
||||||
|
visible: roomAccountData.count > 0
|
||||||
}
|
}
|
||||||
FormCard.FormCard {
|
FormCard.FormCard {
|
||||||
|
visible: roomAccountData.count > 0
|
||||||
Repeater {
|
Repeater {
|
||||||
|
id: roomAccountData
|
||||||
model: root.room.accountDataEventTypes
|
model: root.room.accountDataEventTypes
|
||||||
delegate: FormCard.FormButtonDelegate {
|
delegate: FormCard.FormButtonDelegate {
|
||||||
text: modelData
|
text: modelData
|
||||||
@@ -57,9 +60,12 @@ ColumnLayout {
|
|||||||
FormCard.FormHeader {
|
FormCard.FormHeader {
|
||||||
id: stateEventListHeader
|
id: stateEventListHeader
|
||||||
title: i18n("Room State")
|
title: i18n("Room State")
|
||||||
|
visible: roomState.count > 0
|
||||||
}
|
}
|
||||||
FormCard.FormCard {
|
FormCard.FormCard {
|
||||||
|
visible: roomState.count > 0
|
||||||
Repeater {
|
Repeater {
|
||||||
|
id: roomState
|
||||||
model: StateModel {
|
model: StateModel {
|
||||||
id: stateModel
|
id: stateModel
|
||||||
room: root.room
|
room: root.room
|
||||||
|
|||||||
Reference in New Issue
Block a user