mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Move various room auxiliary functions to TimelineManager
This commit is contained in:
parent
b17002929c
commit
44be4c1f4a
8 changed files with 44 additions and 42 deletions
|
@ -41,7 +41,7 @@ ApplicationWindow {
|
||||||
displayName: members.roomName
|
displayName: members.roomName
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
url: members.avatarUrl.replace("mxc://", "image://MxcImage/")
|
url: members.avatarUrl.replace("mxc://", "image://MxcImage/")
|
||||||
onClicked: Rooms.currentRoom.openRoomSettings(members.roomId)
|
onClicked: TimelineManager.openRoomSettings(members.roomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
ElidedLabel {
|
ElidedLabel {
|
||||||
|
@ -57,7 +57,7 @@ ApplicationWindow {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
ToolTip.text: qsTr("Invite more people")
|
ToolTip.text: qsTr("Invite more people")
|
||||||
onClicked: Rooms.currentRoom.openInviteUsers()
|
onClicked: TimelineManager.openInviteUsers(members.roomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
|
@ -121,7 +121,6 @@ ApplicationWindow {
|
||||||
footer: Item {
|
footer: Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
visible: (members.numUsersLoaded < members.memberCount) && members.loadingMoreMembers
|
visible: (members.numUsersLoaded < members.memberCount) && members.loadingMoreMembers
|
||||||
|
|
||||||
// use the default height if it's visible, otherwise no height at all
|
// use the default height if it's visible, otherwise no height at all
|
||||||
height: membersLoadingSpinner.height
|
height: membersLoadingSpinner.height
|
||||||
anchors.margins: Nheko.paddingMedium
|
anchors.margins: Nheko.paddingMedium
|
||||||
|
|
|
@ -107,7 +107,7 @@ ApplicationWindow {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
onTapped: Rooms.currentRoom.openRoomMembers(roomSettings.roomId)
|
onTapped: TimelineManager.openRoomMembers(roomSettings.roomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
CursorShape {
|
CursorShape {
|
||||||
|
|
|
@ -133,7 +133,7 @@ Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Rooms.currentRoom
|
target: TimelineManager
|
||||||
onOpenRoomMembersDialog: {
|
onOpenRoomMembersDialog: {
|
||||||
var membersDialog = roomMembersComponent.createObject(timelineRoot, {
|
var membersDialog = roomMembersComponent.createObject(timelineRoot, {
|
||||||
"members": members,
|
"members": members,
|
||||||
|
|
|
@ -24,7 +24,7 @@ Rectangle {
|
||||||
TapHandler {
|
TapHandler {
|
||||||
onSingleTapped: {
|
onSingleTapped: {
|
||||||
if (room)
|
if (room)
|
||||||
room.openRoomSettings();
|
TimelineManager.openRoomSettings(room.roomId);
|
||||||
|
|
||||||
eventPoint.accepted = true;
|
eventPoint.accepted = true;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ Rectangle {
|
||||||
displayName: roomName
|
displayName: roomName
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (room)
|
if (room)
|
||||||
room.openRoomSettings();
|
TimelineManager.openRoomSettings(room.roomId);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,12 +111,12 @@ Rectangle {
|
||||||
Platform.MenuItem {
|
Platform.MenuItem {
|
||||||
visible: room ? room.permissions.canInvite() : false
|
visible: room ? room.permissions.canInvite() : false
|
||||||
text: qsTr("Invite users")
|
text: qsTr("Invite users")
|
||||||
onTriggered: Rooms.currentRoom.openInviteUsers()
|
onTriggered: TimelineManager.openInviteUsers(room.roomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform.MenuItem {
|
Platform.MenuItem {
|
||||||
text: qsTr("Members")
|
text: qsTr("Members")
|
||||||
onTriggered: Rooms.currentRoom.openRoomMembers()
|
onTriggered: TimelineManager.openRoomMembers(room.roomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform.MenuItem {
|
Platform.MenuItem {
|
||||||
|
@ -126,7 +126,7 @@ Rectangle {
|
||||||
|
|
||||||
Platform.MenuItem {
|
Platform.MenuItem {
|
||||||
text: qsTr("Settings")
|
text: qsTr("Settings")
|
||||||
onTriggered: room.openRoomSettings()
|
onTriggered: TimelineManager.openRoomSettings(room.roomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1066,31 +1066,6 @@ TimelineModel::openUserProfile(QString userid)
|
||||||
emit manager_->openProfile(userProfile);
|
emit manager_->openProfile(userProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
TimelineModel::openRoomMembers(QString room_id)
|
|
||||||
{
|
|
||||||
MemberList *memberList = new MemberList(room_id == QString() ? roomId() : room_id, this);
|
|
||||||
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
|
void
|
||||||
TimelineModel::replyAction(QString id)
|
TimelineModel::replyAction(QString id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -239,9 +239,6 @@ public:
|
||||||
Q_INVOKABLE void forwardMessage(QString eventId, QString roomId);
|
Q_INVOKABLE void forwardMessage(QString eventId, QString roomId);
|
||||||
Q_INVOKABLE void viewDecryptedRawMessage(QString id) const;
|
Q_INVOKABLE void viewDecryptedRawMessage(QString id) const;
|
||||||
Q_INVOKABLE void openUserProfile(QString userid);
|
Q_INVOKABLE void openUserProfile(QString userid);
|
||||||
Q_INVOKABLE void openRoomMembers(QString room_id = QString());
|
|
||||||
Q_INVOKABLE void openRoomSettings(QString room_id = QString());
|
|
||||||
Q_INVOKABLE void openInviteUsers(QString roomId = QString());
|
|
||||||
Q_INVOKABLE void editAction(QString id);
|
Q_INVOKABLE void editAction(QString id);
|
||||||
Q_INVOKABLE void replyAction(QString id);
|
Q_INVOKABLE void replyAction(QString id);
|
||||||
Q_INVOKABLE void readReceiptsAction(QString id) const;
|
Q_INVOKABLE void readReceiptsAction(QString id) const;
|
||||||
|
@ -358,10 +355,6 @@ signals:
|
||||||
void lastMessageChanged();
|
void lastMessageChanged();
|
||||||
void notificationsChanged();
|
void notificationsChanged();
|
||||||
|
|
||||||
void openRoomMembersDialog(MemberList *members);
|
|
||||||
void openRoomSettingsDialog(RoomSettings *settings);
|
|
||||||
void openInviteUsersDialog(InviteesModel *invitees);
|
|
||||||
|
|
||||||
void newMessageToSend(mtx::events::collections::TimelineEvents event);
|
void newMessageToSend(mtx::events::collections::TimelineEvents event);
|
||||||
void addPendingMessageToStore(mtx::events::collections::TimelineEvents event);
|
void addPendingMessageToStore(mtx::events::collections::TimelineEvents event);
|
||||||
void updateFlowEventId(std::string event_id);
|
void updateFlowEventId(std::string event_id);
|
||||||
|
|
|
@ -351,6 +351,34 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
|
||||||
&TimelineViewManager::openImageOverlayInternal);
|
&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
|
void
|
||||||
TimelineViewManager::setVideoCallItem()
|
TimelineViewManager::setVideoCallItem()
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,6 +64,10 @@ public:
|
||||||
Q_INVOKABLE QString userPresence(QString id) const;
|
Q_INVOKABLE QString userPresence(QString id) const;
|
||||||
Q_INVOKABLE QString userStatus(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 focusMessageInput();
|
||||||
Q_INVOKABLE void openLeaveRoomDialog(QString roomid) const;
|
Q_INVOKABLE void openLeaveRoomDialog(QString roomid) const;
|
||||||
Q_INVOKABLE void removeVerificationFlow(DeviceVerificationFlow *flow);
|
Q_INVOKABLE void removeVerificationFlow(DeviceVerificationFlow *flow);
|
||||||
|
@ -85,6 +89,9 @@ signals:
|
||||||
void focusChanged();
|
void focusChanged();
|
||||||
void focusInput();
|
void focusInput();
|
||||||
void openImageOverlayInternalCb(QString eventId, QImage img);
|
void openImageOverlayInternalCb(QString eventId, QImage img);
|
||||||
|
void openRoomMembersDialog(MemberList *members);
|
||||||
|
void openRoomSettingsDialog(RoomSettings *settings);
|
||||||
|
void openInviteUsersDialog(InviteesModel *invitees);
|
||||||
void openProfile(UserProfile *profile);
|
void openProfile(UserProfile *profile);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
Loading…
Reference in a new issue