From 3a675f05528fa38dc87e44f288867e2facb00e8b Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 21 Apr 2020 18:57:11 +0300 Subject: [PATCH] New default folder Manual layouts. --- .../configpages/preferencespathpage.cpp | 16 +++++++++++++++- src/libs/vmisc/vcommonsettings.cpp | 19 +++++++++++++++++++ src/libs/vmisc/vcommonsettings.h | 4 ++++ 3 files changed, 38 insertions(+), 1 deletion(-) 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);