Saving pattern with standard table.
--HG-- branch : feature
This commit is contained in:
parent
69309730ff
commit
17bd0253a2
|
@ -153,6 +153,7 @@ void DialogStandardMeasurements::LoadStandardTables()
|
||||||
filters << "*.vst";
|
filters << "*.vst";
|
||||||
QDir tablesDir(qApp->pathToTables());
|
QDir tablesDir(qApp->pathToTables());
|
||||||
tablesDir.setNameFilters(filters);
|
tablesDir.setNameFilters(filters);
|
||||||
|
tablesDir.setCurrent(qApp->pathToTables());
|
||||||
|
|
||||||
const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files);
|
const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files);
|
||||||
if (allFiles.isEmpty() == true)
|
if (allFiles.isEmpty() == true)
|
||||||
|
@ -164,12 +165,13 @@ void DialogStandardMeasurements::LoadStandardTables()
|
||||||
|
|
||||||
for (int i = 0; i < allFiles.size(); ++i)
|
for (int i = 0; i < allFiles.size(); ++i)
|
||||||
{
|
{
|
||||||
|
QFileInfo fi(allFiles.at(i));
|
||||||
QFile file(allFiles.at(i));
|
QFile file(allFiles.at(i));
|
||||||
if (file.open(QIODevice::ReadOnly))
|
if (file.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VDomDocument::ValidatePattern("://schema/standard_measurements.xsd", allFiles.at(i));
|
VDomDocument::ValidatePattern("://schema/standard_measurements.xsd", fi.absoluteFilePath());
|
||||||
}
|
}
|
||||||
catch(VException &e)
|
catch(VException &e)
|
||||||
{
|
{
|
||||||
|
@ -181,7 +183,7 @@ void DialogStandardMeasurements::LoadStandardTables()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m.setContent(&file);
|
m.setContent(&file);
|
||||||
ui->comboBoxTables->addItem(m.Description(), QVariant(allFiles.at(i)));
|
ui->comboBoxTables->addItem(m.Description(), QVariant(fi.absoluteFilePath()));
|
||||||
}
|
}
|
||||||
catch(VException &e)
|
catch(VException &e)
|
||||||
{
|
{
|
||||||
|
@ -193,7 +195,7 @@ void DialogStandardMeasurements::LoadStandardTables()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<tr("Cannot read file %1:\n%2.").arg(allFiles.at(i)).arg(file.errorString()) << Q_FUNC_INFO;
|
qWarning()<<tr("Cannot read file %1:\n%2.").arg(fi.absoluteFilePath()).arg(file.errorString()) << Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>439</width>
|
<width>452</width>
|
||||||
<height>247</height>
|
<height>115</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -19,11 +19,17 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>206</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Pattern piece name</string>
|
<string>Pattern piece name</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -33,7 +39,14 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEditName"/>
|
<widget class="QLineEdit" name="lineEditName">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
@ -53,7 +66,14 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBoxTables"/>
|
<widget class="QComboBox" name="comboBoxTables">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -115,8 +115,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de"
|
defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de"
|
||||||
QString checkedLocale = settings.value("configuration/locale", defaultLocale).toString();
|
QString checkedLocale = settings.value("configuration/locale", defaultLocale).toString();
|
||||||
|
|
||||||
QString m_langPath = QApplication::applicationDirPath();
|
QString m_langPath = qApp->translationsPath();
|
||||||
m_langPath.append(qApp->translationsPath());
|
|
||||||
QDir dir(m_langPath);
|
QDir dir(m_langPath);
|
||||||
QStringList fileNames = dir.entryList(QStringList("valentina_*.qm"));
|
QStringList fileNames = dir.entryList(QStringList("valentina_*.qm"));
|
||||||
|
|
||||||
|
|
|
@ -84,10 +84,10 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
QTranslator appTranslator;
|
QTranslator appTranslator;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
appTranslator.load("valentina_" + checkedLocale, "."+qApp->translationsPath());
|
appTranslator.load("valentina_" + checkedLocale, qApp->translationsPath());
|
||||||
#else
|
#else
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
appTranslator.load("valentina_" + checkedLocale, "."+qApp->translationsPath());
|
appTranslator.load("valentina_" + checkedLocale, qApp->translationsPath());
|
||||||
#else
|
#else
|
||||||
appTranslator.load("valentina_" + checkedLocale, qApp->translationsPath());
|
appTranslator.load("valentina_" + checkedLocale, qApp->translationsPath());
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -132,10 +132,10 @@ QString VApplication::pathToTables() const
|
||||||
if (_patternType == Pattern::Individual)
|
if (_patternType == Pattern::Individual)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return QStringLiteral("/tables/individual");
|
return QApplication::applicationDirPath() + QStringLiteral("/tables/individual");
|
||||||
#else
|
#else
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
return QStringLiteral("/tables/individual");
|
return QApplication::applicationDirPath() + QStringLiteral("/tables/individual");
|
||||||
#else
|
#else
|
||||||
return QStringLiteral("/usr/share/valentina/tables/individual");
|
return QStringLiteral("/usr/share/valentina/tables/individual");
|
||||||
#endif
|
#endif
|
||||||
|
@ -144,10 +144,10 @@ QString VApplication::pathToTables() const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return QStringLiteral("/tables/standard");
|
return QApplication::applicationDirPath() + QStringLiteral("/tables/standard");
|
||||||
#else
|
#else
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
return QStringLiteral("/tables/standard");
|
return QApplication::applicationDirPath() + QStringLiteral("/tables/standard");
|
||||||
#else
|
#else
|
||||||
return QStringLiteral("/usr/share/valentina/tables/standard");
|
return QStringLiteral("/usr/share/valentina/tables/standard");
|
||||||
#endif
|
#endif
|
||||||
|
@ -158,10 +158,10 @@ QString VApplication::pathToTables() const
|
||||||
QString VApplication::translationsPath() const
|
QString VApplication::translationsPath() const
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return QStringLiteral("/translations");
|
return QApplication::applicationDirPath() + QStringLiteral("/translations");
|
||||||
#else
|
#else
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
return QStringLiteral("/translations");
|
return QApplication::applicationDirPath() + QStringLiteral("/translations");
|
||||||
#else
|
#else
|
||||||
return QStringLiteral("/usr/share/valentina/translations");
|
return QStringLiteral("/usr/share/valentina/translations");
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -201,7 +201,7 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene
|
||||||
if (domElement.isNull() == false)
|
if (domElement.isNull() == false)
|
||||||
{
|
{
|
||||||
QStringList tags;
|
QStringList tags;
|
||||||
tags << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes;
|
tags << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes << TagMeasurements;
|
||||||
switch (tags.indexOf(domElement.tagName()))
|
switch (tags.indexOf(domElement.tagName()))
|
||||||
{
|
{
|
||||||
case 0: // TagDraw
|
case 0: // TagDraw
|
||||||
|
@ -232,6 +232,8 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene
|
||||||
break;
|
break;
|
||||||
case 4: // TagNotes
|
case 4: // TagNotes
|
||||||
break;
|
break;
|
||||||
|
case 5: // TagMeasurements
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Wrong tag name"<<Q_FUNC_INFO;
|
qWarning()<<"Wrong tag name"<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user