139 lines
3.2 KiB
C++
Executable File
139 lines
3.2 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Show the exported scripts and allow them to upload them to the server
|
|
* $Id: tpm_exported_scripts_dialog.h 51804 2020-07-31 04:47:28Z fritsche_h $
|
|
* $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/tpm_exported_scripts_dialog.h $
|
|
* $Author: fritsche_h $
|
|
*
|
|
* Created by Mike Wille, SLTE, 2020-03-23
|
|
*/
|
|
#pragma once
|
|
|
|
#include "logger.h"
|
|
|
|
#include <LtsWidgets/lts_dialog.h>
|
|
|
|
#include <QFileInfoList>
|
|
|
|
namespace Ui
|
|
{
|
|
class USBDialog;
|
|
}
|
|
namespace LtsSession
|
|
{
|
|
class LtsSession;
|
|
}
|
|
|
|
namespace TakeHomePackageManager
|
|
{
|
|
class ExportedScriptsModel;
|
|
|
|
enum eLayerType
|
|
{
|
|
elevation,
|
|
map,
|
|
sceneObject,
|
|
scene
|
|
};
|
|
|
|
struct layerMappinEntry
|
|
{
|
|
eLayerType type;
|
|
QString description;
|
|
int maxScale;
|
|
int minScale;
|
|
QString name;
|
|
QString url;
|
|
|
|
public:
|
|
|
|
layerMappinEntry()
|
|
: type(eLayerType::map), description(QStringLiteral("NOTSET")), maxScale(125), minScale(-1), name(QStringLiteral("_name")), url(QStringLiteral("_url"))
|
|
{
|
|
|
|
}
|
|
layerMappinEntry(eLayerType _type, QString _description, int _maxScale, int _minScale, QString _name, QString _url)
|
|
: type(_type), description(_description), maxScale(_maxScale), minScale(_minScale), name(_name), url(_url)
|
|
{
|
|
|
|
}
|
|
};
|
|
|
|
class USBDialog : public LtsWidgets::LtsDialog
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
/**
|
|
* @brief USBDialog => WARNING: throws! catch exception!
|
|
* @param session
|
|
* @param parent
|
|
*/
|
|
explicit USBDialog(LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
|
~USBDialog();
|
|
|
|
void retranslate() override;
|
|
|
|
static QString getContentFolder(const QString &rootFolder, int exerciseId);
|
|
QString getContentFolder(const QString &rootFolder) const;
|
|
|
|
static QString exerciseDirectoryName(int exerciseId);
|
|
static QString getScriptFolder(const QString &rootFolder, int exerciseId, int scriptId);
|
|
|
|
signals:
|
|
void nextMap();
|
|
|
|
private slots:
|
|
void slotSelectionChanged();
|
|
|
|
void slotCopy();
|
|
void slotCopyMaps();
|
|
void slotCopyWinBin();
|
|
void slotCopyWinBinP2();
|
|
void slotCopyWinBinP3();
|
|
|
|
void slotRemove();
|
|
void slotRemoveMaps();
|
|
|
|
void slotChangePath();
|
|
void onNextMap();
|
|
void generateLayerMappingXML();
|
|
|
|
|
|
|
|
private:
|
|
enum class What
|
|
{
|
|
ScriptWasDeletedFromExercise,
|
|
ExerciseDirectoryWasDeleted,
|
|
NewExerciseDirectoryWasCreated,
|
|
ScriptWasCopiedToExercise,
|
|
};
|
|
|
|
void adjustJsonFiles(What what);
|
|
void initModel();
|
|
void initUsbModel();
|
|
void scriptDeleted(int scriptId);
|
|
void scriptCopied(int scriptId);
|
|
QFileInfoList prepareFileInfoListForFolder(QString src, QFileInfoList fil);
|
|
|
|
QString getContentFolder(int exerciseId) const;
|
|
QString getContentFolder() const;
|
|
QString getRootFolder(bool forceDownloadDir = false) const;
|
|
QString exerciseDirectoryName() const;
|
|
QString getScriptFolder(const QString &rootFolder, int scriptId) const;
|
|
QString getScriptFolder(int scriptId) const;
|
|
|
|
ExportedScriptsModel *m_localThpModel;
|
|
ExportedScriptsModel *m_usbThpModel;
|
|
Ui::USBDialog *m_ui;
|
|
LtsSession::LtsSession *m_session;
|
|
int m_exerciseId;
|
|
int m_paths;
|
|
QMap<QString, QFileInfoList> m_files;
|
|
|
|
QString m_usbRoot;
|
|
NGL::INGLLogger &m_logger;
|
|
int m_finished_mapCopys;
|
|
};
|
|
} // namespace TakeHomePackageManager
|