Files
qt5-legatus-legacy/Lts/Plugins/AdvancedSymbology/Gui/SymbolProxy/asb_flm_subscriber.h
T
2026-08-13 18:33:10 +02:00

108 lines
3.7 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Subscribe to file management service
* $Id$
* $HeadURL$
* $Author$
*
* Created by Norbert Thoden, NLE, 2019-04-15
*/
#pragma once
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Plugins/AdvancedSymbology/asb_symbol_proxy_gui_plugin_interface.h>
#include <Plugins/FileManagement/flm_data_plugin_interface.h>
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
#include <FileManagement/flm.hpp>
#include <LtsUtilsCore/data_modification_enum.h>
#include <memory>
namespace LtsUtils
{
class RequestHelper;
}
namespace AdvancedSymbology
{
class FlmSubscriber final
: public QObject
, public ForeignGuiFlmSymbolsProxyInterface
, public FileManagement::Interface::Ftc::GetFileContentDataReplyHandler
{
Q_OBJECT
public:
explicit FlmSubscriber(const std::shared_ptr<FileManagement::Interface::Dtc> &flmDtc,
const std::shared_ptr<FileManagement::Interface::Ftc> &flmFtc,
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc);
~FlmSubscriber();
bool createFlmSymbolProxy(int type_placeholder) override; // type_placeholder: GlobalSymbols, ExerciseSymbols... to be prepared
bool connectFlmSymbolProxy(int type_placeholder, SymbologyType symbologyType) override;
private: // methods
bool setEtsSymbolToDict(SymbolDictionary &dict,
qint32 fileContentId,
const QString &name,
const QImage &image,
const QColor &colorToBeReplaced,
const QStringList &usrTags);
bool setXmlSymbolToDict(SymbolDictionary &dict,
qint32 fileContentId,
const QString &operatorName,
qint64 lastModified,
const QString &name,
const QString &xmlContent,
const QStringList &usrTags);
protected slots:
void onFileContentChanged(const FileManagement::FileContent &data, DataModification modType);
void updateFileContentMap(const FileManagement::FileContent &data);
void onLocalSymbolProxyEtsSymbolAdded(qint32 fileContentId,
const QString &name,
const QImage &image,
const QColor &colorToBeReplaced,
const QStringList &usrTags);
void onLocalSymbolProxyEtsSymbolRemoved(qint32 fileContentId, const QString &name);
void onLocalSymbolProxyXmlSymbolAdded(qint32 fileContentId,
const QString &operatorName,
qint64 lastModified,
const QString &name,
const QString &xmlContent,
const QStringList &usrTags);
void onLocalSymbolProxyXmlSymbolRemoved(qint32 fileContentId);
protected:
/**
* @brief onGetFileContentDataReply
* @param reply contains the FileContentData to be processed (Symbol as SVG/ByteArray)
*/
void onGetFileContentDataReply(const FileManagement::GetFileContentDataReply &reply) override;
bool svgToImage(const QByteArray &svgByteArray, QImage &imageOut);
QString operatorName(int operatorId);
void checkForReFetching();
private: // attributes
LOGGER_T m_logger; ///< Interface of the Logging-Facility
struct Private;
/**
* The private d->pointer to not break BC when changing internals of this class
*/
Private *d = nullptr;
};
} // namespace AdvancedSymbology