Fixed broken path to measurements after using Save As option.
--HG-- branch : release
This commit is contained in:
parent
aee23cf700
commit
30adc76bce
|
@ -1,4 +1,5 @@
|
||||||
# Version 0.4.2
|
# Version 0.4.2
|
||||||
|
- Fixed broken path to measurements after using Save As option.
|
||||||
- Tool line. Block selecting the same point twice.
|
- Tool line. Block selecting the same point twice.
|
||||||
- [#443] Not valid dxf file. libdxf updated to version 3.12.2.0. Fixed drawing subpaths.
|
- [#443] Not valid dxf file. libdxf updated to version 3.12.2.0. Fixed drawing subpaths.
|
||||||
- Fixed combobox width in Dialog "Tool True Dart point".
|
- Fixed combobox width in Dialog "Tool True Dart point".
|
||||||
|
|
|
@ -2929,7 +2929,7 @@ bool MainWindow::SavePattern(const QString &fileName, QString &error)
|
||||||
qCDebug(vMainWindow, "Saving pattern file %s.", qUtf8Printable(fileName));
|
qCDebug(vMainWindow, "Saving pattern file %s.", qUtf8Printable(fileName));
|
||||||
QFileInfo tempInfo(fileName);
|
QFileInfo tempInfo(fileName);
|
||||||
|
|
||||||
const QString mPath = doc->MPath();
|
const QString mPath = AbsoluteMPath(curFile, doc->MPath());
|
||||||
if (not mPath.isEmpty() && curFile != fileName)
|
if (not mPath.isEmpty() && curFile != fileName)
|
||||||
{
|
{
|
||||||
doc->SetPath(RelativeMPath(fileName, mPath));
|
doc->SetPath(RelativeMPath(fileName, mPath));
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QPrinterInfo>
|
#include <QPrinterInfo>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
// Keep synchronize all names with initialization in VTranslateVars class!!!!!
|
// Keep synchronize all names with initialization in VTranslateVars class!!!!!
|
||||||
//measurements
|
//measurements
|
||||||
|
@ -1705,38 +1706,35 @@ QString StrippedName(const QString &fullFileName)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString RelativeMPath(const QString &patternPath, const QString &absoluteMPath)
|
QString RelativeMPath(const QString &patternPath, const QString &absoluteMPath)
|
||||||
{
|
{
|
||||||
if (patternPath.isEmpty())
|
if (patternPath.isEmpty() || absoluteMPath.isEmpty())
|
||||||
{
|
{
|
||||||
return absoluteMPath;
|
return absoluteMPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (absoluteMPath.isEmpty() || QFileInfo(absoluteMPath).isRelative())
|
if (QFileInfo(absoluteMPath).isRelative())
|
||||||
{
|
{
|
||||||
|
qWarning() << QApplication::tr("The path to the measurments is already relative.");
|
||||||
return absoluteMPath;
|
return absoluteMPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir dir(QFileInfo(patternPath).absoluteDir());
|
return QFileInfo(patternPath).absoluteDir().relativeFilePath(absoluteMPath);
|
||||||
return dir.relativeFilePath(absoluteMPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString AbsoluteMPath(const QString &patternPath, const QString &relativeMPath)
|
QString AbsoluteMPath(const QString &patternPath, const QString &relativeMPath)
|
||||||
{
|
{
|
||||||
if (patternPath.isEmpty())
|
if (patternPath.isEmpty() || relativeMPath.isEmpty())
|
||||||
{
|
{
|
||||||
return relativeMPath;
|
return relativeMPath;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (relativeMPath.isEmpty() || QFileInfo(relativeMPath).isAbsolute())
|
|
||||||
{
|
|
||||||
return relativeMPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
return QFileInfo(QFileInfo(patternPath).absoluteDir(), relativeMPath).absoluteFilePath();
|
if (QFileInfo(relativeMPath).isAbsolute())
|
||||||
|
{
|
||||||
|
qWarning() << QApplication::tr("The path to the measurments is already absolute.");
|
||||||
|
return relativeMPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString();// should never reach
|
return QFileInfo(QFileInfo(patternPath).absoluteDir(), relativeMPath).absoluteFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user