mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 09:30:47 +03:00
Merge pull request #650 from LorenDB/qml-all-the-things
Open room members when member info label clicked
This commit is contained in:
commit
1d3579196a
10 changed files with 56 additions and 44 deletions
|
@ -41,7 +41,7 @@ ApplicationWindow {
|
|||
displayName: members.roomName
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
url: members.avatarUrl.replace("mxc://", "image://MxcImage/")
|
||||
onClicked: Rooms.currentRoom.openRoomSettings(members.roomId)
|
||||
onClicked: TimelineManager.openRoomSettings(members.roomId)
|
||||
}
|
||||
|
||||
ElidedLabel {
|
||||
|
@ -57,7 +57,7 @@ ApplicationWindow {
|
|||
hoverEnabled: true
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: qsTr("Invite more people")
|
||||
onClicked: Rooms.currentRoom.openInviteUsers()
|
||||
onClicked: TimelineManager.openInviteUsers(members.roomId)
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
|
@ -121,7 +121,6 @@ ApplicationWindow {
|
|||
footer: Item {
|
||||
width: parent.width
|
||||
visible: (members.numUsersLoaded < members.memberCount) && members.loadingMoreMembers
|
||||
|
||||
// use the default height if it's visible, otherwise no height at all
|
||||
height: membersLoadingSpinner.height
|
||||
anchors.margins: Nheko.paddingMedium
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import "./ui"
|
||||
import Qt.labs.platform 1.1 as Platform
|
||||
import QtQuick 2.9
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtQuick.Window 2.3
|
||||
|
@ -105,6 +105,16 @@ ApplicationWindow {
|
|||
MatrixText {
|
||||
text: qsTr("%1 member(s)").arg(roomSettings.memberCount)
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
TapHandler {
|
||||
onTapped: TimelineManager.openRoomMembers(roomSettings.roomId)
|
||||
}
|
||||
|
||||
CursorShape {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ Page {
|
|||
}
|
||||
|
||||
Connections {
|
||||
target: Rooms.currentRoom
|
||||
target: TimelineManager
|
||||
onOpenRoomMembersDialog: {
|
||||
var membersDialog = roomMembersComponent.createObject(timelineRoot, {
|
||||
"members": members,
|
||||
|
|
|
@ -24,7 +24,7 @@ Rectangle {
|
|||
TapHandler {
|
||||
onSingleTapped: {
|
||||
if (room)
|
||||
room.openRoomSettings();
|
||||
TimelineManager.openRoomSettings(room.roomId);
|
||||
|
||||
eventPoint.accepted = true;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ Rectangle {
|
|||
displayName: roomName
|
||||
onClicked: {
|
||||
if (room)
|
||||
room.openRoomSettings();
|
||||
TimelineManager.openRoomSettings(room.roomId);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -111,12 +111,12 @@ Rectangle {
|
|||
Platform.MenuItem {
|
||||
visible: room ? room.permissions.canInvite() : false
|
||||
text: qsTr("Invite users")
|
||||
onTriggered: Rooms.currentRoom.openInviteUsers()
|
||||
onTriggered: TimelineManager.openInviteUsers(room.roomId)
|
||||
}
|
||||
|
||||
Platform.MenuItem {
|
||||
text: qsTr("Members")
|
||||
onTriggered: Rooms.currentRoom.openRoomMembers()
|
||||
onTriggered: TimelineManager.openRoomMembers(room.roomId)
|
||||
}
|
||||
|
||||
Platform.MenuItem {
|
||||
|
@ -126,7 +126,7 @@ Rectangle {
|
|||
|
||||
Platform.MenuItem {
|
||||
text: qsTr("Settings")
|
||||
onTriggered: room.openRoomSettings()
|
||||
onTriggered: TimelineManager.openRoomSettings(room.roomId)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "timeline/TimelineViewManager.h"
|
||||
#include "ui/Avatar.h"
|
||||
|
||||
MemberList::MemberList(const QString &room_id, QWidget *parent)
|
||||
MemberList::MemberList(const QString &room_id, QObject *parent)
|
||||
: QAbstractListModel{parent}
|
||||
, room_id_{room_id}
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
DisplayName,
|
||||
AvatarUrl,
|
||||
};
|
||||
MemberList(const QString &room_id, QWidget *parent = nullptr);
|
||||
MemberList(const QString &room_id, QObject *parent = nullptr);
|
||||
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override
|
||||
|
|
|
@ -1066,31 +1066,6 @@ TimelineModel::openUserProfile(QString userid)
|
|||
emit manager_->openProfile(userProfile);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineModel::openRoomMembers()
|
||||
{
|
||||
MemberList *memberList = new MemberList(roomId());
|
||||
emit openRoomMembersDialog(memberList);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineModel::openRoomSettings(QString room_id)
|
||||
{
|
||||
RoomSettings *settings = new RoomSettings(room_id == QString() ? roomId() : room_id, this);
|
||||
connect(this, &TimelineModel::roomAvatarUrlChanged, settings, &RoomSettings::avatarChanged);
|
||||
emit openRoomSettingsDialog(settings);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineModel::openInviteUsers(QString roomId)
|
||||
{
|
||||
InviteesModel *model = new InviteesModel{this};
|
||||
connect(model, &InviteesModel::accept, this, [this, model, roomId]() {
|
||||
emit manager_->inviteUsers(roomId == QString() ? room_id_ : roomId, model->mxids());
|
||||
});
|
||||
emit openInviteUsersDialog(model);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineModel::replyAction(QString id)
|
||||
{
|
||||
|
|
|
@ -239,9 +239,6 @@ public:
|
|||
Q_INVOKABLE void forwardMessage(QString eventId, QString roomId);
|
||||
Q_INVOKABLE void viewDecryptedRawMessage(QString id) const;
|
||||
Q_INVOKABLE void openUserProfile(QString userid);
|
||||
Q_INVOKABLE void openRoomMembers();
|
||||
Q_INVOKABLE void openRoomSettings(QString room_id = QString());
|
||||
Q_INVOKABLE void openInviteUsers(QString roomId = QString());
|
||||
Q_INVOKABLE void editAction(QString id);
|
||||
Q_INVOKABLE void replyAction(QString id);
|
||||
Q_INVOKABLE void readReceiptsAction(QString id) const;
|
||||
|
@ -358,10 +355,6 @@ signals:
|
|||
void lastMessageChanged();
|
||||
void notificationsChanged();
|
||||
|
||||
void openRoomMembersDialog(MemberList *members);
|
||||
void openRoomSettingsDialog(RoomSettings *settings);
|
||||
void openInviteUsersDialog(InviteesModel *invitees);
|
||||
|
||||
void newMessageToSend(mtx::events::collections::TimelineEvents event);
|
||||
void addPendingMessageToStore(mtx::events::collections::TimelineEvents event);
|
||||
void updateFlowEventId(std::string event_id);
|
||||
|
|
|
@ -351,6 +351,34 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
|
|||
&TimelineViewManager::openImageOverlayInternal);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::openRoomMembers(QString room_id)
|
||||
{
|
||||
MemberList *memberList = new MemberList(room_id, this);
|
||||
emit openRoomMembersDialog(memberList);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::openRoomSettings(QString room_id)
|
||||
{
|
||||
RoomSettings *settings = new RoomSettings(room_id, this);
|
||||
connect(rooms_->getRoomById(room_id).data(),
|
||||
&TimelineModel::roomAvatarUrlChanged,
|
||||
settings,
|
||||
&RoomSettings::avatarChanged);
|
||||
emit openRoomSettingsDialog(settings);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::openInviteUsers(QString roomId)
|
||||
{
|
||||
InviteesModel *model = new InviteesModel{this};
|
||||
connect(model, &InviteesModel::accept, this, [this, model, roomId]() {
|
||||
emit inviteUsers(roomId, model->mxids());
|
||||
});
|
||||
emit openInviteUsersDialog(model);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::setVideoCallItem()
|
||||
{
|
||||
|
|
|
@ -64,6 +64,10 @@ public:
|
|||
Q_INVOKABLE QString userPresence(QString id) const;
|
||||
Q_INVOKABLE QString userStatus(QString id) const;
|
||||
|
||||
Q_INVOKABLE void openRoomMembers(QString room_id);
|
||||
Q_INVOKABLE void openRoomSettings(QString room_id);
|
||||
Q_INVOKABLE void openInviteUsers(QString roomId);
|
||||
|
||||
Q_INVOKABLE void focusMessageInput();
|
||||
Q_INVOKABLE void openLeaveRoomDialog(QString roomid) const;
|
||||
Q_INVOKABLE void removeVerificationFlow(DeviceVerificationFlow *flow);
|
||||
|
@ -85,6 +89,9 @@ signals:
|
|||
void focusChanged();
|
||||
void focusInput();
|
||||
void openImageOverlayInternalCb(QString eventId, QImage img);
|
||||
void openRoomMembersDialog(MemberList *members);
|
||||
void openRoomSettingsDialog(RoomSettings *settings);
|
||||
void openInviteUsersDialog(InviteesModel *invitees);
|
||||
void openProfile(UserProfile *profile);
|
||||
|
||||
public slots:
|
||||
|
|
Loading…
Reference in a new issue