Add power level to the user details dialog
The only way to check a user's power level is to haul yourself over to the member list, which is cumbersome but also hard to parse - especially if a room has lots of members. This adds the user's power level to the existing details dialog. For example, this makes it easier to identify someone as a moderator if they sent a message in the room.
This commit is contained in:
@@ -116,6 +116,16 @@ Kirigami.Dialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Kirigami.Chip {
|
||||||
|
visible: root.room
|
||||||
|
text: root.room ? QmlUtils.nameForLevel(root.room.memberEffectivePowerLevel(root.user.id)) : ""
|
||||||
|
closable: false
|
||||||
|
checkable: false
|
||||||
|
|
||||||
|
Layout.leftMargin: Kirigami.Units.largeSpacing
|
||||||
|
Layout.bottomMargin: Kirigami.Units.largeSpacing
|
||||||
|
}
|
||||||
|
|
||||||
Kirigami.Separator {
|
Kirigami.Separator {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,11 @@ QQuickItem *QmlUtils::focusedWindowItem()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QmlUtils::nameForLevel(const PowerLevel::Level level)
|
||||||
|
{
|
||||||
|
return PowerLevel::nameForLevel(level);
|
||||||
|
}
|
||||||
|
|
||||||
bool Utils::isEmoji(const QString &text)
|
bool Utils::isEmoji(const QString &text)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ICU
|
#ifdef HAVE_ICU
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
#include <Quotient/user.h>
|
#include <Quotient/user.h>
|
||||||
|
|
||||||
|
#include "enums/powerlevel.h"
|
||||||
|
|
||||||
using namespace Qt::StringLiterals;
|
using namespace Qt::StringLiterals;
|
||||||
|
|
||||||
class QmlUtils : public QObject
|
class QmlUtils : public QObject
|
||||||
@@ -38,6 +40,10 @@ public:
|
|||||||
Q_INVOKABLE QString escapeString(const QString &string);
|
Q_INVOKABLE QString escapeString(const QString &string);
|
||||||
Q_INVOKABLE QColor getUserColor(qreal hueF);
|
Q_INVOKABLE QColor getUserColor(qreal hueF);
|
||||||
Q_INVOKABLE QQuickItem *focusedWindowItem();
|
Q_INVOKABLE QQuickItem *focusedWindowItem();
|
||||||
|
/**
|
||||||
|
* @brief Invokable version of PowerLevel::nameForLevel.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QString nameForLevel(PowerLevel::Level level);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QmlUtils() = default;
|
QmlUtils() = default;
|
||||||
|
|||||||
Reference in New Issue
Block a user