2019-03-29 10:31:17 +01:00
|
|
|
|
/************************************************************************
|
2014-11-22 17:15:47 +01:00
|
|
|
|
**
|
|
|
|
|
** @file vsettings.cpp
|
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
|
** @date 22 11, 2014
|
|
|
|
|
**
|
|
|
|
|
** @brief
|
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2014-11-22 17:15:47 +01:00
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2014-11-22 17:15:47 +01:00
|
|
|
|
**
|
|
|
|
|
** 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 "vsettings.h"
|
|
|
|
|
|
|
|
|
|
#include <QDir>
|
2014-11-28 19:33:28 +01:00
|
|
|
|
#include <QLocale>
|
2016-08-08 13:44:49 +02:00
|
|
|
|
#include <QMetaType>
|
2015-11-09 12:33:36 +01:00
|
|
|
|
#include <QPrinter>
|
|
|
|
|
#include <QSharedPointer>
|
2016-08-08 13:44:49 +02:00
|
|
|
|
#include <QStaticStringData>
|
|
|
|
|
#include <QStringData>
|
|
|
|
|
#include <QStringDataPtr>
|
|
|
|
|
#include <QVariant>
|
2016-08-22 18:43:22 +02:00
|
|
|
|
#include <QPrinterInfo>
|
2017-10-10 11:22:59 +02:00
|
|
|
|
#include <QtDebug>
|
2018-03-14 14:39:15 +01:00
|
|
|
|
#include <QGlobalStatic>
|
2014-11-22 17:15:47 +01:00
|
|
|
|
|
2016-08-09 15:55:46 +02:00
|
|
|
|
#include "../vmisc/def.h"
|
2016-08-16 18:57:32 +02:00
|
|
|
|
#include "../vmisc/vmath.h"
|
2019-07-22 16:06:30 +02:00
|
|
|
|
#include "../vlayout/vbank.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
|
|
2015-11-16 13:07:28 +01:00
|
|
|
|
Q_DECLARE_METATYPE(QMarginsF)
|
|
|
|
|
|
2018-05-11 11:42:20 +02:00
|
|
|
|
const int VSettings::defaultScrollingDuration = 300;
|
|
|
|
|
const int VSettings::scrollingDurationMin = 100;
|
|
|
|
|
const int VSettings::scrollingDurationMax = 1000;
|
|
|
|
|
|
|
|
|
|
const int VSettings::defaultScrollingUpdateInterval = 30;
|
|
|
|
|
const int VSettings::scrollingUpdateIntervalMin = 10;
|
|
|
|
|
const int VSettings::scrollingUpdateIntervalMax = 100;
|
|
|
|
|
|
|
|
|
|
const qreal VSettings::defaultSensorMouseScale = 2.0;
|
|
|
|
|
const qreal VSettings::sensorMouseScaleMin = 1.0;
|
|
|
|
|
const qreal VSettings::sensorMouseScaleMax = 10.0;
|
|
|
|
|
|
|
|
|
|
const qreal VSettings::defaultWheelMouseScale = 45.0;
|
|
|
|
|
const qreal VSettings::wheelMouseScaleMin = 1.0;
|
|
|
|
|
const qreal VSettings::wheelMouseScaleMax = 100.0;
|
|
|
|
|
|
|
|
|
|
const qreal VSettings::defaultScrollingAcceleration = 1.3;
|
|
|
|
|
const qreal VSettings::scrollingAccelerationMin = 1.0;
|
|
|
|
|
const qreal VSettings::scrollingAccelerationMax = 10.0;
|
|
|
|
|
|
2017-07-01 19:32:54 +02:00
|
|
|
|
namespace
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
|
|
|
|
|
(QLatin1String("configuration/label_language")))
|
2019-11-28 14:17:27 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutoRefreshPatternMessage,
|
|
|
|
|
(QLatin1String("configuration/autoRefreshPatternMessage")))
|
2020-06-01 11:21:09 +02:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolPanelScaling,
|
|
|
|
|
(QLatin1String("configuration/toolPanelScaling")))
|
2017-04-11 10:16:11 +02:00
|
|
|
|
|
2018-03-14 14:39:15 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLayout, (QLatin1String("paths/layout")))
|
2017-04-11 10:16:11 +02:00
|
|
|
|
|
2018-03-14 14:39:15 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, (QLatin1String("pattern/graphicalOutput")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUseOpenGLRender, (QLatin1String("pattern/useOpenGLRender")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternKnownMaterials, (QLatin1String("pattern/knownMaterials")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternRememberMaterials, (QLatin1String("pattern/rememberMaterials")))
|
2017-04-11 10:16:11 +02:00
|
|
|
|
|
2018-03-14 14:39:15 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWidth, (QLatin1String("layout/width")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSorting, (QLatin1String("layout/sorting")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperHeight, (QLatin1String("layout/paperHeight")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperWidth, (QLatin1String("layout/paperWidth")))
|
2018-12-27 14:54:29 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1String("layout/followGrainline")))
|
2019-07-21 15:26:21 +02:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutManualPriority, (QLatin1String("layout/manualPriority")))
|
2019-07-04 13:33:45 +02:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutNestQuantity, (QLatin1String("layout/nestQuantity")))
|
2019-10-16 10:16:16 +02:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCropLength, (QLatin1String("layout/autoCropLength")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCropWidth, (QLatin1String("layout/autoCropWidth")))
|
2018-03-14 14:39:15 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSaveLength, (QLatin1String("layout/saveLength")))
|
2020-03-22 15:22:03 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPreferOneSheetSolution,
|
|
|
|
|
(QLatin1String("layout/preferOneSheetSolution")))
|
2018-03-14 14:39:15 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnitePages, (QLatin1String("layout/unitePages")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFields, (QLatin1String("layout/fields")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIgnoreFields, (QLatin1String("layout/ignoreFields")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingStripOptimization, (QLatin1String("layout/stripOptimization")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingMultiplier, (QLatin1String("layout/multiplier")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTextAsPaths, (QLatin1String("layout/textAsPaths")))
|
2019-03-29 10:31:17 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingNestingTime, (QLatin1String("layout/time")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingEfficiencyCoefficient, (QLatin1String("layout/efficiencyCoefficient")))
|
2017-10-10 11:22:59 +02:00
|
|
|
|
|
2018-03-14 14:39:15 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFMargins, (QLatin1String("tiledPDF/margins")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperHeight, (QLatin1String("tiledPDF/paperHeight")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperWidth, (QLatin1String("tiledPDF/paperWidth")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFOrientation, (QLatin1String("tiledPDF/orientation")))
|
2018-05-11 11:42:20 +02:00
|
|
|
|
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingDuration, (QLatin1String("scrolling/duration")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval, (QLatin1String("scrolling/updateInterval")))
|
2019-10-28 16:44:31 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingSensorMouseScale,
|
|
|
|
|
(QLatin1String("scrolling/sensorMouseScale")))
|
2018-05-11 11:42:20 +02:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale, (QLatin1String("scrolling/wheelMouseScale")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration, (QLatin1String("scrolling/acceleration")))
|
|
|
|
|
|
2019-10-28 16:44:31 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingdockWidgetGroupsActive, (QLatin1String("dockWidget/groupsActive")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetToolOptionsActive,
|
|
|
|
|
(QLatin1String("dockWidget/toolOptionsActive")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPatternMessagesActive,
|
|
|
|
|
(QLatin1String("dockWidget/patternMessagesActive")))
|
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternMessagesFontSize, (QLatin1String("font/patternMessagesSize")))
|
|
|
|
|
|
2019-12-13 09:51:29 +01:00
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkEditorSize, (QLatin1String("watermarkEditorSize")))
|
|
|
|
|
|
2018-05-11 11:42:20 +02:00
|
|
|
|
// Reading settings file is very expensive, cache values to speed up getting a value
|
|
|
|
|
int scrollingDurationCached = -1;
|
|
|
|
|
int scrollingUpdateIntervalCached = -1;
|
|
|
|
|
qreal scrollingSensorMouseScaleCached = -1;
|
|
|
|
|
qreal scrollingWheelMouseScaleCached = -1;
|
|
|
|
|
qreal scrollingAccelerationCached = -1;
|
2017-07-01 19:32:54 +02:00
|
|
|
|
}
|
2015-05-08 16:24:20 +02:00
|
|
|
|
|
2014-11-22 17:15:47 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
VSettings::VSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
|
|
|
|
QObject *parent)
|
2015-07-15 09:16:59 +02:00
|
|
|
|
:VCommonSettings(format, scope, organization, application, parent)
|
2015-11-09 12:33:36 +01:00
|
|
|
|
{
|
|
|
|
|
qRegisterMetaTypeStreamOperators<QMarginsF>("QMarginsF");
|
|
|
|
|
}
|
2014-11-22 17:15:47 +01:00
|
|
|
|
|
2020-03-07 09:58:18 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
VSettings::VSettings(const QString &fileName, QSettings::Format format, QObject *parent)
|
|
|
|
|
:VCommonSettings(fileName, format, parent)
|
|
|
|
|
{
|
|
|
|
|
qRegisterMetaTypeStreamOperators<QMarginsF>("QMarginsF");
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-22 16:06:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
template <class T>
|
|
|
|
|
inline T VSettings::ValueOrDef(const QString &setting, const T &defValue) const
|
|
|
|
|
{
|
|
|
|
|
const QVariant val = value(setting, QVariant::fromValue(defValue));
|
|
|
|
|
return val.canConvert<T>() ? val.value<T>() : defValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
template <>
|
|
|
|
|
inline Cases VSettings::ValueOrDef<Cases>(const QString &setting, const Cases &defValue) const
|
|
|
|
|
{
|
|
|
|
|
const QVariant val = value(setting, QVariant::fromValue(static_cast<int>(defValue)));
|
|
|
|
|
const int g = val.canConvert<int>() ? val.value<int>() : static_cast<int>(defValue);
|
|
|
|
|
if (g < static_cast<int>(Cases::CaseThreeGroup) || g >= static_cast<int>(Cases::UnknownCase))
|
|
|
|
|
{
|
|
|
|
|
return defValue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return static_cast<Cases>(g);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-22 17:15:47 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
|
QString VSettings::GetLabelLanguage() const
|
2014-11-22 17:15:47 +01:00
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
return value(*settingConfigurationLabelLanguage, QLocale().bcp47Name()).toString();
|
2014-11-22 17:15:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetLabelLanguage(const QString &value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingConfigurationLabelLanguage, value);
|
2014-11-22 17:15:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-17 19:37:49 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
QString VSettings::GetDefPathLayout()
|
|
|
|
|
{
|
2019-07-22 16:06:30 +02:00
|
|
|
|
return QDir::homePath() + QStringLiteral("/valentina/") + tr("layouts");
|
2017-02-17 19:37:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-01-26 15:08:09 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
QString VSettings::GetPathLayout() const
|
|
|
|
|
{
|
2015-10-18 15:13:51 +02:00
|
|
|
|
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
|
2018-03-14 14:39:15 +01:00
|
|
|
|
return settings.value(*settingPathsLayout, GetDefPathLayout()).toString();
|
2015-01-26 15:08:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetPathLayout(const QString &value)
|
|
|
|
|
{
|
2015-10-18 15:13:51 +02:00
|
|
|
|
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
|
2018-03-14 14:39:15 +01:00
|
|
|
|
settings.setValue(*settingPathsLayout, value);
|
2015-10-18 14:38:05 +02:00
|
|
|
|
settings.sync();
|
2015-01-26 15:08:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-22 17:15:47 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-11-28 19:41:46 +01:00
|
|
|
|
bool VSettings::GetGraphicalOutput() const
|
2014-11-22 17:15:47 +01:00
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
return value(*settingPatternGraphicalOutput, 1).toBool();
|
2014-11-22 17:15:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetGraphicalOutput(const bool &value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingPatternGraphicalOutput, value);
|
2014-11-22 17:15:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-10 15:39:37 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::IsOpenGLRender() const
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
return value(*settingPatternUseOpenGLRender, 0).toBool();
|
2018-03-10 15:39:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetOpenGLRender(bool value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingPatternUseOpenGLRender, value);
|
2018-03-10 15:39:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-08 16:24:20 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-11-05 12:07:51 +01:00
|
|
|
|
qreal VSettings::GetLayoutPaperHeight() const
|
2015-05-08 16:24:20 +02:00
|
|
|
|
{
|
2019-03-29 18:50:17 +01:00
|
|
|
|
return ValueOrDef<qreal>(*settingLayoutPaperHeight, UnitConvertor(1189/*A0*/, Unit::Mm, Unit::Px));
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-11-05 12:07:51 +01:00
|
|
|
|
void VSettings::SetLayoutPaperHeight(qreal value)
|
2015-05-08 16:24:20 +02:00
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingLayoutPaperHeight, value);
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-11-05 12:07:51 +01:00
|
|
|
|
qreal VSettings::GetLayoutPaperWidth() const
|
2015-05-08 16:24:20 +02:00
|
|
|
|
{
|
2019-03-29 18:50:17 +01:00
|
|
|
|
return ValueOrDef<qreal>(*settingLayoutPaperWidth, UnitConvertor(841/*A0*/, Unit::Mm, Unit::Px));
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-11-05 12:07:51 +01:00
|
|
|
|
void VSettings::SetLayoutPaperWidth(qreal value)
|
2015-05-08 16:24:20 +02:00
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingLayoutPaperWidth, value);
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-03-29 10:31:17 +01:00
|
|
|
|
qreal VSettings::GetLayoutWidth() const
|
2015-05-08 16:24:20 +02:00
|
|
|
|
{
|
2019-03-29 18:50:17 +01:00
|
|
|
|
return ValueOrDef<qreal>(*settingLayoutWidth, GetDefLayoutWidth());
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-03-29 10:31:17 +01:00
|
|
|
|
qreal VSettings::GetDefLayoutWidth()
|
2015-05-08 16:24:20 +02:00
|
|
|
|
{
|
2019-03-29 10:31:17 +01:00
|
|
|
|
return UnitConvertor(2.5, Unit::Mm, Unit::Px);
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-03-29 10:31:17 +01:00
|
|
|
|
void VSettings::SetLayoutWidth(qreal value)
|
2015-05-08 16:24:20 +02:00
|
|
|
|
{
|
2019-03-29 10:31:17 +01:00
|
|
|
|
setValue(*settingLayoutWidth, value);
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-03-29 10:31:17 +01:00
|
|
|
|
int VSettings::GetNestingTime() const
|
2015-05-08 16:24:20 +02:00
|
|
|
|
{
|
2019-03-29 18:50:17 +01:00
|
|
|
|
return ValueOrDef<int>(*settingNestingTime, GetDefNestingTime());
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-03-29 10:31:17 +01:00
|
|
|
|
void VSettings::SetNestingTime(int value)
|
2015-05-08 16:24:20 +02:00
|
|
|
|
{
|
2019-03-29 10:31:17 +01:00
|
|
|
|
setValue(*settingNestingTime, value);
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-03-29 10:31:17 +01:00
|
|
|
|
qreal VSettings::GetEfficiencyCoefficient() const
|
2015-05-08 16:24:20 +02:00
|
|
|
|
{
|
2019-03-29 18:50:17 +01:00
|
|
|
|
return ValueOrDef<qreal>(*settingEfficiencyCoefficient, GetDefEfficiencyCoefficient());
|
2019-03-29 10:31:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetEfficiencyCoefficient(qreal value)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingEfficiencyCoefficient, value);
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-11-09 12:33:36 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-09-30 18:33:10 +02:00
|
|
|
|
QMarginsF VSettings::GetFields(const QMarginsF &def) const
|
2015-11-09 12:33:36 +01:00
|
|
|
|
{
|
2019-03-29 18:50:17 +01:00
|
|
|
|
return ValueOrDef<QMarginsF>(*settingFields, def);
|
2015-11-09 12:33:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetFields(const QMarginsF &value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingFields, QVariant::fromValue(value));
|
2015-11-09 12:33:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-08 16:24:20 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
Cases VSettings::GetLayoutGroup() const
|
|
|
|
|
{
|
2019-03-29 18:50:17 +01:00
|
|
|
|
return ValueOrDef<Cases>(*settingLayoutSorting, GetDefLayoutGroup());
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
Cases VSettings::GetDefLayoutGroup()
|
|
|
|
|
{
|
|
|
|
|
return Cases::CaseDesc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetLayoutGroup(const Cases &value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingLayoutSorting, static_cast<int>(value));
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-12-27 14:54:29 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetLayoutFollowGrainline() const
|
|
|
|
|
{
|
|
|
|
|
return value(*settingLayoutFollowGrainline, GetDefLayoutFollowGrainline()).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetDefLayoutFollowGrainline()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetLayoutFollowGrainline(bool value)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingLayoutFollowGrainline, value);
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-21 15:26:21 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetLayoutManualPriority() const
|
|
|
|
|
{
|
|
|
|
|
return value(*settingLayoutManualPriority, GetDefLayoutManualPriority()).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetDefLayoutManualPriority()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetLayoutManualPriority(bool value)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingLayoutManualPriority, value);
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-08 16:24:20 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-07-04 13:33:45 +02:00
|
|
|
|
bool VSettings::GetLayoutNestQuantity() const
|
|
|
|
|
{
|
|
|
|
|
return value(*settingLayoutNestQuantity, GetDefLayoutNestQuantity()).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetDefLayoutNestQuantity()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetLayoutNestQuantity(bool value)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingLayoutNestQuantity, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-10-16 10:16:16 +02:00
|
|
|
|
bool VSettings::GetLayoutAutoCropLength() const
|
2015-05-08 16:24:20 +02:00
|
|
|
|
{
|
2019-10-16 10:16:16 +02:00
|
|
|
|
return value(*settingLayoutAutoCropLength, GetDefLayoutAutoCropLength()).toBool();
|
2015-11-09 12:33:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-10-16 10:16:16 +02:00
|
|
|
|
bool VSettings::GetDefLayoutAutoCropLength()
|
2015-11-09 12:33:36 +01:00
|
|
|
|
{
|
|
|
|
|
return false;
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
2019-10-16 10:16:16 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetLayoutAutoCropLength(bool value)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingLayoutAutoCropLength, value);
|
|
|
|
|
}
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetLayoutAutoCropWidth() const
|
|
|
|
|
{
|
|
|
|
|
return value(*settingLayoutAutoCropWidth, GetDefLayoutAutoCropWidth()).toBool();
|
|
|
|
|
}
|
2015-05-08 16:24:20 +02:00
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-10-16 10:16:16 +02:00
|
|
|
|
bool VSettings::GetDefLayoutAutoCropWidth()
|
2015-05-08 16:24:20 +02:00
|
|
|
|
{
|
2019-10-16 10:16:16 +02:00
|
|
|
|
return false;
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-16 10:16:16 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetLayoutAutoCropWidth(bool value)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingLayoutAutoCropWidth, value);
|
|
|
|
|
}
|
2015-05-08 16:24:20 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetLayoutSaveLength() const
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
return value(*settingLayoutSaveLength, GetDefLayoutSaveLength()).toBool();
|
2015-11-09 12:33:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetDefLayoutSaveLength()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetLayoutSaveLength(bool value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingLayoutSaveLength, value);
|
2015-05-08 16:24:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 15:22:03 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetLayoutPreferOneSheetSolution() const
|
|
|
|
|
{
|
|
|
|
|
return value(*settingLayoutPreferOneSheetSolution, GetDefLayoutPreferOneSheetSolution()).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetDefLayoutPreferOneSheetSolution()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetLayoutPreferOneSheetSolution(bool value)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingLayoutPreferOneSheetSolution, value);
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-18 13:26:37 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetLayoutUnitePages() const
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
return value(*settingLayoutUnitePages, GetDefLayoutUnitePages()).toBool();
|
2015-11-09 12:33:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetDefLayoutUnitePages()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
2015-05-18 13:26:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetLayoutUnitePages(bool value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingLayoutUnitePages, value);
|
2015-05-18 13:26:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-11-09 12:33:36 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetIgnoreAllFields() const
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
return value(*settingIgnoreFields, GetDefIgnoreAllFields()).toBool();
|
2015-11-09 12:33:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetDefIgnoreAllFields()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetIgnoreAllFields(bool value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingIgnoreFields, value);
|
2015-11-09 12:33:36 +01:00
|
|
|
|
}
|
2016-02-23 13:13:10 +01:00
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetStripOptimization() const
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
return value(*settingStripOptimization, GetDefStripOptimization()).toBool();
|
2016-02-23 13:13:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetDefStripOptimization()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetStripOptimization(bool value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingStripOptimization, value);
|
2016-02-23 13:13:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
quint8 VSettings::GetMultiplier() const
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
return static_cast<quint8>(value(*settingMultiplier, GetDefMultiplier()).toUInt());
|
2016-02-23 13:13:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
quint8 VSettings::GetDefMultiplier()
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetMultiplier(quint8 value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingMultiplier, value);
|
2016-02-23 13:13:10 +01:00
|
|
|
|
}
|
2016-08-12 01:22:23 +02:00
|
|
|
|
|
2017-07-01 19:32:54 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetTextAsPaths() const
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
return value(*settingTextAsPaths, GetDefTextAsPaths()).toBool();
|
2017-07-01 19:32:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetDefTextAsPaths()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetTextAsPaths(bool value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingTextAsPaths, value);
|
2017-07-01 19:32:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
2017-08-28 15:03:19 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
QStringList VSettings::GetKnownMaterials() const
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
return value(*settingPatternKnownMaterials, QStringList()).toStringList();
|
2017-08-28 15:03:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetKnownMaterials(const QStringList &list)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingPatternKnownMaterials, list);
|
2017-08-28 15:03:19 +02:00
|
|
|
|
}
|
2017-08-30 06:26:18 +02:00
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::IsRememberPatternMaterials() const
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
return value(*settingPatternRememberMaterials, true).toBool();
|
2017-08-30 06:26:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetRememberPatternMaterials(bool value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingPatternRememberMaterials, value);
|
2017-08-30 06:26:18 +02:00
|
|
|
|
}
|
2017-10-10 11:22:59 +02:00
|
|
|
|
|
|
|
|
|
// settings for the tiled PDFs
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief GetTiledPDFMargins returns the tiled pdf margins in the given unit. When the setting is
|
|
|
|
|
* called for the first time, the 4 default margins are 10mm.
|
2017-10-12 09:35:22 +02:00
|
|
|
|
* @param unit the unit in which are the value. Necessary because we save the values
|
|
|
|
|
* internaly as mm so there is conversion beeing made.
|
|
|
|
|
* @return tiled pdf margins
|
2017-10-10 11:22:59 +02:00
|
|
|
|
*/
|
|
|
|
|
QMarginsF VSettings::GetTiledPDFMargins(const Unit &unit) const
|
|
|
|
|
{
|
|
|
|
|
// default value is 10mm. We save the margins in mm in the setting.
|
2019-03-29 18:50:17 +01:00
|
|
|
|
return UnitConvertor(ValueOrDef<QMarginsF>(*settingTiledPDFMargins, QMarginsF(10, 10, 10, 10)), Unit::Mm, unit);
|
2017-10-10 11:22:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief SetTiledPDFMargins sets the setting tiled pdf margins to the given value.
|
|
|
|
|
* @param value the margins to save
|
|
|
|
|
* @param unit the unit in which are the value. Necessary because we save the values
|
|
|
|
|
* internaly as mm so there is conversion beeing made.
|
|
|
|
|
*/
|
|
|
|
|
void VSettings::SetTiledPDFMargins(const QMarginsF &value, const Unit &unit)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingTiledPDFMargins, QVariant::fromValue(UnitConvertor(value, unit, Unit::Mm)));
|
2017-10-10 11:22:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief GetTiledPDFPaperHeight returns the paper height of tiled pdf in the desired unit.
|
2017-10-12 09:35:22 +02:00
|
|
|
|
* @param unit the unit in which are the value. Necessary because we save the values
|
|
|
|
|
* internaly as mm so there is conversion beeing made.
|
|
|
|
|
* @return tiled pdf paper height
|
2017-10-10 11:22:59 +02:00
|
|
|
|
*/
|
|
|
|
|
qreal VSettings::GetTiledPDFPaperHeight(const Unit &unit) const
|
|
|
|
|
{
|
2019-03-29 18:50:17 +01:00
|
|
|
|
return UnitConvertor(ValueOrDef<qreal>(*settingTiledPDFPaperHeight, 297 /*A4*/), Unit::Mm, unit);
|
2017-10-10 11:22:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief SetTiledPDFPaperHeight sets the tiled pdf paper height
|
2017-10-12 09:35:22 +02:00
|
|
|
|
* @param value in mm
|
2017-10-10 11:22:59 +02:00
|
|
|
|
* @param unit unit of the given value
|
|
|
|
|
*/
|
|
|
|
|
void VSettings::SetTiledPDFPaperHeight(qreal value, const Unit &unit)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingTiledPDFPaperHeight, UnitConvertor(value, unit, Unit::Mm));
|
2017-10-10 11:22:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief GetTiledPDFPaperWidth returns the paper height of tiled pdf in the desired unit.
|
2017-10-12 09:35:22 +02:00
|
|
|
|
* @param unit the unit in which are the value. Necessary because we save the values
|
|
|
|
|
* internaly as mm so there is conversion beeing made.
|
|
|
|
|
* @return tiled pdf paper width
|
2017-10-10 11:22:59 +02:00
|
|
|
|
*/
|
|
|
|
|
qreal VSettings::GetTiledPDFPaperWidth(const Unit &unit) const
|
|
|
|
|
{
|
2019-03-29 18:50:17 +01:00
|
|
|
|
return UnitConvertor(ValueOrDef<qreal>(*settingTiledPDFPaperWidth, 210 /*A4*/), Unit::Mm, unit);
|
2017-10-10 11:22:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief SetTiledPDFPaperWidth sets the tiled pdf paper width
|
|
|
|
|
* @param unit unit of the given value
|
2017-10-12 09:35:22 +02:00
|
|
|
|
* @param value in mm
|
2017-10-10 11:22:59 +02:00
|
|
|
|
*/
|
|
|
|
|
void VSettings::SetTiledPDFPaperWidth(qreal value, const Unit &unit)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingTiledPDFPaperWidth, UnitConvertor(value,unit, Unit::Mm));
|
2017-10-10 11:22:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
PageOrientation VSettings::GetTiledPDFOrientation() const
|
|
|
|
|
{
|
|
|
|
|
bool defaultValue = static_cast<bool>(PageOrientation::Portrait);
|
2018-03-14 14:39:15 +01:00
|
|
|
|
bool result = value(*settingTiledPDFOrientation, defaultValue).toBool();
|
2017-10-10 11:22:59 +02:00
|
|
|
|
return static_cast<PageOrientation>(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetTiledPDFOrientation(PageOrientation value)
|
|
|
|
|
{
|
2018-03-14 14:39:15 +01:00
|
|
|
|
setValue(*settingTiledPDFOrientation, static_cast<bool> (value));
|
2017-10-10 11:22:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-05-11 11:42:20 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
int VSettings::GetScrollingDuration() const
|
|
|
|
|
{
|
|
|
|
|
return GetCachedValue(scrollingDurationCached, *settingScrollingDuration, defaultScrollingDuration,
|
|
|
|
|
scrollingDurationMin, scrollingDurationMax);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetScrollingDuration(int duration)
|
|
|
|
|
{
|
|
|
|
|
scrollingDurationCached = qBound(scrollingDurationMin, duration, scrollingDurationMax);
|
|
|
|
|
setValue(*settingScrollingDuration, scrollingDurationCached);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
int VSettings::GetScrollingUpdateInterval() const
|
|
|
|
|
{
|
|
|
|
|
return GetCachedValue(scrollingUpdateIntervalCached, *settingScrollingUpdateInterval,
|
|
|
|
|
defaultScrollingUpdateInterval, scrollingUpdateIntervalMin, scrollingUpdateIntervalMax);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetScrollingUpdateInterval(int updateInterval)
|
|
|
|
|
{
|
|
|
|
|
scrollingUpdateIntervalCached = qBound(scrollingUpdateIntervalMin, updateInterval, scrollingUpdateIntervalMax);
|
|
|
|
|
setValue(*settingScrollingUpdateInterval, scrollingUpdateIntervalCached);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
qreal VSettings::GetSensorMouseScale() const
|
|
|
|
|
{
|
|
|
|
|
return GetCachedValue(scrollingSensorMouseScaleCached, *settingScrollingSensorMouseScale, defaultSensorMouseScale,
|
|
|
|
|
sensorMouseScaleMin, sensorMouseScaleMax);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetSensorMouseScale(qreal scale)
|
|
|
|
|
{
|
|
|
|
|
scrollingSensorMouseScaleCached = qBound(sensorMouseScaleMin, scale, sensorMouseScaleMax);
|
|
|
|
|
setValue(*settingScrollingSensorMouseScale, scrollingSensorMouseScaleCached);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
qreal VSettings::GetWheelMouseScale() const
|
|
|
|
|
{
|
|
|
|
|
return GetCachedValue(scrollingWheelMouseScaleCached, *settingScrollingWheelMouseScale, defaultWheelMouseScale,
|
|
|
|
|
wheelMouseScaleMin, wheelMouseScaleMax);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetWheelMouseScale(qreal scale)
|
|
|
|
|
{
|
|
|
|
|
scrollingWheelMouseScaleCached = qBound(wheelMouseScaleMin, scale, wheelMouseScaleMax);
|
|
|
|
|
setValue(*settingScrollingWheelMouseScale, scrollingWheelMouseScaleCached);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
qreal VSettings::GetScrollingAcceleration() const
|
|
|
|
|
{
|
|
|
|
|
return GetCachedValue(scrollingAccelerationCached, *settingScrollingAcceleration, defaultScrollingAcceleration,
|
|
|
|
|
scrollingAccelerationMin, scrollingAccelerationMax);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetScrollingAcceleration(qreal acceleration)
|
|
|
|
|
{
|
|
|
|
|
scrollingAccelerationCached = qBound(scrollingAccelerationMin, acceleration, scrollingAccelerationMax);
|
|
|
|
|
setValue(*settingScrollingAcceleration, scrollingAccelerationCached);
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-28 16:44:31 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::IsDockWidgetGroupsActive() const
|
|
|
|
|
{
|
|
|
|
|
return value(*settingdockWidgetGroupsActive, GetDefDockWidgetGroupsActive()).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetDefDockWidgetGroupsActive()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetDockWidgetGroupsActive(bool value)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingdockWidgetGroupsActive, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::IsDockWidgetToolOptionsActive() const
|
|
|
|
|
{
|
|
|
|
|
return value(*settingDockWidgetToolOptionsActive, GetDefDockWidgetToolOptionsActive()).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetDefDockWidgetToolOptionsActive()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetDockWidgetToolOptionsActive(bool value)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingDockWidgetToolOptionsActive, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::IsDockWidgetPatternMessagesActive() const
|
|
|
|
|
{
|
|
|
|
|
return value(*settingDockWidgetPatternMessagesActive, GetDefDockWidgetPatternMessagesActive()).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetDefDockWidgetPatternMessagesActive()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetDockWidgetPatternMessagesActive(bool value)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingDockWidgetPatternMessagesActive, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
int VSettings::GetPatternMessageFontSize(int fontSizeDef) const
|
|
|
|
|
{
|
|
|
|
|
fontSizeDef = qBound(GetDefMinPatternMessageFontSize(), fontSizeDef, GetDefMaxPatternMessageFontSize());
|
|
|
|
|
const int fontSize = value(*settingPatternMessagesFontSize, fontSizeDef).toInt();
|
|
|
|
|
return qBound(GetDefMinPatternMessageFontSize(), fontSize, GetDefMaxPatternMessageFontSize());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
int VSettings::GetDefMinPatternMessageFontSize()
|
|
|
|
|
{
|
|
|
|
|
return 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
int VSettings::GetDefMaxPatternMessageFontSize()
|
|
|
|
|
{
|
|
|
|
|
return 40;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetPatternMessageFontSize(int size)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingPatternMessagesFontSize, qBound(GetDefMinPatternMessageFontSize(), size,
|
2019-11-28 14:17:27 +01:00
|
|
|
|
GetDefMaxPatternMessageFontSize()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetAutoRefreshPatternMessage() const
|
|
|
|
|
{
|
|
|
|
|
return value(*settingAutoRefreshPatternMessage, true).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetAutoRefreshPatternMessage(bool value)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingAutoRefreshPatternMessage, value);
|
2019-10-28 16:44:31 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-12-13 09:51:29 +01:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
QSize VSettings::GetWatermarkEditorSize() const
|
|
|
|
|
{
|
|
|
|
|
return value(*settingWatermarkEditorSize, QSize(0, 0)).toSize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetWatermarkEditorSize(const QSize &sz)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingWatermarkEditorSize, sz);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-01 11:21:09 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool VSettings::GetToolPanelScaling() const
|
|
|
|
|
{
|
|
|
|
|
return value(*settingToolPanelScaling, false).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void VSettings::SetToolPanelScaling(const bool &value)
|
|
|
|
|
{
|
|
|
|
|
setValue(*settingToolPanelScaling, value);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-11 11:42:20 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
template<typename T>
|
|
|
|
|
T VSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const
|
|
|
|
|
{
|
|
|
|
|
if (cache < 0)
|
|
|
|
|
{
|
2019-03-29 18:50:17 +01:00
|
|
|
|
cache = qBound(valueMin, ValueOrDef(setting, defValue), valueMax);
|
2018-05-11 11:42:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return cache;
|
|
|
|
|
}
|