Fix the tape app importing of measurments from a pattern
When importing measurements from a pattern in the tape app, it defaulted to the templates directory instead of the patterns directory. The patterns directory was set as a setting in the valentina settings (VSettings) instead of the common settings (VCommonSettings). I refactored the the setting into the VCommonSettings and made the tape app use the setting. I was able to confirm that setting a new pattern directory resulted in the same pattern directory being used in both Valentina and tape. --HG-- branch : develop
This commit is contained in:
parent
610538e070
commit
42b00c5c58
|
@ -1410,8 +1410,7 @@ void TMainWindow::ImportFromPattern()
|
||||||
|
|
||||||
const QString filter(tr("Pattern files (*.val)"));
|
const QString filter(tr("Pattern files (*.val)"));
|
||||||
//Use standard path to individual measurements
|
//Use standard path to individual measurements
|
||||||
QString pathTo = qApp->TapeSettings()->GetPathTemplate();
|
QString pathTo = qApp->TapeSettings()->GetPathPattern();
|
||||||
pathTo = VCommonSettings::PrepareStandardTemplates(pathTo);
|
|
||||||
|
|
||||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter);
|
const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter);
|
||||||
if (mPath.isEmpty())
|
if (mPath.isEmpty())
|
||||||
|
|
|
@ -50,6 +50,7 @@ namespace
|
||||||
{
|
{
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsIndividualMeasurements, (QLatin1String("paths/individual_measurements")))
|
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, 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, settingPathsTemplates, (QLatin1String("paths/templates")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLabelTemplate, (QLatin1String("paths/labels")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLabelTemplate, (QLatin1String("paths/labels")))
|
||||||
|
|
||||||
|
@ -353,6 +354,27 @@ void VCommonSettings::SetPathMultisizeMeasurements(const QString &value)
|
||||||
settings.sync();
|
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()
|
QString VCommonSettings::GetDefPathTemplate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,6 +64,10 @@ public:
|
||||||
QString GetPathMultisizeMeasurements() const;
|
QString GetPathMultisizeMeasurements() const;
|
||||||
void SetPathMultisizeMeasurements(const QString &value);
|
void SetPathMultisizeMeasurements(const QString &value);
|
||||||
|
|
||||||
|
static QString GetDefPathPattern();
|
||||||
|
QString GetPathPattern() const;
|
||||||
|
void SetPathPattern(const QString &value);
|
||||||
|
|
||||||
static QString GetDefPathTemplate();
|
static QString GetDefPathTemplate();
|
||||||
QString GetPathTemplate() const;
|
QString GetPathTemplate() const;
|
||||||
void SetPathTemplate(const QString &value);
|
void SetPathTemplate(const QString &value);
|
||||||
|
|
|
@ -71,7 +71,6 @@ namespace
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
|
||||||
(QLatin1String("configuration/label_language")))
|
(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, settingPathsLayout, (QLatin1String("paths/layout")))
|
||||||
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, (QLatin1String("pattern/graphicalOutput")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, (QLatin1String("pattern/graphicalOutput")))
|
||||||
|
@ -135,27 +134,6 @@ void VSettings::SetLabelLanguage(const QString &value)
|
||||||
setValue(*settingConfigurationLabelLanguage, 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()
|
QString VSettings::GetDefPathLayout()
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,10 +57,6 @@ public:
|
||||||
QString GetLabelLanguage() const;
|
QString GetLabelLanguage() const;
|
||||||
void SetLabelLanguage(const QString &value);
|
void SetLabelLanguage(const QString &value);
|
||||||
|
|
||||||
static QString GetDefPathPattern();
|
|
||||||
QString GetPathPattern() const;
|
|
||||||
void SetPathPattern(const QString &value);
|
|
||||||
|
|
||||||
static QString GetDefPathLayout();
|
static QString GetDefPathLayout();
|
||||||
QString GetPathLayout() const;
|
QString GetPathLayout() const;
|
||||||
void SetPathLayout(const QString &value);
|
void SetPathLayout(const QString &value);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user