2017-07-19 23:20:32 +02:00
|
|
|
#pragma once
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2014-12-08 08:32:39 +01:00
|
|
|
#include "lc_application.h"
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2016-05-31 00:41:03 +02:00
|
|
|
#define LC_HTML_SINGLEPAGE 0x01
|
|
|
|
#define LC_HTML_INDEX 0x02
|
|
|
|
#define LC_HTML_LISTEND 0x08
|
|
|
|
#define LC_HTML_LISTSTEP 0x10
|
|
|
|
#define LC_HTML_SUBMODELS 0x40
|
|
|
|
#define LC_HTML_CURRENT_ONLY 0x80
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2017-12-11 20:14:37 +01:00
|
|
|
class lcHTMLExportOptions
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
lcHTMLExportOptions(const Project* Project);
|
|
|
|
void SaveDefaults();
|
|
|
|
|
|
|
|
QString PathName;
|
|
|
|
bool TransparentImages;
|
|
|
|
bool SubModels;
|
|
|
|
bool CurrentOnly;
|
|
|
|
bool SinglePage;
|
|
|
|
bool IndexPage;
|
|
|
|
int StepImagesWidth;
|
|
|
|
int StepImagesHeight;
|
|
|
|
bool PartsListStep;
|
|
|
|
bool PartsListEnd;
|
|
|
|
};
|
|
|
|
|
2014-12-08 08:32:39 +01:00
|
|
|
class Project
|
2011-09-07 23:06:51 +02:00
|
|
|
{
|
|
|
|
public:
|
2020-10-03 12:02:27 +02:00
|
|
|
Project(bool IsPreview = false);
|
2011-09-07 23:06:51 +02:00
|
|
|
~Project();
|
|
|
|
|
2020-05-04 00:39:39 +02:00
|
|
|
Project(const Project&) = delete;
|
2021-11-15 03:34:24 +01:00
|
|
|
Project(Project&&) = delete;
|
2020-05-04 00:39:39 +02:00
|
|
|
Project& operator=(const Project&) = delete;
|
2021-11-15 03:34:24 +01:00
|
|
|
Project& operator=(Project&&) = delete;
|
2020-05-04 00:39:39 +02:00
|
|
|
|
2024-06-17 02:43:02 +02:00
|
|
|
const std::vector<std::unique_ptr<lcModel>>& GetModels() const
|
2014-12-10 00:56:29 +01:00
|
|
|
{
|
|
|
|
return mModels;
|
|
|
|
}
|
|
|
|
|
2020-05-03 21:11:51 +02:00
|
|
|
lcModel* GetModel(const QString& FileName) const;
|
2018-01-03 04:46:50 +01:00
|
|
|
|
2014-12-08 08:32:39 +01:00
|
|
|
lcModel* GetActiveModel() const
|
|
|
|
{
|
|
|
|
return mActiveModel;
|
|
|
|
}
|
|
|
|
|
2016-11-26 02:12:19 +01:00
|
|
|
lcModel* GetMainModel() const
|
|
|
|
{
|
2024-06-17 02:43:02 +02:00
|
|
|
return !mModels.empty() ? mModels[0].get() : nullptr;
|
2016-11-26 02:12:19 +01:00
|
|
|
}
|
|
|
|
|
2014-12-13 00:42:09 +01:00
|
|
|
bool IsModified() const;
|
2019-03-08 19:54:58 +01:00
|
|
|
void MarkAsModified();
|
2014-12-04 02:47:28 +01:00
|
|
|
QString GetTitle() const;
|
2014-12-13 00:42:09 +01:00
|
|
|
|
2014-12-04 02:47:28 +01:00
|
|
|
QString GetFileName() const
|
|
|
|
{
|
|
|
|
return mFileName;
|
|
|
|
}
|
|
|
|
|
2018-04-15 03:27:16 +02:00
|
|
|
QString GetImageFileName(bool AllowCurrentFolder) const;
|
2017-12-27 22:55:37 +01:00
|
|
|
|
2021-01-15 03:19:58 +01:00
|
|
|
lcInstructions* GetInstructions();
|
2019-12-31 01:04:58 +01:00
|
|
|
|
2024-06-17 02:43:02 +02:00
|
|
|
void SetActiveModel(lcModel* Model);
|
2014-12-13 00:42:09 +01:00
|
|
|
void SetActiveModel(int ModelIndex);
|
2020-05-03 21:11:51 +02:00
|
|
|
void SetActiveModel(const QString& FileName);
|
2014-12-13 00:42:09 +01:00
|
|
|
|
2015-12-02 02:16:12 +01:00
|
|
|
lcModel* CreateNewModel(bool ShowModel);
|
2016-09-09 00:34:51 +02:00
|
|
|
QString GetNewModelName(QWidget* ParentWidget, const QString& DialogTitle, const QString& CurrentName, const QStringList& ExistingModels) const;
|
2014-12-13 00:42:09 +01:00
|
|
|
void ShowModelListDialog();
|
2016-09-26 02:15:30 +02:00
|
|
|
|
2021-04-17 20:49:41 +02:00
|
|
|
bool Load(const QString& FileName, bool ShowErrors);
|
2014-12-08 08:32:39 +01:00
|
|
|
bool Save(const QString& FileName);
|
2016-09-26 02:15:30 +02:00
|
|
|
bool Save(QTextStream& Stream);
|
2014-12-23 18:02:23 +01:00
|
|
|
void Merge(Project* Other);
|
2017-06-26 03:20:34 +02:00
|
|
|
bool ImportLDD(const QString& FileName);
|
2017-08-20 22:47:53 +02:00
|
|
|
bool ImportInventory(const QByteArray& Inventory, const QString& Name, const QString& Description);
|
2014-12-04 02:47:28 +01:00
|
|
|
|
2015-01-12 06:02:50 +01:00
|
|
|
void SaveImage();
|
2023-05-23 13:05:56 +02:00
|
|
|
bool ExportCurrentStep(const QString& FileName);
|
2019-05-28 01:39:51 +02:00
|
|
|
bool ExportModel(const QString& FileName, lcModel* Model) const;
|
2021-01-11 03:07:27 +01:00
|
|
|
bool Export3DStudio(const QString& FileName);
|
2014-12-30 17:30:12 +01:00
|
|
|
void ExportBrickLink();
|
2021-01-11 03:07:27 +01:00
|
|
|
bool ExportCOLLADA(const QString& FileName);
|
2022-10-30 22:12:34 +01:00
|
|
|
bool ExportCSV(const QString& FileName);
|
2017-12-11 20:14:37 +01:00
|
|
|
void ExportHTML(const lcHTMLExportOptions& Options);
|
2017-09-22 19:08:02 +02:00
|
|
|
bool ExportPOVRay(const QString& FileName);
|
2021-01-11 03:07:27 +01:00
|
|
|
bool ExportWavefront(const QString& FileName);
|
2014-12-30 17:30:12 +01:00
|
|
|
|
2016-11-26 02:12:19 +01:00
|
|
|
void UpdatePieceInfo(PieceInfo* Info) const;
|
|
|
|
|
2021-02-28 22:02:58 +01:00
|
|
|
protected:
|
2015-03-27 21:39:43 +01:00
|
|
|
QString GetExportFileName(const QString& FileName, const QString& DefaultExtension, const QString& DialogTitle, const QString& DialogFilter) const;
|
2021-02-21 03:44:12 +01:00
|
|
|
|
2019-05-28 01:39:51 +02:00
|
|
|
std::vector<lcModelPartsEntry> GetModelParts();
|
2018-01-02 15:10:58 +01:00
|
|
|
void SetFileName(const QString& FileName);
|
2014-12-30 17:30:12 +01:00
|
|
|
|
2020-10-03 12:02:27 +02:00
|
|
|
bool mIsPreview;
|
2014-12-08 08:32:39 +01:00
|
|
|
bool mModified;
|
|
|
|
QString mFileName;
|
2018-01-02 15:10:58 +01:00
|
|
|
QFileSystemWatcher mFileWatcher;
|
2014-12-04 02:47:28 +01:00
|
|
|
|
2024-06-17 02:43:02 +02:00
|
|
|
std::vector<std::unique_ptr<lcModel>> mModels;
|
2014-12-08 08:32:39 +01:00
|
|
|
lcModel* mActiveModel;
|
2021-01-15 03:19:58 +01:00
|
|
|
std::unique_ptr<lcInstructions> mInstructions;
|
2014-12-08 08:32:39 +01:00
|
|
|
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(Project);
|
2011-09-07 23:06:51 +02:00
|
|
|
};
|
|
|
|
|
2014-12-08 08:32:39 +01:00
|
|
|
inline lcModel* lcGetActiveModel()
|
|
|
|
{
|
2020-03-23 04:18:52 +01:00
|
|
|
const Project* const Project = lcGetActiveProject();
|
2017-04-14 02:26:40 +02:00
|
|
|
return Project ? Project->GetActiveModel() : nullptr;
|
2014-12-08 08:32:39 +01:00
|
|
|
}
|
|
|
|
|