100 lines
3.2 KiB
C++
Executable File
100 lines
3.2 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Exportieren von SAAB-Dateien
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "saab_logging.h"
|
|
#include "zwmssaab_export.h"
|
|
#include "saab_types.h"
|
|
|
|
#include <LtsWidgets/lts_frameless_dialog.h>
|
|
#include <ExerciseManagement/exm.hpp>
|
|
#include <ParticipantManagement/ppm_dtc.h>
|
|
|
|
#include <QFile>
|
|
|
|
class QXmlStreamWriter;
|
|
class QXmlStreamReader;
|
|
|
|
namespace LtsSession
|
|
{
|
|
class LtsSession;
|
|
}
|
|
|
|
class Ui_SAABExport;
|
|
|
|
namespace saab
|
|
{
|
|
class ZWMSSAAB_EXPORT ExportSaab
|
|
: public LtsWidgets::LtsFramelessDialog
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit ExportSaab(LtsSession::LtsSession *session,
|
|
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
|
const ExerciseManagement::Exercise &exercise,
|
|
QWidget *parent = nullptr);
|
|
virtual ~ExportSaab();
|
|
|
|
public Q_SLOTS:
|
|
void onStartExport();
|
|
void onSelectConfigFile();
|
|
void onSelectExportFile();
|
|
|
|
private: // other
|
|
struct MappedPartyInfo
|
|
{
|
|
QString forceCode;
|
|
QString echelonCode;
|
|
QString symbolCode;
|
|
};
|
|
|
|
enum GuidContext
|
|
{
|
|
GuidExercise = 1,
|
|
GuidParty = 2,
|
|
GuidParticipant = 3
|
|
};
|
|
|
|
private: // methods
|
|
bool isValidConfigFile();
|
|
void importConfig();
|
|
SaabSymbol readSymbol(QXmlStreamReader *reader) const;
|
|
SaabEchelon readEchelon(QXmlStreamReader *reader) const;
|
|
SaabForce readForce(QXmlStreamReader *reader) const;
|
|
void writeExercise(QXmlStreamWriter *writer) const;
|
|
void writeOrbat(QXmlStreamWriter *writer);
|
|
void writeFooter(QXmlStreamWriter *writer) const;
|
|
SaabPlayer *toSaabPlayer(const ParticipantManagement::Party &party,
|
|
QMap<int, ParticipantManagement::Participant> &remainingParticipants);
|
|
SaabPlayer *toSaabPlayer(const ParticipantManagement::Participant &participant,
|
|
QMap<int, ParticipantManagement::Participant> &remainingParticipants);
|
|
ParticipantManagement::Participant rootParticipant(const ParticipantManagement::Participant &participant,
|
|
const QMap<int, ParticipantManagement::Participant> &participants) const;
|
|
QString toSaabTime(qint64 msecs) const;
|
|
void mapType(const ParticipantManagement::Type &type);
|
|
void mapPartyToForce(const ParticipantManagement::Party &party);
|
|
|
|
private: // attributes
|
|
QMap<int32_t, MappedPartyInfo> m_mapPartyToForce;
|
|
QMap<int32_t, QString> m_mapTypeToSaabSymbol; // <SAAB symbol.code, type.id>
|
|
QMap<QString, SaabSymbol> m_mapSymbols;
|
|
QMap<QString, SaabEchelon> m_mapEchelons;
|
|
QMap<int, ParticipantManagement::Type> m_types;
|
|
QMap<int, ParticipantManagement::Party> m_parties;
|
|
QMap<QString, QString> m_mapForces;
|
|
ExerciseManagement::Exercise m_currentExercise;
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
|
LtsSession::LtsSession *m_session;
|
|
QFile *m_configFile;
|
|
Ui_SAABExport *m_ui;
|
|
saab::LOGGER_T m_logger;
|
|
};
|
|
}
|
|
|