2014-11-22 17:15:47 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vsettings.h
|
|
|
|
** @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
|
2014-11-22 17:15:47 +01:00
|
|
|
** <https://bitbucket.org/dismine/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 VSETTINGS_H
|
|
|
|
#define VSETTINGS_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QSettings>
|
|
|
|
#include <QString>
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
2017-10-10 11:22:59 +02:00
|
|
|
#include "../vmisc/def.h"
|
2015-10-08 20:11:50 +02:00
|
|
|
#include "../vlayout/vbank.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "vcommonsettings.h"
|
|
|
|
|
2016-08-22 18:43:22 +02:00
|
|
|
template <class T> class QSharedPointer;
|
2014-11-22 17:15:47 +01:00
|
|
|
|
2015-12-19 15:38:24 +01:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
|
|
|
|
# include "../vmisc/backport/qmarginsf.h"
|
|
|
|
#else
|
|
|
|
# include <QMargins>
|
|
|
|
#endif
|
2015-11-09 12:33:36 +01:00
|
|
|
|
2015-07-15 09:16:59 +02:00
|
|
|
class VSettings : public VCommonSettings
|
2014-11-22 17:15:47 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
VSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
2017-07-05 18:35:34 +02:00
|
|
|
QObject *parent = nullptr);
|
2014-11-22 17:15:47 +01:00
|
|
|
|
2014-11-28 19:41:46 +01:00
|
|
|
QString GetLabelLanguage() const;
|
2014-11-22 17:15:47 +01:00
|
|
|
void SetLabelLanguage(const QString &value);
|
|
|
|
|
2017-02-17 19:37:49 +01:00
|
|
|
static QString GetDefPathPattern();
|
2014-11-28 19:41:46 +01:00
|
|
|
QString GetPathPattern() const;
|
2014-11-22 17:15:47 +01:00
|
|
|
void SetPathPattern(const QString &value);
|
|
|
|
|
2017-02-17 19:37:49 +01:00
|
|
|
static QString GetDefPathLayout();
|
2015-01-26 15:08:09 +01:00
|
|
|
QString GetPathLayout() const;
|
|
|
|
void SetPathLayout(const QString &value);
|
|
|
|
|
2014-11-28 19:41:46 +01:00
|
|
|
bool GetGraphicalOutput() const;
|
2014-11-22 17:15:47 +01:00
|
|
|
void SetGraphicalOutput(const bool &value);
|
|
|
|
|
2018-03-10 15:39:37 +01:00
|
|
|
bool IsOpenGLRender() const;
|
|
|
|
void SetOpenGLRender(bool value);
|
|
|
|
|
2015-11-09 12:33:36 +01:00
|
|
|
// Layout settings
|
2015-11-05 12:07:51 +01:00
|
|
|
qreal GetLayoutPaperHeight() const;
|
|
|
|
void SetLayoutPaperHeight(qreal value);
|
2015-05-08 16:24:20 +02:00
|
|
|
|
2015-11-05 12:07:51 +01:00
|
|
|
qreal GetLayoutPaperWidth() const;
|
|
|
|
void SetLayoutPaperWidth(qreal value);
|
2015-05-08 16:24:20 +02:00
|
|
|
|
2015-11-05 13:32:47 +01:00
|
|
|
qreal GetLayoutShift() const;
|
2015-11-05 12:07:51 +01:00
|
|
|
static qreal GetDefLayoutShift();
|
2015-11-05 13:32:47 +01:00
|
|
|
void SetLayoutShift(qreal value);
|
2015-05-08 16:24:20 +02:00
|
|
|
|
2015-11-05 13:32:47 +01:00
|
|
|
qreal GetLayoutWidth() const;
|
2015-11-05 12:07:51 +01:00
|
|
|
static qreal GetDefLayoutWidth();
|
2015-11-05 13:32:47 +01:00
|
|
|
void SetLayoutWidth(qreal value);
|
2015-05-08 16:24:20 +02:00
|
|
|
|
2016-09-30 18:33:10 +02:00
|
|
|
QMarginsF GetFields(const QMarginsF &def = QMarginsF()) const;
|
2015-11-09 12:33:36 +01:00
|
|
|
void SetFields(const QMarginsF &value);
|
|
|
|
|
2015-05-08 16:24:20 +02:00
|
|
|
Cases GetLayoutGroup() const;
|
|
|
|
static Cases GetDefLayoutGroup();
|
|
|
|
void SetLayoutGroup(const Cases &value);
|
|
|
|
|
|
|
|
bool GetLayoutRotate() const;
|
|
|
|
static bool GetDefLayoutRotate();
|
|
|
|
void SetLayoutRotate(bool value);
|
|
|
|
|
|
|
|
int GetLayoutRotationIncrease() const;
|
|
|
|
static int GetDefLayoutRotationIncrease();
|
|
|
|
void SetLayoutRotationIncrease(int value);
|
|
|
|
|
|
|
|
bool GetLayoutAutoCrop() const;
|
2015-11-09 12:33:36 +01:00
|
|
|
static bool GetDefLayoutAutoCrop();
|
2015-05-08 16:24:20 +02:00
|
|
|
void SetLayoutAutoCrop(bool value);
|
|
|
|
|
|
|
|
bool GetLayoutSaveLength() const;
|
2015-11-09 12:33:36 +01:00
|
|
|
static bool GetDefLayoutSaveLength();
|
2015-05-08 16:24:20 +02:00
|
|
|
void SetLayoutSaveLength(bool value);
|
|
|
|
|
2015-05-18 13:26:37 +02:00
|
|
|
bool GetLayoutUnitePages() const;
|
2015-11-09 12:33:36 +01:00
|
|
|
static bool GetDefLayoutUnitePages();
|
2015-05-18 13:26:37 +02:00
|
|
|
void SetLayoutUnitePages(bool value);
|
|
|
|
|
2015-11-09 12:33:36 +01:00
|
|
|
bool GetIgnoreAllFields() const;
|
|
|
|
static bool GetDefIgnoreAllFields();
|
|
|
|
void SetIgnoreAllFields(bool value);
|
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
bool GetStripOptimization() const;
|
|
|
|
static bool GetDefStripOptimization();
|
|
|
|
void SetStripOptimization(bool value);
|
|
|
|
|
|
|
|
quint8 GetMultiplier() const;
|
|
|
|
static quint8 GetDefMultiplier();
|
|
|
|
void SetMultiplier(quint8 value);
|
|
|
|
|
2017-07-01 19:32:54 +02:00
|
|
|
bool GetTextAsPaths() const;
|
|
|
|
static bool GetDefTextAsPaths();
|
|
|
|
void SetTextAsPaths(bool value);
|
|
|
|
|
2017-08-28 15:03:19 +02:00
|
|
|
QStringList GetKnownMaterials() const;
|
|
|
|
void SetKnownMaterials(const QStringList &list);
|
|
|
|
|
2017-08-30 06:26:18 +02:00
|
|
|
bool IsRememberPatternMaterials() const;
|
|
|
|
void SetRememberPatternMaterials(bool value);
|
|
|
|
|
2017-10-10 11:22:59 +02:00
|
|
|
// settings for the tiled PDFs
|
|
|
|
QMarginsF GetTiledPDFMargins(const Unit &unit) const;
|
|
|
|
void SetTiledPDFMargins(const QMarginsF &value, const Unit &unit);
|
|
|
|
|
|
|
|
qreal GetTiledPDFPaperHeight(const Unit &unit) const;
|
|
|
|
void SetTiledPDFPaperHeight(qreal value, const Unit &unit);
|
|
|
|
|
|
|
|
qreal GetTiledPDFPaperWidth(const Unit &unit) const;
|
|
|
|
void SetTiledPDFPaperWidth(qreal value, const Unit &unit);
|
|
|
|
|
|
|
|
PageOrientation GetTiledPDFOrientation() const;
|
|
|
|
void SetTiledPDFOrientation(PageOrientation value);
|
|
|
|
|
2018-05-11 11:42:20 +02:00
|
|
|
static const int defaultScrollingDuration;
|
|
|
|
static const int scrollingDurationMin;
|
|
|
|
static const int scrollingDurationMax;
|
|
|
|
int GetScrollingDuration() const;
|
|
|
|
void SetScrollingDuration(int duration);
|
|
|
|
|
|
|
|
static const int defaultScrollingUpdateInterval;
|
|
|
|
static const int scrollingUpdateIntervalMin;
|
|
|
|
static const int scrollingUpdateIntervalMax;
|
|
|
|
int GetScrollingUpdateInterval() const;
|
|
|
|
void SetScrollingUpdateInterval(int updateInterval);
|
|
|
|
|
|
|
|
static const qreal defaultSensorMouseScale;
|
|
|
|
static const qreal sensorMouseScaleMin;
|
|
|
|
static const qreal sensorMouseScaleMax;
|
|
|
|
qreal GetSensorMouseScale() const;
|
|
|
|
void SetSensorMouseScale(qreal scale);
|
|
|
|
|
|
|
|
static const qreal defaultWheelMouseScale;
|
|
|
|
static const qreal wheelMouseScaleMin;
|
|
|
|
static const qreal wheelMouseScaleMax;
|
|
|
|
qreal GetWheelMouseScale() const;
|
|
|
|
void SetWheelMouseScale(qreal scale);
|
|
|
|
|
|
|
|
static const qreal defaultScrollingAcceleration;
|
|
|
|
static const qreal scrollingAccelerationMin;
|
|
|
|
static const qreal scrollingAccelerationMax;
|
|
|
|
qreal GetScrollingAcceleration() const;
|
|
|
|
void SetScrollingAcceleration(qreal acceleration);
|
|
|
|
|
2014-11-22 17:15:47 +01:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VSettings)
|
2018-05-11 11:42:20 +02:00
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
T GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const;
|
2014-11-22 17:15:47 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VSETTINGS_H
|