Default path to known measurements.

This commit is contained in:
Roman Telezhynskyi 2023-10-26 12:05:45 +03:00
parent e1f6b8d219
commit 45999c10c1
11 changed files with 475 additions and 80 deletions

View file

@ -0,0 +1,171 @@
/************************************************************************
**
** @file tapepreferencespathpage.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://gitlab.com/smart-pattern/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#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();
}

View file

@ -0,0 +1,67 @@
/************************************************************************
**
** @file tapepreferencespathpage.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://gitlab.com/smart-pattern/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef TAPEPREFERENCESPATHPAGE_H
#define TAPEPREFERENCESPATHPAGE_H
#include <QWidget>
#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

View file

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TapePreferencesPathPage</class>
<widget class="QWidget" name="TapePreferencesPathPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>370</width>
<height>293</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Paths that Tape uses</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTableWidget" name="pathTable">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Path</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="defaultButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Default</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="editButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -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 <QMessageBox>
#include <QPushButton>
#include <QShowEvent>
#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<int>(preferences.size()))
.arg(preferences.join(QStringLiteral(", ")));
.arg(preferences.join(", "_L1));
QMessageBox::information(this, QCoreApplication::applicationName(), text);
}

View file

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

View file

@ -53,7 +53,7 @@
<enum>QListView::IconMode</enum>
</property>
<property name="currentRow">
<number>0</number>
<number>-1</number>
</property>
<item>
<property name="text">
@ -70,6 +70,21 @@
<set>ItemIsSelectable|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Paths</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
<property name="icon">
<iconset resource="../../../libs/vmisc/share/resources/icon.qrc">
<normaloff>:/icon/path_config.png</normaloff>:/icon/path_config.png</iconset>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
</widget>
</item>
<item>

View file

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

View file

@ -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",

View file

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

View file

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

View file

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