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