diff --git a/src/app/valentina/dialogs/configpages/preferencespathpage.cpp b/src/app/valentina/dialogs/configpages/preferencespathpage.cpp index 9d9195630..182ab1c35 100644 --- a/src/app/valentina/dialogs/configpages/preferencespathpage.cpp +++ b/src/app/valentina/dialogs/configpages/preferencespathpage.cpp @@ -72,6 +72,7 @@ QStringList PreferencesPathPage::Apply() settings->SetPathLayout(ui->pathTable->item(3, 1)->text()); settings->SetPathTemplate(ui->pathTable->item(4, 1)->text()); settings->SetPathLabelTemplate(ui->pathTable->item(5, 1)->text()); + settings->SetPathManualLayouts(ui->pathTable->item(6, 1)->text()); return QStringList(); // No changes those require restart. } @@ -118,6 +119,9 @@ void PreferencesPathPage::DefaultPath() case 5: // label templates path = VCommonSettings::GetDefPathLabelTemplate(); break; + case 6: // manual layouts + path = VCommonSettings::GetDefPathManualLayouts(); + break; default: break; } @@ -155,6 +159,9 @@ void PreferencesPathPage::EditPath() case 5: // label templates path = qApp->ValentinaSettings()->GetPathLabelTemplate(); break; + case 6: // manual layouts + path = qApp->ValentinaSettings()->GetPathManualLayouts(); + break; default: break; } @@ -196,7 +203,7 @@ void PreferencesPathPage::EditPath() void PreferencesPathPage::InitTable() { ui->pathTable->clearContents(); - ui->pathTable->setRowCount(6); + ui->pathTable->setRowCount(7); ui->pathTable->setColumnCount(2); const VSettings *settings = qApp->ValentinaSettings(); @@ -243,6 +250,13 @@ void PreferencesPathPage::InitTable() ui->pathTable->setItem(5, 1, item); } + { + ui->pathTable->setItem(6, 0, new QTableWidgetItem(tr("My manual layouts"))); + QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathManualLayouts()); + item->setToolTip(settings->GetPathManualLayouts()); + ui->pathTable->setItem(6, 1, item); + } + ui->pathTable->verticalHeader()->setDefaultSectionSize(20); ui->pathTable->resizeColumnsToContents(); ui->pathTable->resizeRowsToContents(); diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 5a4bfa8b4..c394aafcf 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -54,6 +54,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsMultisizeMeasurements, (QLa 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"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsManualLayouts, (QLatin1String("paths/manualLayouts"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationOsSeparator, (QLatin1String("configuration/osSeparator"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveState, (QLatin1String("configuration/autosave/state"))) @@ -425,6 +426,24 @@ void VCommonSettings::SetPathLabelTemplate(const QString &value) setValue(*settingPathsLabelTemplate, value); } +//--------------------------------------------------------------------------------------------------------------------- +QString VCommonSettings::GetDefPathManualLayouts() +{ + return QDir::homePath() + QLatin1String("/valentina/") + tr("manual layouts"); +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VCommonSettings::GetPathManualLayouts() const +{ + return value(*settingPathsManualLayouts, GetDefPathManualLayouts()).toString(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VCommonSettings::SetPathManualLayouts(const QString &value) +{ + setValue(*settingPathsManualLayouts, value); +} + //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::GetOsSeparator() const { diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index 26f5acd17..c8ff8bba9 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -75,6 +75,10 @@ public: QString GetPathLabelTemplate() const; void SetPathLabelTemplate(const QString &value); + static QString GetDefPathManualLayouts(); + QString GetPathManualLayouts() const; + void SetPathManualLayouts(const QString &value); + bool GetOsSeparator() const; void SetOsSeparator(const bool &value);