Files
qt5-legatus-legacy/Lts/Plugins/Evaluations/Gui/SchemaEdit/evl_edit_schema.h
T
2026-08-13 18:33:10 +02:00

144 lines
4.7 KiB
C++
Executable File

/**
* @RDE_HEADER@
* $Id$
* $HeadURL$
* $Author$
*
* Created by Philipp Last, NLSE, 02.01.2018
*/
#pragma once
#include <Evaluations/logger.h>
#include <Evaluations/evl_dtc.h>
#include <Evaluations/evl_ftc.h>
#include <OcSituationClient/osc_ftc.h>
#include <FileManagement/flm_dtc.h>
#include <FileManagement/flm_ftc.h>
#include <LtsWidgets/lts_dialog.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
#include <Plugins/FileManagement/Data/flm_data_plugin.h>
#include <LtsSession/lts_session.h>
#include "evl_edit_treemodel_schema.h"
namespace Ui
{
class EditSchemaDialog;
}
namespace Evaluations
{
class EvlNewCommentDialog;
class EditSchemaDialog : public LtsWidgets::LtsDialog
, protected Interface::Ftc::EvlCommentModifyReplyHandler
, protected Interface::Ftc::EvlSchemaModifyReplyHandler
, protected FileManagement::Interface::Ftc::FileContentModifyReplyHandler
, protected OcSituationClient::Interface::Ftc::SendEvaluationReplyHandler
{
Q_OBJECT
public:
explicit EditSchemaDialog(bool ocMode, bool runningOnTablet, LtsSession::LtsSession *session, QWidget *parent = nullptr);
~EditSchemaDialog();
bool init(const std::shared_ptr<OcSituationClient::Interface::Ftc> &ocFtc,
const std::shared_ptr<Interface::Ftc> &evlFtc,
const std::shared_ptr<Interface::Dtc> &evlDtc,
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc,
const std::shared_ptr<FileManagement::Interface::Ftc> &flmFtc,
const std::shared_ptr<FileManagement::Interface::Dtc> &flmDtc,
const std::shared_ptr<FileManagement::ForeignGuiInterface> &flmGui);
void retranslate() override;
private:
void onSendEvaluationReply(const Core::FunctionReplyObject &replyObject) override final;
void onEvlCommentModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
void onEvlSchemaModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
// FileManagement
void onFileContentModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject);}
private slots:
void onRequestSchema();
void onNotifyAboutSchema(const Evaluations::EvaluationSchema &data, DataModification modType);
void onAddNewComment();
void onCommentAccepted();
void onCommentEditAccepted();
void onSendComment();
void onSendAllComments();
void onTreeViewDoubleClicked();
void onEditComment();
void onModifySelectedEntry();
void onTreeViewModelIndexChanged(const QModelIndex &curr);
void onTriedToDropFolderToElement();
void onDropActionFinished(const QModelIndex &parent);
void onShowContextMenu(const QPoint &position);
bool onSaveToLibrary();
void onLoadFromLibrary();
void onAddElement();
void onAddFolder();
void onAddRootFolder();
void onCreateNewSchema();
void onRemoveSelectedElement();
void DebugonLoadSchema();
void onSendSchema();
private:
void loadLatestSchema();
void handleUnsentComments();
void updateCommentLabel();
void markCommentAsSent(const QPersistentModelIndex &idx);
// Somehow identically...
EvlCommentModifyRequest createEvlCommentModifyRequest(const ItemComment &c) const;
OcSituationClient::SendEvaluationRequest createSendEvaluationRequest(const ItemComment &c) const;
QVector<QPersistentModelIndex> m_vecCommentsInSendState;
bool eventFilter(QObject *object, QEvent *event) override;
void addEntry(bool isFolder, bool isNewRoot = false);
void removeEntry(const QModelIndex &idx);
void removeComment(const QModelIndex &idx);
void sendComment(const QModelIndex &idx);
void createExampleSchema();
void loadSchema(qint32 schemaId);
void saveSchema(bool sendToTa);
bool apply() override;
bool m_ocMode{false};
bool m_runningOnTablet{false};
TreeModelSchema *m_pModel{nullptr};
QMap<qint32, Evaluations::EvaluationSchema> m_mapSchemata;
qint32 m_loadedSchemaId{0};
std::shared_ptr<OcSituationClient::Interface::Ftc> m_ocFtc;
std::shared_ptr<Interface::Dtc> m_evlDtc;
std::shared_ptr<Interface::Ftc> m_evlFtc;
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
std::shared_ptr<FileManagement::Interface::Ftc> m_flmFtc;
std::shared_ptr<FileManagement::Interface::Dtc> m_flmDtc;
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
QString m_lastFileName;
Evaluations::EvlNewCommentDialog *m_commentDlg{nullptr};
LtsSession::LtsSession *m_session{nullptr};
LtsUtils::RequestHelper *m_requestHelper{nullptr};
Ui::EditSchemaDialog *m_ui{nullptr};
LOGGER_T m_logger;
};
}