Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,166 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ExerciseManangement - Exercise Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ExerciseManagement/exm_ftc.h>
|
||||
#include <ExerciseManagement/exm_dtc.h>
|
||||
#include <ExerciseManagement/logger.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
|
||||
|
||||
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
|
||||
#include <Plugins/AssetManagement/asm_data_plugin_interface.h>
|
||||
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <Plugins/FileManagement/flm_data_plugin_interface.h>
|
||||
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
|
||||
#include <FileManagement/flm_translation.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ExerciseManagementEditDialog;
|
||||
}
|
||||
|
||||
namespace ExerciseManagement
|
||||
{
|
||||
namespace JsonKeys
|
||||
{
|
||||
// general
|
||||
inline QString XMLTYPE() { return QStringLiteral("XmlType"); }
|
||||
inline QString XMLTYPEVALUE() { return FileManagement::toString(FileManagement::XmlType::EXMExerciseDescription); }
|
||||
|
||||
// Exercise
|
||||
inline QString PHASES() { return QStringLiteral("phases"); }
|
||||
inline QString OPERATORS() { return QStringLiteral("operators"); }
|
||||
inline QString FORCES() { return QStringLiteral("forces"); }
|
||||
inline QString DESCRIPTION() { return QStringLiteral("description"); }
|
||||
|
||||
// ExercisePhase:
|
||||
inline QString PID() { return QStringLiteral("phaseId"); }
|
||||
inline QString PNAME() { return QStringLiteral("phaseName"); }
|
||||
inline QString PISDELETED() { return QStringLiteral("phaseIsDeleted"); }
|
||||
inline QString PISUSED() { return QStringLiteral("phaseIsUsed"); }
|
||||
inline QString PBEGINTIME() { return QStringLiteral("phaseBeginTime"); }
|
||||
inline QString PENDTIME() { return QStringLiteral("phaseEndTime"); }
|
||||
inline QString PDESCRIPTION() { return QStringLiteral("phaseDescription"); }
|
||||
inline QString PEXERCISEID() { return QStringLiteral("phaseExerciseId"); }
|
||||
} // namespace JsonKeys
|
||||
|
||||
|
||||
class ExercisePhaseModel;
|
||||
class ExercisePhaseProxyModel;
|
||||
class ExerciseOperatorModel;
|
||||
// --------------------------------------------------------
|
||||
// ExerciseManagementEditDialog
|
||||
// --------------------------------------------------------
|
||||
class ExerciseManagementEditDialog final : public LtsWidgets::LtsDialog
|
||||
, protected ExerciseManagement::Interface::Ftc::ExerciseCreateReplyHandler
|
||||
, protected ExerciseManagement::Interface::Ftc::ExerciseModifyReplyHandler
|
||||
, protected ExerciseManagement::Interface::Ftc::ExerciseImageModifyReplyHandler
|
||||
, protected ExerciseManagement::Interface::Ftc::GetExerciseImageReplyHandler
|
||||
, protected ExerciseManagement::Interface::Ftc::ExercisePhaseRemoveReplyHandler
|
||||
, protected OperatorManagement::Interface::Ftc::OperatorCreateModifyReplyHandler
|
||||
, protected FileManagement::Interface::Ftc::FolderModifyReplyHandler
|
||||
, protected FileManagement::Interface::Ftc::FolderRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExerciseManagementEditDialog(QWidget *parent = nullptr);
|
||||
|
||||
bool init(LtsSession::LtsSessionDataDds *session,
|
||||
const QString &menuGroup,
|
||||
const int exerciseId);
|
||||
|
||||
~ExerciseManagementEditDialog();
|
||||
|
||||
protected:
|
||||
void onExerciseCreateReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onExerciseModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onExerciseImageModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); imageModifyError(); }
|
||||
void onGetExerciseImageReply(const GetExerciseImageReply &reply) override final;
|
||||
void onExercisePhaseRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onOperatorCreateModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onFolderModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onFolderRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
private slots:
|
||||
void slotChangeImage();
|
||||
void enaDisaOperatorsButtons();
|
||||
void enaDisaPhaseButtons();
|
||||
void onAddExercisePhase();
|
||||
void onEditVisibleParties();
|
||||
void onEditExercisePhase();
|
||||
void onRemoveExercisePhase();
|
||||
void onExport();
|
||||
void onImport();
|
||||
void onCreateFolders();
|
||||
void onExerciseChanged(const Exercise &data, DataModification modType);
|
||||
void onExercisePhaseChanged(const ExercisePhase &data, DataModification modType);
|
||||
void onContextMenuRequested(const QPoint &position);
|
||||
void onSelectAllUsers();
|
||||
void onUnselectAllUsers();
|
||||
void onTimeZoneChanged();
|
||||
signals:
|
||||
void sendData(const ExerciseManagement::Exercise &data);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
bool apply() override final;
|
||||
|
||||
void enaDisa();
|
||||
|
||||
void fillStateCbx();
|
||||
void fillTrainingAreaCbx();
|
||||
void fillActivePhaseCbx();
|
||||
void fillRadioGroupCbx();
|
||||
void fillLinkedExercisesCbx();
|
||||
void fillAllCbx();
|
||||
void imageModifyError();
|
||||
void sendModifiedOperators(int thisExerciseId);
|
||||
int createFolder(int parentFolderId, const QString &folderName, bool isHidden = false);
|
||||
bool createFolders(int newExId);
|
||||
bool createExerciseFolders(int parentFolderId, const QStringList &folderNames);
|
||||
ExerciseModifyRequest setRequestContent() const;
|
||||
QByteArray exerciseToJson() const;
|
||||
ExerciseModifyRequest jsonToExercise(const QByteArray &content) const;
|
||||
void requestImage();
|
||||
const QPixmap getPixmap() const;
|
||||
int getExerciseFolder();
|
||||
|
||||
Ui::ExerciseManagementEditDialog *m_ui{nullptr};
|
||||
LtsSession::LtsSessionDataDds *m_session{nullptr};
|
||||
ExercisePhaseModel *m_phaseModel{nullptr};
|
||||
ExercisePhaseProxyModel *m_phaseProxyModel{nullptr};
|
||||
ExerciseOperatorModel *m_operatorModel{nullptr};
|
||||
bool m_pictureChanged{false};
|
||||
int m_exerciseId{-1};
|
||||
QVariant m_initialRadioGroupId;
|
||||
ExerciseState m_currentState;
|
||||
std::shared_ptr<Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
|
||||
std::shared_ptr<AssetManagement::Interface::Dtc> m_asmDtc;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<FileManagement::Interface::Dtc> m_flmDtc;
|
||||
std::shared_ptr<FileManagement::Interface::Ftc> m_flmFtc;
|
||||
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
|
||||
QString m_menuGroup;
|
||||
LtsUtils::RequestHelper *m_requestHelper{nullptr};
|
||||
LOGGER_T m_logger;
|
||||
|
||||
template<class T>
|
||||
bool removeElement(std::vector<T> &vec, T elem);
|
||||
bool hasVisibleParties(const std::vector<OperatorManagement::PartiesByExercise> vpbe) const;
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user