diff --git a/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp b/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp new file mode 100644 index 000000000..3ab220cd2 --- /dev/null +++ b/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp @@ -0,0 +1,171 @@ +/************************************************************************ + ** + ** @file tapepreferencespathpage.cpp + ** @author Roman Telezhynskyi + ** @date 26 10, 2023 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2023 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#include "tapepreferencespathpage.h" +#include "../../mapplication.h" +#include "../../vtapesettings.h" +#include "ui_tapepreferencespathpage.h" + +//--------------------------------------------------------------------------------------------------------------------- +TapePreferencesPathPage::TapePreferencesPathPage(QWidget *parent) + : QWidget(parent), + ui(new Ui::TapePreferencesPathPage) +{ + ui->setupUi(this); + + InitTable(); + + connect(ui->pathTable, &QTableWidget::itemSelectionChanged, this, + [this]() + { + ui->defaultButton->setEnabled(not ui->pathTable->selectedItems().isEmpty()); + ui->defaultButton->setDefault(false); + + ui->editButton->setEnabled(not ui->pathTable->selectedItems().isEmpty()); + ui->editButton->setDefault(true); + }); + + connect(ui->defaultButton, &QPushButton::clicked, this, &TapePreferencesPathPage::DefaultPath); + connect(ui->editButton, &QPushButton::clicked, this, &TapePreferencesPathPage::EditPath); +} + +//--------------------------------------------------------------------------------------------------------------------- +TapePreferencesPathPage::~TapePreferencesPathPage() +{ + delete ui; +} + +//--------------------------------------------------------------------------------------------------------------------- +auto TapePreferencesPathPage::Apply() -> QStringList +{ + VTapeSettings *settings = MApplication::VApp()->TapeSettings(); + settings->SetPathKnownMeasurements(ui->pathTable->item(0, 1)->text()); + + return {}; // No changes which require restart. +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapePreferencesPathPage::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + { + // retranslate designer form (single inheritance approach) + ui->retranslateUi(this); + InitTable(); + } + // remember to call base class implementation + QWidget::changeEvent(event); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapePreferencesPathPage::DefaultPath() +{ + const int row = ui->pathTable->currentRow(); + QTableWidgetItem *item = ui->pathTable->item(row, 1); + SCASSERT(item != nullptr) + + QString path; + + switch (row) + { + case 0: // known measurements + path = VCommonSettings::GetDefPathKnownMeasurements(); + break; + default: + break; + } + + item->setText(path); + item->setToolTip(path); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapePreferencesPathPage::EditPath() +{ + const int row = ui->pathTable->currentRow(); + QTableWidgetItem *item = ui->pathTable->item(row, 1); + SCASSERT(item != nullptr) + + QString path; + switch (row) + { + case 0: // known measurements + path = MApplication::VApp()->TapeSettings()->GetPathKnownMeasurements(); + break; + default: + break; + } + + bool usedNotExistedDir = false; + QDir directory(path); + if (not directory.exists()) + { + usedNotExistedDir = directory.mkpath(QChar('.')); + } + + const QString dir = QFileDialog::getExistingDirectory( + this, tr("Open Directory"), path, + VAbstractApplication::VApp()->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks)); + if (dir.isEmpty()) + { + if (usedNotExistedDir) + { + QDir(path).rmpath(QChar('.')); + } + DefaultPath(); + return; + } + + item->setText(dir); + item->setToolTip(dir); + + if (usedNotExistedDir) + { + QDir(path).rmpath(QChar('.')); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapePreferencesPathPage::InitTable() +{ + ui->pathTable->clearContents(); + ui->pathTable->setRowCount(1); + ui->pathTable->setColumnCount(2); + + const VTapeSettings *settings = MApplication::VApp()->TapeSettings(); + + { + ui->pathTable->setItem(0, 0, new QTableWidgetItem(tr("My known measurements"))); + auto *item = new QTableWidgetItem(settings->GetPathKnownMeasurements()); + item->setToolTip(settings->GetPathKnownMeasurements()); + ui->pathTable->setItem(0, 1, item); + } + + ui->pathTable->verticalHeader()->setDefaultSectionSize(20); + ui->pathTable->resizeColumnsToContents(); + ui->pathTable->resizeRowsToContents(); +} diff --git a/src/app/tape/dialogs/configpages/tapepreferencespathpage.h b/src/app/tape/dialogs/configpages/tapepreferencespathpage.h new file mode 100644 index 000000000..108782f61 --- /dev/null +++ b/src/app/tape/dialogs/configpages/tapepreferencespathpage.h @@ -0,0 +1,67 @@ +/************************************************************************ + ** + ** @file tapepreferencespathpage.h + ** @author Roman Telezhynskyi + ** @date 26 10, 2023 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2023 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#ifndef TAPEPREFERENCESPATHPAGE_H +#define TAPEPREFERENCESPATHPAGE_H + +#include + +#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) +#include "../vmisc/defglobal.h" +#endif + +namespace Ui +{ +class TapePreferencesPathPage; +} + +class TapePreferencesPathPage : public QWidget +{ + Q_OBJECT // NOLINT + +public: + explicit TapePreferencesPathPage(QWidget *parent = nullptr); + ~TapePreferencesPathPage() override; + + auto Apply() -> QStringList; + +protected: + void changeEvent(QEvent *event) override; + +private slots: + void DefaultPath(); + void EditPath(); + +private: + // cppcheck-suppress unknownMacro + Q_DISABLE_COPY_MOVE(TapePreferencesPathPage) // NOLINT + Ui::TapePreferencesPathPage *ui; + + void InitTable(); +}; + +#endif // TAPEPREFERENCESPATHPAGE_H diff --git a/src/app/tape/dialogs/configpages/tapepreferencespathpage.ui b/src/app/tape/dialogs/configpages/tapepreferencespathpage.ui new file mode 100644 index 000000000..f788df6be --- /dev/null +++ b/src/app/tape/dialogs/configpages/tapepreferencespathpage.ui @@ -0,0 +1,111 @@ + + + TapePreferencesPathPage + + + + 0 + 0 + 370 + 293 + + + + Form + + + + + + Paths that Tape uses + + + + + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + true + + + false + + + + Type + + + + + Path + + + + + + + + + + + + + false + + + + 0 + 0 + + + + Default + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + + 0 + 0 + + + + Edit + + + + + + + + + + diff --git a/src/app/tape/dialogs/dialogtapepreferences.cpp b/src/app/tape/dialogs/dialogtapepreferences.cpp index e374ccf99..ce0077f4d 100644 --- a/src/app/tape/dialogs/dialogtapepreferences.cpp +++ b/src/app/tape/dialogs/dialogtapepreferences.cpp @@ -30,17 +30,25 @@ #include "../mapplication.h" #include "../vtools/dialogs/dialogtoolbox.h" #include "configpages/tapepreferencesconfigurationpage.h" +#include "configpages/tapepreferencespathpage.h" #include "ui_dialogtapepreferences.h" #include #include #include +#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) +#include "../vmisc/compatibility.h" +#endif + +using namespace Qt::Literals::StringLiterals; + //--------------------------------------------------------------------------------------------------------------------- DialogTapePreferences::DialogTapePreferences(QWidget *parent) : QDialog(parent), ui(new Ui::DialogTapePreferences), - m_configurationPage(new TapePreferencesConfigurationPage) + m_configurationPage(new TapePreferencesConfigurationPage), + m_pathPage(new TapePreferencesPathPage) { ui->setupUi(this); @@ -59,6 +67,7 @@ DialogTapePreferences::DialogTapePreferences(QWidget *parent) connect(bApply, &QPushButton::clicked, this, &DialogTapePreferences::Apply); ui->pagesWidget->insertWidget(0, m_configurationPage); + ui->pagesWidget->insertWidget(1, m_pathPage); connect(ui->contentsWidget, &QListWidget::currentItemChanged, this, &DialogTapePreferences::PageChanged); ui->pagesWidget->setCurrentIndex(0); @@ -131,12 +140,13 @@ void DialogTapePreferences::Apply() QStringList preferences; preferences += m_configurationPage->Apply(); + preferences += m_pathPage->Apply(); if (not preferences.isEmpty()) { const QString text = tr("Followed %n option(s) require restart to take effect: %1.", "", static_cast(preferences.size())) - .arg(preferences.join(QStringLiteral(", "))); + .arg(preferences.join(", "_L1)); QMessageBox::information(this, QCoreApplication::applicationName(), text); } diff --git a/src/app/tape/dialogs/dialogtapepreferences.h b/src/app/tape/dialogs/dialogtapepreferences.h index c70fc4b10..09521aa2e 100644 --- a/src/app/tape/dialogs/dialogtapepreferences.h +++ b/src/app/tape/dialogs/dialogtapepreferences.h @@ -41,6 +41,7 @@ class DialogTapePreferences; } class TapePreferencesConfigurationPage; +class TapePreferencesPathPage; class QListWidgetItem; class DialogTapePreferences : public QDialog @@ -68,6 +69,7 @@ private: Ui::DialogTapePreferences *ui; bool m_isInitialized{false}; TapePreferencesConfigurationPage *m_configurationPage; + TapePreferencesPathPage *m_pathPage; }; #endif // DIALOGTAPEPREFERENCES_H diff --git a/src/app/tape/dialogs/dialogtapepreferences.ui b/src/app/tape/dialogs/dialogtapepreferences.ui index d5c3bc33a..3a49faf4c 100644 --- a/src/app/tape/dialogs/dialogtapepreferences.ui +++ b/src/app/tape/dialogs/dialogtapepreferences.ui @@ -53,7 +53,7 @@ QListView::IconMode - 0 + -1 @@ -70,6 +70,21 @@ ItemIsSelectable|ItemIsUserCheckable|ItemIsEnabled + + + Paths + + + AlignCenter + + + + :/icon/path_config.png:/icon/path_config.png + + + ItemIsSelectable|ItemIsEnabled + + diff --git a/src/app/tape/tape.pri b/src/app/tape/tape.pri index 99d6e1a2e..30abca735 100644 --- a/src/app/tape/tape.pri +++ b/src/app/tape/tape.pri @@ -15,6 +15,7 @@ SOURCES += \ $$PWD/vlitepattern.cpp \ $$PWD/dialogs/dialogtapepreferences.cpp \ $$PWD/dialogs/configpages/tapepreferencesconfigurationpage.cpp \ + $$PWD/dialogs/configpages/tapepreferencespathpage.cpp \ $$PWD/vtapesettings.cpp \ $$PWD/dialogs/dialogsetupmultisize.cpp \ $$PWD/vtapeshortcutmanager.cpp @@ -36,6 +37,7 @@ HEADERS += \ $$PWD/vlitepattern.h \ $$PWD/dialogs/dialogtapepreferences.h \ $$PWD/dialogs/configpages/tapepreferencesconfigurationpage.h \ + $$PWD/dialogs/configpages/tapepreferencespathpage.h \ $$PWD/vtapesettings.h \ $$PWD/dialogs/dialogsetupmultisize.h \ $$PWD/vtapeshortcutmanager.h @@ -51,4 +53,5 @@ FORMS += \ $$PWD/dialogs/dialogmdatabase.ui \ $$PWD/dialogs/dialogtapepreferences.ui \ $$PWD/dialogs/configpages/tapepreferencesconfigurationpage.ui \ + $$PWD/dialogs/configpages/tapepreferencespathpage.ui \ $$PWD/dialogs/dialogsetupmultisize.ui diff --git a/src/app/tape/tape.qbs b/src/app/tape/tape.qbs index 70a37f2a6..414bf848b 100644 --- a/src/app/tape/tape.qbs +++ b/src/app/tape/tape.qbs @@ -70,6 +70,9 @@ VToolApp { name: "dialogs" prefix: "dialogs/" files: [ + "configpages/tapepreferencespathpage.cpp", + "configpages/tapepreferencespathpage.h", + "configpages/tapepreferencespathpage.ui", "dialogdimensioncustomnames.cpp", "dialogdimensionlabels.cpp", "dialogmeasurementscsvcolumns.cpp", diff --git a/src/app/valentina/dialogs/configpages/preferencespathpage.cpp b/src/app/valentina/dialogs/configpages/preferencespathpage.cpp index 3dc6d6354..830a4370c 100644 --- a/src/app/valentina/dialogs/configpages/preferencespathpage.cpp +++ b/src/app/valentina/dialogs/configpages/preferencespathpage.cpp @@ -69,6 +69,7 @@ auto PreferencesPathPage::Apply() -> QStringList VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings(); settings->SetPathSVGFonts(ui->pathTable->item(0, 1)->text()); settings->SetPathFontCorrections(ui->pathTable->item(1, 1)->text()); + settings->SetPathKnownMeasurements(ui->pathTable->item(2, 1)->text()); return {}; // No changes which require restart. } @@ -103,6 +104,9 @@ void PreferencesPathPage::DefaultPath() case 1: // font corrections path = VCommonSettings::GetDefPathFontCorrections(); break; + case 2: // known measurements + path = VCommonSettings::GetDefPathKnownMeasurements(); + break; default: break; } @@ -127,6 +131,9 @@ void PreferencesPathPage::EditPath() case 1: // font corrections path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathFontCorrections(); break; + case 2: // known measurements + path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathKnownMeasurements(); + break; default: break; } @@ -164,7 +171,7 @@ void PreferencesPathPage::EditPath() void PreferencesPathPage::InitTable() { ui->pathTable->clearContents(); - ui->pathTable->setRowCount(2); + ui->pathTable->setRowCount(3); ui->pathTable->setColumnCount(2); const VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings(); @@ -183,6 +190,13 @@ void PreferencesPathPage::InitTable() ui->pathTable->setItem(1, 1, item); } + { + ui->pathTable->setItem(2, 0, new QTableWidgetItem(tr("My known measurements"))); + auto *item = new QTableWidgetItem(settings->GetPathKnownMeasurements()); + item->setToolTip(settings->GetPathKnownMeasurements()); + ui->pathTable->setItem(2, 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 c5a717ec6..d568d44f9 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -90,19 +90,17 @@ namespace Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsIndividualMeasurements, ("paths/individual_measurements"_L1)) // NOLINTNEXTLINE Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsMultisizeMeasurements, ("paths/standard_measurements"_L1)) -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsPattern, ("paths/pattern"_L1)) // NOLINT -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsManualLayouts, ("paths/manualLayouts"_L1)) // NOLINT -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsCustomImage, ("paths/customImage"_L1)) // NOLINT -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsSVGFonts, ("paths/svgFonts"_L1)) // NOLINT -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsFontCorrections, ("paths/fontCorrections"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationOsSeparator, ("configuration/osSeparator"_L1)) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsPattern, ("paths/pattern"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsManualLayouts, ("paths/manualLayouts"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsCustomImage, ("paths/customImage"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsSVGFonts, ("paths/svgFonts"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsFontCorrections, ("paths/fontCorrections"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsKnownMeasurements, ("paths/knownMeasurements"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationOsSeparator, ("configuration/osSeparator"_L1)) // NOLINT // NOLINTNEXTLINE Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveState, ("configuration/autosave/state"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveTime, ("configuration/autosave/time"_L1)) -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLocale, ("configuration/locale"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveTime, ("configuration/autosave/time"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLocale, ("configuration/locale"_L1)) // NOLINT // NOLINTNEXTLINE Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationPieceLabelLocale, ("configuration/pieceLabelLocale"_L1)) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPMSystemCode, ("configuration/pmscode"_L1)) // NOLINT @@ -132,15 +130,12 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationInteractiveTools, ( Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDontUseNativeDialog, ("configuration/dontUseNativeDialog"_L1)) -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, ("pattern/undo"_L1)) // NOLINT -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping, ("pattern/forbidFlipping"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForceFlipping, ("pattern/forceFlipping"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSewLineOnDrawing, ("pattern/sewLineOnDrawing"_L1)) -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideMainPath, ("pattern/hideMainPath"_L1)) // NOLINT -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDoublePassmark, ("pattern/doublePassmark"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, ("pattern/undo"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping, ("pattern/forbidFlipping"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForceFlipping, ("pattern/forceFlipping"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSewLineOnDrawing, ("pattern/sewLineOnDrawing"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideMainPath, ("pattern/hideMainPath"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDoublePassmark, ("pattern/doublePassmark"_L1)) // NOLINT // NOLINTNEXTLINE Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternDefaultSeamAllowance, ("pattern/defaultSeamAllowance"_L1)) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFont, ("pattern/labelFont"_L1)) // NOLINT @@ -149,77 +144,56 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelSVGFont, ("pattern/l Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPieceLabelFontPointSize, ("pattern/pieceLabelFontPointSize"_L1)) // NOLINTNEXTLINE Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSingleStrokeOutlineFont, ("pattern/singleStrokeOutlineFont"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSingleLineFonts, ("pattern/singleLineFonts"_L1)) -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLineWidth, ("pattern/lineWidth"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSingleLineFonts, ("pattern/singleLineFonts"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLineWidth, ("pattern/lineWidth"_L1)) // NOLINT // NOLINTNEXTLINE Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternCurveApproximationScale, ("pattern/curveApproximationScale"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowCurveDetails, ("pattern/showCurveDetails"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternPieceShowMainPath, ("pattern/pieceShowMainPath"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFontSize, ("pattern/labelFontSize"_L1)) -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideLabels, ("pattern/hideLabels"_L1)) // NOLINT -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowAccuracyRadius, ("pattern/showAccuracyRadius"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUseOpenGLRender, ("pattern/useOpenGLRender"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, ("pattern/graphicalOutput"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsPatternTranslateFormula, ("pattern/translateFormula"_L1)) -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRecentFileList, ("recentFileList"_L1)) // NOLINT -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRestoreFileList, ("restoreFileList"_L1)) // NOLINT -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralGeometry, ("geometry"_L1)) // NOLINT -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralToolbarsState, ("toolbarsState"_L1)) // NOLINT -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationThemeMode, ("configuration/themeMode"_L1)) -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPreferenceDialogSize, ("preferenceDialogSize"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowCurveDetails, ("pattern/showCurveDetails"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternPieceShowMainPath, ("pattern/pieceShowMainPath"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFontSize, ("pattern/labelFontSize"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideLabels, ("pattern/hideLabels"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowAccuracyRadius, ("pattern/showAccuracyRadius"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUseOpenGLRender, ("pattern/useOpenGLRender"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, ("pattern/graphicalOutput"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsPatternTranslateFormula, ("pattern/translateFormula"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRecentFileList, ("recentFileList"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRestoreFileList, ("restoreFileList"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralGeometry, ("geometry"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralToolbarsState, ("toolbarsState"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationThemeMode, ("configuration/themeMode"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPreferenceDialogSize, ("preferenceDialogSize"_L1)) // NOLINT // NOLINTNEXTLINE Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolSeamAllowanceDialogSize, ("toolSeamAllowanceDialogSize"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize, ("toolIncrementsDialogSize"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize, ("formulaWizardDialogSize"_L1)) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize, ("toolIncrementsDialogSize"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize, ("formulaWizardDialogSize"_L1)) // NOLINT // NOLINTNEXTLINE Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFinalMeasurementsDialogSize, ("finalMeasurementsDialogSize"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSettingsDialogSize, ("layoutSettingsDialogSize"_L1)) -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDialogSplinePathSize, ("splinePathDialogSize"_L1)) // NOLINT -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutomaticallyCheckUpdates, ("automaticallyCheckUpdates"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion, ("lastestSkippedVersion"_L1)) -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDateOfLastRemind, ("dateOfLastRemind"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSettingsDialogSize, ("layoutSettingsDialogSize"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDialogSplinePathSize, ("splinePathDialogSize"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutomaticallyCheckUpdates, ("automaticallyCheckUpdates"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion, ("lastestSkippedVersion"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDateOfLastRemind, ("dateOfLastRemind"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVWithHeader, ("csv/withHeader"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVCodec, ("csv/withCodec"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVSeparator, ("csv/withSeparator"_L1)) // NOLINT -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelDateFormat, ("label/dateFormat"_L1)) // NOLINT -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserDateFormats, ("label/userDateFormats"_L1)) -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelTimeFormat, ("label/timeFormat"_L1)) // NOLINT -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserTimeFormats, ("label/userTimeFormats"_L1)) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelDateFormat, ("label/dateFormat"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserDateFormats, ("label/userDateFormats"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelTimeFormat, ("label/timeFormat"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserTimeFormats, ("label/userTimeFormats"_L1)) // NOLINT -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingDuration, ("scrolling/duration"_L1)) // NOLINT -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval, ("scrolling/updateInterval"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingSensorMouseScale, ("scrolling/sensorMouseScale"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale, ("scrolling/wheelMouseScale"_L1)) -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration, ("scrolling/acceleration"_L1)) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingDuration, ("scrolling/duration"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval, ("scrolling/updateInterval"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingSensorMouseScale, ("scrolling/sensorMouseScale"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale, ("scrolling/wheelMouseScale"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration, ("scrolling/acceleration"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFMargins, ("tiledPDF/margins"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFOrientation, ("tiledPDF/orientation"_L1)) // NOLINT -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkEditorSize, ("watermarkEditorSize"_L1)) // NOLINT -// NOLINTNEXTLINE -Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkCustomColors, ("watermarkCustomColors"_L1)) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkEditorSize, ("watermarkEditorSize"_L1)) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkCustomColors, ("watermarkCustomColors"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsStatistictAskCollect, ("askCollect"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsStatistictCollect, ("collect"_L1)) // NOLINT @@ -389,7 +363,7 @@ void VCommonSettings::SetPathSVGFonts(const QString &value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetDefPathFontCorrections() -> QString { - return QDir::homePath() + QStringLiteral("/valentina/font corrections"); + return QDir::homePath() + "/valentina/font corrections"_L1; } //--------------------------------------------------------------------------------------------------------------------- @@ -407,6 +381,27 @@ void VCommonSettings::SetPathFontCorrections(const QString &value) settings.sync(); } +//--------------------------------------------------------------------------------------------------------------------- +auto VCommonSettings::GetDefPathKnownMeasurements() -> QString +{ + return QDir::homePath() + "/valentina/known measurements"_L1; +} + +//--------------------------------------------------------------------------------------------------------------------- +auto VCommonSettings::GetPathKnownMeasurements() const -> QString +{ + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + return settings.value(*settingPathsKnownMeasurements, GetDefPathKnownMeasurements()).toString(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VCommonSettings::SetPathKnownMeasurements(const QString &value) +{ + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + settings.setValue(*settingPathsKnownMeasurements, value); + settings.sync(); +} + //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetOsSeparator() const -> bool { diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index 96fafe88f..da0e3c7b7 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -85,6 +85,10 @@ public: auto GetPathFontCorrections() const -> QString; void SetPathFontCorrections(const QString &value); + static auto GetDefPathKnownMeasurements() -> QString; + auto GetPathKnownMeasurements() const -> QString; + void SetPathKnownMeasurements(const QString &value); + auto GetOsSeparator() const -> bool; void SetOsSeparator(const bool &value);