Devtools Improvements
- Now has tabs setup as more features are added - First extra tab has basic server info - Use mobileform to make it look nicer - For the room data tab allow the room to be changed from within devtools - For the room data tab allow m.room.member events to be filtered out so other event types can be found easily - For the room data tab allow viewing room account data network/neochat#557
This commit is contained in:
committed by
Tobias Fella
parent
ca805917de
commit
85b40ca536
@@ -10,7 +10,7 @@ StateModel::StateModel(QObject *parent)
|
||||
|
||||
QHash<int, QByteArray> StateModel::roleNames() const
|
||||
{
|
||||
return {{TypeRole, "type"}, {StateKeyRole, "stateKey"}, {SourceRole, "source"}};
|
||||
return {{TypeRole, "type"}, {StateKeyRole, "stateKey"}};
|
||||
}
|
||||
QVariant StateModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
@@ -18,11 +18,9 @@ QVariant StateModel::data(const QModelIndex &index, int role) const
|
||||
auto row = index.row();
|
||||
switch (role) {
|
||||
case TypeRole:
|
||||
return m_room->currentState().events().keys()[row].first;
|
||||
return m_stateEvents[row].first;
|
||||
case StateKeyRole:
|
||||
return m_room->currentState().events().keys()[row].second;
|
||||
case SourceRole:
|
||||
return QJsonDocument(m_room->currentState().events()[m_room->currentState().events().keys()[row]]->fullJson()).toJson();
|
||||
return m_stateEvents[row].second;
|
||||
}
|
||||
#endif
|
||||
return {};
|
||||
@@ -48,9 +46,27 @@ void StateModel::setRoom(NeoChatRoom *room)
|
||||
m_room = room;
|
||||
Q_EMIT roomChanged();
|
||||
beginResetModel();
|
||||
m_stateEvents.clear();
|
||||
#ifdef QUOTIENT_07
|
||||
m_stateEvents = m_room->currentState().events().keys();
|
||||
#endif
|
||||
endResetModel();
|
||||
connect(room, &NeoChatRoom::changed, this, [this] {
|
||||
beginResetModel();
|
||||
m_stateEvents.clear();
|
||||
#ifdef QUOTIENT_07
|
||||
m_stateEvents = m_room->currentState().events().keys();
|
||||
#endif
|
||||
endResetModel();
|
||||
});
|
||||
}
|
||||
|
||||
QByteArray StateModel::stateEventJson(const QModelIndex &index)
|
||||
{
|
||||
auto row = index.row();
|
||||
#ifdef QUOTIENT_07
|
||||
return QJsonDocument(m_room->currentState().events()[m_stateEvents[row]]->fullJson()).toJson();
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user