Fixed saving mpd files.

This commit is contained in:
leo 2014-12-26 17:09:11 +00:00
parent 0aae5d339f
commit e1e9a022ca
5 changed files with 13 additions and 6 deletions

View file

@ -248,7 +248,7 @@ bool lcMainWindow::SaveProject(const QString& FileName)
if (SaveFileName.isEmpty()) if (SaveFileName.isEmpty())
SaveFileName = QFileInfo(QDir(lcGetProfileString(LC_PROFILE_PROJECTS_PATH)), Project->GetTitle()).absoluteFilePath(); SaveFileName = QFileInfo(QDir(lcGetProfileString(LC_PROFILE_PROJECTS_PATH)), Project->GetTitle()).absoluteFilePath();
SaveFileName = QFileDialog::getSaveFileName(mHandle, tr("Save Project"), SaveFileName, tr("Supported Files (*.ldr *.dat);;All Files (*.*)")); SaveFileName = QFileDialog::getSaveFileName(mHandle, tr("Save Project"), SaveFileName, tr("Supported Files (*.ldr *.dat *.mpd);;All Files (*.*)"));
if (SaveFileName.isEmpty()) if (SaveFileName.isEmpty())
return false; return false;

View file

@ -114,7 +114,7 @@ void lcPiece::SaveLDraw(QTextStream& Stream) const
Stream << Number << ' '; Stream << Number << ' ';
} }
Stream << mPieceInfo->m_strName << QLatin1String(".DAT") << LineEnding; Stream << mPieceInfo->GetSaveID() << LineEnding;
} }
bool lcPiece::ParseLDrawLine(QTextStream& Stream) bool lcPiece::ParseLDrawLine(QTextStream& Stream)

View file

@ -27,6 +27,14 @@ PieceInfo::~PieceInfo()
Unload(); Unload();
} }
QString PieceInfo::GetSaveID() const
{
if (mFlags & LC_PIECE_MODEL)
return mModel->GetProperties().mName;
return QString::fromLatin1(m_strName) + QLatin1String(".DAT");
}
void PieceInfo::SetModel(lcModel* Model) void PieceInfo::SetModel(lcModel* Model)
{ {
m_strName[0] = 0; m_strName[0] = 0;

View file

@ -2,9 +2,6 @@
#define _PIECEINF_H_ #define _PIECEINF_H_
#include <stdio.h> #include <stdio.h>
#ifndef GLuint
#include "opengl.h"
#endif
#include "lc_math.h" #include "lc_math.h"
#include "lc_array.h" #include "lc_array.h"
#include "lc_mesh.h" #include "lc_mesh.h"
@ -25,6 +22,8 @@ public:
PieceInfo(); PieceInfo();
~PieceInfo(); ~PieceInfo();
QString GetSaveID() const;
int AddRef() int AddRef()
{ {
mRefCount++; mRefCount++;

View file

@ -319,7 +319,7 @@ bool Project::Save(const QString& FileName)
Model->SetSaved(); Model->SetSaved();
if (MPD) if (MPD)
Stream << QLatin1String("0 ENDFILE\r\n"); Stream << QLatin1String("0 NOFILE\r\n");
} }
mFileName = FileName; mFileName = FileName;