New default folder Manual layouts.

This commit is contained in:
Roman Telezhynskyi 2020-04-21 18:57:11 +03:00
parent adb6419670
commit 3a675f0552
3 changed files with 38 additions and 1 deletions

View File

@ -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();

View File

@ -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
{

View File

@ -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);