90 lines
3.1 KiB
C++
Executable File
90 lines
3.1 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Gui Plugin for NotificationManangement
|
|
*
|
|
* Created by Mike Lennart Wille, ESZS, 2025-06-17
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <NotificationManagement/logger.h>
|
|
|
|
#include <LtsUtilsGuiDds/request_helper.h>
|
|
#include <OperatorManagement/opm_dtc.h>
|
|
#include <PluginInterfaces/gui_plugin_interface.h>
|
|
#include <Plugins/NotificationManagement/nom_data_plugin_interface.h>
|
|
#include <Plugins/NotificationManagement/nom_gui_plugin_interface.h>
|
|
|
|
namespace LtsNotification
|
|
{
|
|
class LtsNotification;
|
|
}
|
|
|
|
namespace NotificationManagement
|
|
{
|
|
|
|
class GuiPlugin final
|
|
: public QObject
|
|
, public GuiPluginBase::Plugin
|
|
{
|
|
Q_PLUGIN_METADATA(IID "gui:3:nom.edit")
|
|
Q_INTERFACES(GuiPluginBase::Plugin)
|
|
|
|
Q_OBJECT
|
|
public:
|
|
explicit GuiPlugin() = default;
|
|
~GuiPlugin() = default;
|
|
|
|
QString pluginName() override { return QLatin1String("NotificationManagementGuiPlugin"); }
|
|
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
|
bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Global || partition == IDL::PartitionType::Exercise; }
|
|
};
|
|
|
|
class InterfaceImpl final
|
|
: public QObject
|
|
, public GuiPluginBase::Interface
|
|
, protected NotificationManagement::Interface::Ftc::ReadReceiptReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
|
~InterfaceImpl();
|
|
|
|
static const QString s_nomEditGuiPlugin;
|
|
|
|
QVector<LtsWidgets::PluginData> getActions() override;
|
|
QString menuGroup() const override { return tr("Notifications"); }
|
|
bool fetchInterfaces() override;
|
|
void clearInterfaces() override;
|
|
bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Global || partition == IDL::PartitionType::Exercise; }
|
|
|
|
static const QString s_participantInfoScheme;
|
|
|
|
protected:
|
|
void initNotificationSystem();
|
|
void onNotificationChanged(const NotificationManagement::NomNotification ¬i, DataModification modType);
|
|
void onReadReceiptReply(const Core::FunctionReplyObject &replyObject) override final;
|
|
|
|
private:
|
|
int isDeleted(const NomNotification &data) const;
|
|
LtsWidgets::LtsDialog *onShowNotificationManagementDialog(QWidget *parent);
|
|
void ack(const NotificationManagement::NomNotification ¬ification);
|
|
void updateUnreadCount();
|
|
bool parseContent(const QString &contentString, QMap<QString, QString> &retMap);
|
|
bool isMyMessage(const std::vector<NotificationManagement::Address> &recipents);
|
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
|
void showNotificationList(int notificationId);
|
|
|
|
QSet<int> m_unreadMessages;
|
|
LtsNotification::LtsNotification *m_noti;
|
|
QHash<int, NomNotification> m_nomNotifications;
|
|
LtsUtils::RequestHelper *m_requestHelper;
|
|
|
|
std::shared_ptr<NotificationManagement::Interface::Dtc> m_dtc;
|
|
std::shared_ptr<NotificationManagement::Interface::Ftc> m_ftc;
|
|
std::shared_ptr<OperatorManagement::Interface::Dtc> m_dtcOpm;
|
|
std::shared_ptr<NotificationManagement::ForeignGuiInterface> m_nomGuiInterface;
|
|
};
|
|
|
|
} // namespace NotificationManagement
|