diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index dd5f6d6e4..fe31e7478 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -1410,8 +1410,7 @@ void TMainWindow::ImportFromPattern() const QString filter(tr("Pattern files (*.val)")); //Use standard path to individual measurements - QString pathTo = qApp->TapeSettings()->GetPathTemplate(); - pathTo = VCommonSettings::PrepareStandardTemplates(pathTo); + QString pathTo = qApp->TapeSettings()->GetPathPattern(); const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter); if (mPath.isEmpty()) diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 8491f9e20..e8dc58228 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -50,6 +50,7 @@ namespace { Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsIndividualMeasurements, (QLatin1String("paths/individual_measurements"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsMultisizeMeasurements, (QLatin1String("paths/standard_measurements"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsPattern, (QLatin1String("paths/pattern"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsTemplates, (QLatin1String("paths/templates"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLabelTemplate, (QLatin1String("paths/labels"))) @@ -353,6 +354,27 @@ void VCommonSettings::SetPathMultisizeMeasurements(const QString &value) settings.sync(); } +//--------------------------------------------------------------------------------------------------------------------- +QString VCommonSettings::GetDefPathPattern() +{ + return QDir::homePath() + QLatin1String("/valentina/") + tr("patterns"); +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VCommonSettings::GetPathPattern() const +{ + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + return settings.value(*settingPathsPattern, GetDefPathPattern()).toString(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VCommonSettings::SetPathPattern(const QString &value) +{ + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + settings.setValue(*settingPathsPattern, value); + settings.sync(); +} + //--------------------------------------------------------------------------------------------------------------------- QString VCommonSettings::GetDefPathTemplate() { diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index f36138377..e52ca427a 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -64,6 +64,10 @@ public: QString GetPathMultisizeMeasurements() const; void SetPathMultisizeMeasurements(const QString &value); + static QString GetDefPathPattern(); + QString GetPathPattern() const; + void SetPathPattern(const QString &value); + static QString GetDefPathTemplate(); QString GetPathTemplate() const; void SetPathTemplate(const QString &value); diff --git a/src/libs/vmisc/vsettings.cpp b/src/libs/vmisc/vsettings.cpp index 548672818..ff8febcf7 100644 --- a/src/libs/vmisc/vsettings.cpp +++ b/src/libs/vmisc/vsettings.cpp @@ -71,7 +71,6 @@ namespace Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage, (QLatin1String("configuration/label_language"))) -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsPattern, (QLatin1String("paths/pattern"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLayout, (QLatin1String("paths/layout"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, (QLatin1String("pattern/graphicalOutput"))) @@ -135,27 +134,6 @@ void VSettings::SetLabelLanguage(const QString &value) setValue(*settingConfigurationLabelLanguage, value); } -//--------------------------------------------------------------------------------------------------------------------- -QString VSettings::GetDefPathPattern() -{ - return QDir::homePath() + QLatin1String("/valentina/") + tr("patterns"); -} - -//--------------------------------------------------------------------------------------------------------------------- -QString VSettings::GetPathPattern() const -{ - QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); - return settings.value(*settingPathsPattern, GetDefPathPattern()).toString(); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VSettings::SetPathPattern(const QString &value) -{ - QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); - settings.setValue(*settingPathsPattern, value); - settings.sync(); -} - //--------------------------------------------------------------------------------------------------------------------- QString VSettings::GetDefPathLayout() { diff --git a/src/libs/vmisc/vsettings.h b/src/libs/vmisc/vsettings.h index 66385f899..3d4977cd1 100644 --- a/src/libs/vmisc/vsettings.h +++ b/src/libs/vmisc/vsettings.h @@ -57,10 +57,6 @@ public: QString GetLabelLanguage() const; void SetLabelLanguage(const QString &value); - static QString GetDefPathPattern(); - QString GetPathPattern() const; - void SetPathPattern(const QString &value); - static QString GetDefPathLayout(); QString GetPathLayout() const; void SetPathLayout(const QString &value);