Fix issue with export non-latin DXF file name on Windows.
--HG-- branch : develop
This commit is contained in:
parent
968996da86
commit
219a15da23
|
@ -41,6 +41,7 @@
|
||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
#include <QPen>
|
#include <QPen>
|
||||||
#include <QPolygonF>
|
#include <QPolygonF>
|
||||||
|
#include <QTextCodec>
|
||||||
#include <QTextItem>
|
#include <QTextItem>
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
@ -109,7 +110,8 @@ bool VDxfEngine::begin(QPaintDevice *pdev)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
input = QSharedPointer<dx_iface>(new dx_iface(fileName.toStdString(), m_version, varMeasurement, varInsunits));
|
input = QSharedPointer<dx_iface>(new dx_iface(getFileNameForLocale(), m_version, varMeasurement,
|
||||||
|
varInsunits));
|
||||||
input->AddQtLTypes();
|
input->AddQtLTypes();
|
||||||
input->AddDefLayers();
|
input->AddDefLayers();
|
||||||
return true;
|
return true;
|
||||||
|
@ -611,7 +613,8 @@ bool VDxfEngine::ExportToAAMA(const QVector<VLayoutPiece> &details)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
input = QSharedPointer<dx_iface>(new dx_iface(fileName.toStdString(), m_version, varMeasurement, varInsunits));
|
input = QSharedPointer<dx_iface>(new dx_iface(getFileNameForLocale(), m_version, varMeasurement,
|
||||||
|
varInsunits));
|
||||||
input->AddAAMAHeaderData();
|
input->AddAAMAHeaderData();
|
||||||
if (m_version > DRW::AC1009)
|
if (m_version > DRW::AC1009)
|
||||||
{
|
{
|
||||||
|
@ -849,6 +852,28 @@ DRW_Entity *VDxfEngine::AAMAText(const QPointF &pos, const QString &text, const
|
||||||
return textLine;
|
return textLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
std::string VDxfEngine::FromUnicodeToCodec(const QString &str, QTextCodec *codec)
|
||||||
|
{
|
||||||
|
const QByteArray encodedString = codec->fromUnicode(str);
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
|
||||||
|
return encodedString.toStdString();
|
||||||
|
#else
|
||||||
|
return std::string(encodedString.constData(), static_cast<std::string::size_type>(encodedString.length()));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
std::string VDxfEngine::getFileNameForLocale() const
|
||||||
|
{
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
return VDxfEngine::FromUnicodeToCodec(fileName, QTextCodec::codecForLocale());
|
||||||
|
#else
|
||||||
|
return fileName.toStdString();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<class P, class V>
|
template<class P, class V>
|
||||||
P *VDxfEngine::CreateAAMAPolygon(const QVector<QPointF> &polygon, const QString &layer, bool forceClosed)
|
P *VDxfEngine::CreateAAMAPolygon(const QVector<QPointF> &polygon, const QString &layer, bool forceClosed)
|
||||||
|
|
|
@ -124,6 +124,9 @@ private:
|
||||||
|
|
||||||
template<class P, class V>
|
template<class P, class V>
|
||||||
Q_REQUIRED_RESULT P *CreateAAMAPolygon(const QVector<QPointF> &polygon, const QString &layer, bool forceClosed);
|
Q_REQUIRED_RESULT P *CreateAAMAPolygon(const QVector<QPointF> &polygon, const QString &layer, bool forceClosed);
|
||||||
|
|
||||||
|
static std::string FromUnicodeToCodec(const QString &str, QTextCodec *codec);
|
||||||
|
std::string getFileNameForLocale() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VDXFENGINE_H
|
#endif // VDXFENGINE_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user