2015-07-15 09:16:59 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
2020-05-23 15:44:44 +02:00
|
|
|
** @file vpsettings.cpp
|
2015-07-15 09:16:59 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2020-05-10 17:32:14 +02:00
|
|
|
** @date 16 2, 2020
|
2015-07-15 09:16:59 +02:00
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2015-07-15 09:16:59 +02:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2020-05-10 17:32:14 +02:00
|
|
|
** Copyright (C) 2020 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2015-07-15 09:16:59 +02: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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
2020-05-23 15:44:44 +02:00
|
|
|
#include "vpsettings.h"
|
2023-02-09 15:43:58 +01:00
|
|
|
#include "../vmisc/compatibility.h"
|
2015-07-18 14:39:33 +02:00
|
|
|
|
2023-10-13 15:17:36 +02:00
|
|
|
#include <QDir>
|
2021-08-21 15:13:56 +02:00
|
|
|
#include <QMarginsF>
|
|
|
|
|
2023-10-07 17:56:39 +02:00
|
|
|
using namespace Qt::Literals::StringLiterals;
|
|
|
|
|
2018-03-14 14:39:15 +01:00
|
|
|
namespace
|
|
|
|
{
|
2023-06-21 09:24:51 +02:00
|
|
|
QT_WARNING_PUSH
|
|
|
|
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
|
|
|
|
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPropertiesActive, ("dockWidget/properties"_L1))
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockPropertiesContentsActive, ("dockWidget/contents"_L1))
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnit, ("layout/unit"_L1)) // NOLINT
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetPaperWidth, ("layout/sheetPaperWidth"_L1))
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetPaperHeight, ("layout/sheetPaperHeight"_L1))
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTilePaperWidth, ("layout/tilePaperWidth"_L1))
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTilePaperHeight, ("layout/tilePaperHeight"_L1))
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetMargins, ("layout/sheetMargins"_L1)) // NOLINT
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileMargins, ("layout/tileMargins"_L1)) // NOLINT
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetIgnoreMargins, ("layout/sheetIgnoreMargins"_L1))
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileIgnoreMargins, ("layout/tileIgnoreMargins"_L1))
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileShowTiles, ("layout/tileShowTiles"_L1)) // NOLINT
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileShowWatermark, ("layout/tileShowWatermark"_L1))
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWarningPiecesSuperposition,
|
2023-10-07 17:56:39 +02:00
|
|
|
("layout/warningPiecesSuperposition"_L1))
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutStickyEdges, ("layout/stickyEdges"_L1)) // NOLINT
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWarningPiecesOutOfBound, ("layout/warningPiecesOutOfBound"_L1))
|
2023-06-21 09:24:51 +02:00
|
|
|
// NOLINTNEXTLINE
|
2023-10-07 17:56:39 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, ("layout/followGrainline"_L1))
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPieceGap, ("layout/pieceGap"_L1)) // NOLINT
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, ("layout/exportFormat"_L1)) // NOLINT
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutLineWidth, ("layout/lineWidth"_L1)) // NOLINT
|
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, ("layout/showGrainline"_L1)) // NOLINT
|
2023-10-13 15:17:36 +02:00
|
|
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsRawLayoutData, ("paths/rawLatoutData"_L1)) // NOLINT
|
2022-02-09 16:49:14 +01:00
|
|
|
|
2023-06-21 09:24:51 +02:00
|
|
|
QT_WARNING_POP
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
int cachedLineWidth = -1; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
2023-06-21 09:24:51 +02:00
|
|
|
} // namespace
|
2021-08-21 15:13:56 +02:00
|
|
|
|
2023-02-21 09:20:39 +01:00
|
|
|
#ifndef QPRINTENGINE_H
|
2023-01-18 16:15:16 +01:00
|
|
|
Q_DECLARE_METATYPE(QMarginsF) // NOLINT
|
|
|
|
#endif
|
|
|
|
|
2015-07-15 09:16:59 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2020-05-23 15:44:44 +02:00
|
|
|
VPSettings::VPSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
2023-06-21 09:24:51 +02:00
|
|
|
QObject *parent)
|
|
|
|
: VCommonSettings(format, scope, organization, application, parent){REGISTER_META_TYPE_STREAM_OPERATORS(QMarginsF)}
|
2020-05-10 17:32:14 +02:00
|
|
|
|
2023-06-21 09:24:51 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VPSettings::VPSettings(const QString &fileName, QSettings::Format format, QObject *parent)
|
|
|
|
: VCommonSettings(fileName, format, parent)
|
2021-08-21 15:13:56 +02:00
|
|
|
{
|
2023-02-09 15:43:58 +01:00
|
|
|
REGISTER_META_TYPE_STREAM_OPERATORS(QMarginsF)
|
2021-08-21 15:13:56 +02:00
|
|
|
}
|
2015-07-18 14:39:33 +02:00
|
|
|
|
2015-08-01 19:09:10 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2021-08-21 15:13:56 +02:00
|
|
|
auto VPSettings::IsDockWidgetPropertiesActive() const -> bool
|
2015-08-01 19:09:10 +02:00
|
|
|
{
|
2020-05-10 17:32:14 +02:00
|
|
|
return value(*settingDockWidgetPropertiesActive, GetDefDockWidgetPropertiesActive()).toBool();
|
2015-08-01 19:09:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2021-08-21 15:13:56 +02:00
|
|
|
auto VPSettings::GetDefDockWidgetPropertiesActive() -> bool
|
2015-08-01 19:09:10 +02:00
|
|
|
{
|
2020-05-10 17:32:14 +02:00
|
|
|
return true;
|
2015-08-01 19:09:10 +02:00
|
|
|
}
|
2015-12-12 12:11:39 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2020-05-23 15:44:44 +02:00
|
|
|
void VPSettings::SetDockWidgetPropertiesActive(bool value)
|
2015-12-12 12:11:39 +01:00
|
|
|
{
|
2020-05-10 17:32:14 +02:00
|
|
|
setValue(*settingDockWidgetPropertiesActive, value);
|
2015-12-12 12:11:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2021-08-21 15:13:56 +02:00
|
|
|
auto VPSettings::IsDockWidgetPropertiesContentsActive() const -> bool
|
2015-12-12 12:11:39 +01:00
|
|
|
{
|
2020-05-10 17:32:14 +02:00
|
|
|
return value(*settingDockWidgetPropertiesActive, GetDefDockWidgetPropertiesActive()).toBool();
|
2015-12-12 12:11:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2021-08-21 15:13:56 +02:00
|
|
|
auto VPSettings::GetDefDockWidgetPropertiesContentsActive() -> bool
|
2015-12-12 12:11:39 +01:00
|
|
|
{
|
2020-05-10 17:32:14 +02:00
|
|
|
return true;
|
2015-12-12 12:11:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2020-05-23 15:44:44 +02:00
|
|
|
void VPSettings::SetDockWidgetPropertiesContentsActive(bool value)
|
2015-12-12 12:11:39 +01:00
|
|
|
{
|
2020-05-10 17:32:14 +02:00
|
|
|
setValue(*settingDockPropertiesContentsActive, value);
|
2015-12-12 12:11:39 +01:00
|
|
|
}
|
2021-08-21 15:13:56 +02:00
|
|
|
|
2023-10-13 15:17:36 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetPathRawLayoutData() const -> QString
|
|
|
|
{
|
|
|
|
return value(*settingPathsRawLayoutData, QDir::homePath()).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetPathRawLayoutData(const QString &value)
|
|
|
|
{
|
|
|
|
setValue(*settingPathsRawLayoutData, value);
|
|
|
|
}
|
|
|
|
|
2021-08-21 15:13:56 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutUnit(Unit unit)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutUnit, UnitsToStr(unit));
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::LayoutUnit() const -> Unit
|
|
|
|
{
|
|
|
|
return StrToUnits(value(*settingLayoutUnit, QString()).toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutSheetPaperWidth(qreal width)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutSheetPaperWidth, width);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutSheetPaperWidth() const -> qreal
|
|
|
|
{
|
2023-06-21 09:24:51 +02:00
|
|
|
return ValueOrDef<qreal>(*this, *settingLayoutSheetPaperWidth, UnitConvertor(841 /*A0*/, Unit::Mm, Unit::Px));
|
2021-08-21 15:13:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutSheetPaperHeight(qreal height)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutSheetPaperHeight, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutSheetPaperHeight() const -> qreal
|
|
|
|
{
|
2023-06-21 09:24:51 +02:00
|
|
|
return ValueOrDef<qreal>(*this, *settingLayoutSheetPaperHeight, UnitConvertor(1189 /*A0*/, Unit::Mm, Unit::Px));
|
2021-08-21 15:13:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutTilePaperWidth(qreal width)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutTilePaperWidth, width);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutTilePaperWidth() const -> qreal
|
|
|
|
{
|
2023-06-21 09:24:51 +02:00
|
|
|
return ValueOrDef<qreal>(*this, *settingLayoutTilePaperWidth, UnitConvertor(210 /*A4*/, Unit::Mm, Unit::Px));
|
2021-08-21 15:13:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutTilePaperHeight(qreal height)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutTilePaperHeight, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutTilePaperHeight() const -> qreal
|
|
|
|
{
|
2023-06-21 09:24:51 +02:00
|
|
|
return ValueOrDef<qreal>(*this, *settingLayoutTilePaperHeight, UnitConvertor(297 /*A4*/, Unit::Mm, Unit::Px));
|
2021-08-21 15:13:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutSheetMargins(const QMarginsF &margins)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutSheetMargins, QVariant::fromValue(margins));
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutSheetMargins() const -> QMarginsF
|
|
|
|
{
|
|
|
|
return ValueOrDef<QMarginsF>(*this, *settingLayoutSheetMargins, QMarginsF());
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutTileMargins(const QMarginsF &margins)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutTileMargins, QVariant::fromValue(margins));
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutTileMargins() const -> QMarginsF
|
|
|
|
{
|
|
|
|
return ValueOrDef<QMarginsF>(*this, *settingLayoutTileMargins, QMarginsF());
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutSheetIgnoreMargins(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutSheetIgnoreMargins, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutSheetIgnoreMargins() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingLayoutSheetIgnoreMargins, false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutTileIgnoreMargins(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutTileIgnoreMargins, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutTileIgnoreMargins() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingLayoutTileIgnoreMargins, false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutTileShowTiles(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutTileShowTiles, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutTileShowTiles() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingLayoutTileShowTiles, true).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2021-09-11 18:39:38 +02:00
|
|
|
void VPSettings::SetLayoutTileShowWatermark(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutTileShowWatermark, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutTileShowWatermark() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingLayoutTileShowWatermark, false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2021-08-21 15:13:56 +02:00
|
|
|
void VPSettings::SetLayoutWarningPiecesSuperposition(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutWarningPiecesSuperposition, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutWarningPiecesSuperposition() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingLayoutWarningPiecesSuperposition, true).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutStickyEdges(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutStickyEdges, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutStickyEdges() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingLayoutStickyEdges, true).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutWarningPiecesOutOfBound(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutWarningPiecesOutOfBound, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutWarningPiecesOutOfBound() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingLayoutWarningPiecesOutOfBound, true).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutFollowGrainline(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutFollowGrainline, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutFollowGrainline() const -> bool
|
|
|
|
{
|
|
|
|
return value(*settingLayoutFollowGrainline, false).toBool();
|
|
|
|
}
|
|
|
|
|
2021-08-25 15:58:50 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2023-05-03 13:07:02 +02:00
|
|
|
auto VPSettings::GetMaxLayoutPieceGap() -> qreal
|
2021-08-25 15:58:50 +02:00
|
|
|
{
|
|
|
|
return UnitConvertor(50, Unit::Cm, Unit::Px);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2021-08-21 15:13:56 +02:00
|
|
|
void VPSettings::SetLayoutPieceGap(qreal value)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutPieceGap, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutPieceGap() const -> qreal
|
|
|
|
{
|
|
|
|
return ValueOrDef<qreal>(*this, *settingLayoutPieceGap, UnitConvertor(5, Unit::Mm, Unit::Px));
|
|
|
|
}
|
2021-09-06 14:31:19 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2023-05-03 13:07:02 +02:00
|
|
|
auto VPSettings::GetLayoutExportFormat() const -> qint8
|
2021-09-06 14:31:19 +02:00
|
|
|
{
|
2023-05-03 15:23:54 +02:00
|
|
|
return CastToLayoutExportFormat(qvariant_cast<qint8>(value(*settingLayoutExportFormat, 0)));
|
2021-09-06 14:31:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutExportFormat(qint8 format)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutExportFormat, format);
|
|
|
|
}
|
2022-02-09 16:49:14 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
auto VPSettings::GetLayoutLineWidth() const -> int
|
|
|
|
{
|
|
|
|
if (cachedLineWidth == -1)
|
|
|
|
{
|
2022-02-10 15:43:22 +01:00
|
|
|
cachedLineWidth = qvariant_cast<int>(value(*settingLayoutLineWidth, 3));
|
2022-02-09 16:49:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return cachedLineWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetLayoutLineWidth(int width)
|
|
|
|
{
|
|
|
|
cachedLineWidth = qBound(1, width, 10);
|
|
|
|
setValue(*settingLayoutLineWidth, cachedLineWidth);
|
|
|
|
}
|
2023-04-10 11:20:18 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2023-05-03 13:07:02 +02:00
|
|
|
auto VPSettings::GetShowGrainline() const -> bool
|
2023-04-10 11:20:18 +02:00
|
|
|
{
|
|
|
|
return value(*settingLayoutShowGrainline, true).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VPSettings::SetShowGrainline(bool value)
|
|
|
|
{
|
|
|
|
setValue(*settingLayoutShowGrainline, value);
|
|
|
|
}
|