/** * @RDE_HEADER@ * $Id$ * $HeadURL$ * $Author$ * * Created by Philipp Last, NLSE, 02.01.2018 */ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #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 &ocFtc, const std::shared_ptr &evlFtc, const std::shared_ptr &evlDtc, const std::shared_ptr &opmDtc, const std::shared_ptr &flmFtc, const std::shared_ptr &flmDtc, const std::shared_ptr &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 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 m_mapSchemata; qint32 m_loadedSchemaId{0}; std::shared_ptr m_ocFtc; std::shared_ptr m_evlDtc; std::shared_ptr m_evlFtc; std::shared_ptr m_opmDtc; std::shared_ptr m_flmFtc; std::shared_ptr m_flmDtc; std::shared_ptr 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; }; }