Message menu rework

Rework the file menu so that it no longer relies on having a reference to the media delegate to manage a download for either opening externally or copying to clipboard. This allows the menus to be moved out of the delegates and maximize components and have them accessed through RoomManager. This reduces duplication and reduces the number of components in an already heavy delegate.
This commit is contained in:
James Graham
2023-09-15 13:57:40 +00:00
parent 14cdd096cf
commit 33c0cae64c
14 changed files with 305 additions and 103 deletions

View File

@@ -5,6 +5,7 @@
#include "roommanager.h"
#include "controller.h"
#include "enums/delegatetype.h"
#include "models/messageeventmodel.h"
#include "neochatconfig.h"
#include "neochatroom.h"
@@ -103,11 +104,34 @@ void RoomManager::maximizeMedia(int index)
Q_EMIT showMaximizedMedia(index);
}
void RoomManager::requestFullScreenClose()
{
Q_EMIT closeFullScreen();
}
void RoomManager::viewEventSource(const QString &eventId)
{
Q_EMIT showEventSource(eventId);
}
void RoomManager::viewEventMenu(const QString &eventId,
const QVariantMap &author,
DelegateType::Type delegateType,
const QString &plainText,
const QString &htmlText,
const QString &selectedText,
const QString &mimeType,
const FileTransferInfo &progressInfo)
{
if (delegateType == DelegateType::Image || delegateType == DelegateType::Video || delegateType == DelegateType::Audio
|| delegateType == DelegateType::File) {
Q_EMIT showFileMenu(eventId, author, delegateType, plainText, mimeType, progressInfo);
return;
}
Q_EMIT showMessageMenu(eventId, author, delegateType, plainText, htmlText, selectedText);
}
bool RoomManager::hasOpenRoom() const
{
return m_currentRoom != nullptr;