Merge remote-tracking branch 'upstream/feature/manual-layout' into feature/manual-layout
This commit is contained in:
commit
e2cfe7d0cc
|
@ -47,6 +47,7 @@
|
|||
- Setting scale factor for export and print.
|
||||
- New layout generator option: Prefer one sheet solution.
|
||||
- [smart-pattern/valentina#15] Organization of groups - groups categories
|
||||
- Improve the property browser. Show full arc name.
|
||||
|
||||
# Version 0.6.2 (unreleased)
|
||||
- [#903] Bug in tool Cut Spline path.
|
||||
|
|
|
@ -14,10 +14,10 @@ SOURCES += \
|
|||
$$PWD/vpuzzlegraphicspiece.cpp \
|
||||
$$PWD/vpuzzlelayout.cpp \
|
||||
$$PWD/vpuzzlelayer.cpp \
|
||||
$$PWD/vpuzzlemaingraphicsscene.cpp \
|
||||
$$PWD/vpuzzlemaingraphicsview.cpp \
|
||||
$$PWD/vpuzzlemimedatapiece.cpp \
|
||||
$$PWD/vpuzzlepiece.cpp \
|
||||
$$PWD/vpuzzlesettings.cpp \
|
||||
$$PWD/xml/layoutliterals.cpp \
|
||||
$$PWD/xml/vpuzzlelayoutfilewriter.cpp \
|
||||
$$PWD/xml/vpuzzlelayoutfilereader.cpp \
|
||||
|
@ -39,10 +39,10 @@ HEADERS += \
|
|||
$$PWD/vpuzzlegraphicspiece.h \
|
||||
$$PWD/vpuzzlelayout.h \
|
||||
$$PWD/vpuzzlelayer.h \
|
||||
$$PWD/vpuzzlemaingraphicsscene.h \
|
||||
$$PWD/vpuzzlemaingraphicsview.h \
|
||||
$$PWD/vpuzzlemimedatapiece.h \
|
||||
$$PWD/vpuzzlepiece.h \
|
||||
$$PWD/vpuzzlesettings.h \
|
||||
$$PWD/xml/layoutliterals.h \
|
||||
$$PWD/xml/vpuzzlelayoutfilewriter.h \
|
||||
$$PWD/xml/vpuzzlelayoutfilereader.h \
|
||||
|
@ -51,4 +51,5 @@ HEADERS += \
|
|||
|
||||
FORMS += \
|
||||
$$PWD/puzzlemainwindow.ui \
|
||||
$$PWD/dialogs/dialogaboutpuzzle.ui
|
||||
$$PWD/dialogs/dialogaboutpuzzle.ui \
|
||||
$$PWD/vpiececarrousel.ui
|
||||
|
|
|
@ -197,14 +197,14 @@ noRunPath{ # For enable run qmake with CONFIG+=noRunPath
|
|||
#win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vtools/$${DESTDIR}/vtools.lib
|
||||
#else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vtools/$${DESTDIR}/libvtools.a
|
||||
|
||||
##VWidgets static library
|
||||
#unix|win32: LIBS += -L$$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/ -lvwidgets
|
||||
#VWidgets static library
|
||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/ -lvwidgets
|
||||
|
||||
#INCLUDEPATH += $$PWD/../../libs/vwidgets
|
||||
#DEPENDPATH += $$PWD/../../libs/vwidgets
|
||||
INCLUDEPATH += $$PWD/../../libs/vwidgets
|
||||
DEPENDPATH += $$PWD/../../libs/vwidgets
|
||||
|
||||
#win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/vwidgets.lib
|
||||
#else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/libvwidgets.a
|
||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/vwidgets.lib
|
||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/libvwidgets.a
|
||||
|
||||
## VFormat static library (depend on VPatternDB, IFC)
|
||||
#unix|win32: LIBS += -L$$OUT_PWD/../../libs/vformat/$${DESTDIR}/ -lvformat
|
||||
|
@ -277,13 +277,13 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser
|
|||
INCLUDEPATH += $${PWD}/../../libs/qmuparser
|
||||
DEPENDPATH += $${PWD}/../../libs/qmuparser
|
||||
|
||||
## VPropertyExplorer library
|
||||
#win32:CONFIG(release, debug|release): LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
||||
#else:win32:CONFIG(debug, debug|release): LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
||||
#else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
||||
# VPropertyExplorer library
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
||||
else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
||||
|
||||
#INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
|
||||
#DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
|
||||
INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
|
||||
DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
|
||||
|
||||
contains(DEFINES, APPIMAGE) {
|
||||
unix:!macx: LIBS += -licudata -licui18n -licuuc
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#define PUZZLEAPPLICATION_H
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/vpuzzlesettings.h"
|
||||
#include "vpuzzlesettings.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "vpuzzlecommandline.h"
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "puzzleapplication.h"
|
||||
#include "../vlayout/vrawlayout.h"
|
||||
#include "../vmisc/vsysexits.h"
|
||||
#include "../vmisc/projectversion.h"
|
||||
#include "../ifc/xml/vlayoutconverter.h"
|
||||
#include "../ifc/exception/vexception.h"
|
||||
|
||||
|
@ -75,6 +76,8 @@ PuzzleMainWindow::PuzzleMainWindow(const VPuzzleCommandLinePtr &cmd, QWidget *pa
|
|||
|
||||
|
||||
SetPropertiesData();
|
||||
|
||||
ReadSettings();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -370,8 +373,10 @@ void PuzzleMainWindow::SetPropertyTabCurrentPieceData()
|
|||
ui->checkBoxCurrentPieceMirrorPiece->setChecked(selectedPiece->GetPieceMirrored());
|
||||
|
||||
QPointF pos = selectedPiece->GetPosition();
|
||||
SetDoubleSpinBoxValue(ui->doubleSpinBoxCurrentPieceBoxPositionX, UnitConvertor(pos.x(), Unit::Px, m_layout->GetUnit()));
|
||||
SetDoubleSpinBoxValue(ui->doubleSpinBoxCurrentPieceBoxPositionY, UnitConvertor(pos.y(), Unit::Px, m_layout->GetUnit()));
|
||||
SetDoubleSpinBoxValue(ui->doubleSpinBoxCurrentPieceBoxPositionX,
|
||||
UnitConvertor(pos.x(), Unit::Px, m_layout->GetUnit()));
|
||||
SetDoubleSpinBoxValue(ui->doubleSpinBoxCurrentPieceBoxPositionY,
|
||||
UnitConvertor(pos.y(), Unit::Px, m_layout->GetUnit()));
|
||||
|
||||
qreal angle = selectedPiece->GetRotation();
|
||||
SetDoubleSpinBoxValue(ui->doubleSpinBoxCurrentPieceAngle, angle);
|
||||
|
@ -469,7 +474,98 @@ void PuzzleMainWindow::SetCheckBoxValue(QCheckBox *checkbox, bool value)
|
|||
checkbox->blockSignals(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PuzzleMainWindow::ReadSettings()
|
||||
{
|
||||
qCDebug(pWindow, "Reading settings.");
|
||||
const VPuzzleSettings *settings = qApp->PuzzleSettings();
|
||||
|
||||
if (settings->status() == QSettings::NoError)
|
||||
{
|
||||
restoreGeometry(settings->GetGeometry());
|
||||
restoreState(settings->GetWindowState());
|
||||
restoreState(settings->GetToolbarsState(), APP_VERSION);
|
||||
|
||||
ui->dockWidgetProperties->setVisible(settings->IsDockWidgetPropertiesActive());
|
||||
ui->dockWidgetPropertiesContents->setVisible(settings->IsDockWidgetPropertiesContentsActive());
|
||||
|
||||
// Scene antialiasing
|
||||
m_graphicsView->SetAntialiasing(settings->GetGraphicalOutput());
|
||||
|
||||
// Stack limit
|
||||
// qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << tr("Cannot read settings from a malformed .INI file.");
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PuzzleMainWindow::WriteSettings()
|
||||
{
|
||||
VPuzzleSettings *settings = qApp->PuzzleSettings();
|
||||
settings->SetGeometry(saveGeometry());
|
||||
settings->SetWindowState(saveState());
|
||||
settings->SetToolbarsState(saveState(APP_VERSION));
|
||||
|
||||
settings->SetDockWidgetPropertiesActive(ui->dockWidgetProperties->isEnabled());
|
||||
settings->SetDockWidgetPropertiesContentsActive(ui->dockWidgetPropertiesContents->isEnabled());
|
||||
|
||||
settings->sync();
|
||||
if (settings->status() == QSettings::AccessError)
|
||||
{
|
||||
qWarning() << tr("Cannot save settings. Access denied.");
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool PuzzleMainWindow::MaybeSave()
|
||||
{
|
||||
// TODO: Implement maybe save check
|
||||
// if (this->isWindowModified())
|
||||
// {
|
||||
// if (curFile.isEmpty() && ui->tableWidget->rowCount() == 0)
|
||||
// {
|
||||
// return true;// Don't ask if file was created without modifications.
|
||||
// }
|
||||
|
||||
// QScopedPointer<QMessageBox> messageBox(new QMessageBox(tr("Unsaved changes"),
|
||||
// tr("Measurements have been modified.\n"
|
||||
// "Do you want to save your changes?"),
|
||||
// QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No,
|
||||
// QMessageBox::Cancel, this, Qt::Sheet));
|
||||
|
||||
// messageBox->setDefaultButton(QMessageBox::Yes);
|
||||
// messageBox->setEscapeButton(QMessageBox::Cancel);
|
||||
|
||||
// messageBox->setButtonText(QMessageBox::Yes, curFile.isEmpty() || mIsReadOnly ? tr("Save…") : tr("Save"));
|
||||
// messageBox->setButtonText(QMessageBox::No, tr("Don't Save"));
|
||||
|
||||
// messageBox->setWindowModality(Qt::ApplicationModal);
|
||||
// const auto ret = static_cast<QMessageBox::StandardButton>(messageBox->exec());
|
||||
|
||||
// switch (ret)
|
||||
// {
|
||||
// case QMessageBox::Yes:
|
||||
// if (mIsReadOnly)
|
||||
// {
|
||||
// return FileSaveAs();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return FileSave();
|
||||
// }
|
||||
// case QMessageBox::No:
|
||||
// return true;
|
||||
// case QMessageBox::Cancel:
|
||||
// return false;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PuzzleMainWindow::on_actionNew_triggered()
|
||||
|
@ -486,6 +582,30 @@ void PuzzleMainWindow::on_actionNew_triggered()
|
|||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PuzzleMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
#if defined(Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK(5, 11, 1)
|
||||
// Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344
|
||||
static int numCalled = 0;
|
||||
if (numCalled++ >= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MaybeSave())
|
||||
{
|
||||
WriteSettings();
|
||||
event->accept();
|
||||
deleteLater();
|
||||
}
|
||||
else
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PuzzleMainWindow::on_actionOpen_triggered()
|
||||
{
|
||||
|
@ -796,8 +916,6 @@ void PuzzleMainWindow::on_checkBoxLayoutStickyEdges_toggled(bool checked)
|
|||
// TODO update the QGraphicView
|
||||
}
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PuzzleMainWindow::on_pushButtonLayoutExport_clicked()
|
||||
{
|
||||
|
@ -859,14 +977,10 @@ void PuzzleMainWindow::on_PieceCarrouselLocationChanged(Qt::DockWidgetArea area)
|
|||
if(area == Qt::BottomDockWidgetArea || area == Qt::TopDockWidgetArea)
|
||||
{
|
||||
m_pieceCarrousel->SetOrientation(Qt::Horizontal);
|
||||
ui->dockWidgetPieceCarrousel->setMaximumHeight(208);
|
||||
ui->dockWidgetPieceCarrousel->setMaximumWidth(10000);
|
||||
}
|
||||
else if (area == Qt::LeftDockWidgetArea || area == Qt::RightDockWidgetArea)
|
||||
{
|
||||
m_pieceCarrousel->SetOrientation(Qt::Vertical);
|
||||
ui->dockWidgetPieceCarrousel->setMaximumHeight(10000);
|
||||
ui->dockWidgetPieceCarrousel->setMaximumWidth(160);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -883,14 +997,15 @@ void PuzzleMainWindow::on_PieceSelectionChanged()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PuzzleMainWindow::on_PiecePositionChanged()
|
||||
{
|
||||
|
||||
if(m_selectedPieces.count() == 1)
|
||||
{
|
||||
VPuzzlePiece *piece = m_selectedPieces.first();
|
||||
QPointF pos = piece->GetPosition();
|
||||
|
||||
SetDoubleSpinBoxValue(ui->doubleSpinBoxCurrentPieceBoxPositionX, UnitConvertor(pos.x(), Unit::Px, m_layout->GetUnit()));
|
||||
SetDoubleSpinBoxValue(ui->doubleSpinBoxCurrentPieceBoxPositionY, UnitConvertor(pos.y(), Unit::Px, m_layout->GetUnit()));
|
||||
SetDoubleSpinBoxValue(ui->doubleSpinBoxCurrentPieceBoxPositionX,
|
||||
UnitConvertor(pos.x(), Unit::Px, m_layout->GetUnit()));
|
||||
SetDoubleSpinBoxValue(ui->doubleSpinBoxCurrentPieceBoxPositionY,
|
||||
UnitConvertor(pos.y(), Unit::Px, m_layout->GetUnit()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,8 @@ public slots:
|
|||
protected:
|
||||
enum { MaxRecentFiles = 5 };
|
||||
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(PuzzleMainWindow)
|
||||
Ui::PuzzleMainWindow *ui;
|
||||
|
@ -188,6 +190,11 @@ private:
|
|||
*/
|
||||
void SetCheckBoxValue(QCheckBox *checkbox, bool value);
|
||||
|
||||
void ReadSettings();
|
||||
void WriteSettings();
|
||||
|
||||
bool MaybeSave();
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief on_actionOpen_triggered When the menu action File > Open is
|
||||
|
|
|
@ -26,98 +26,57 @@
|
|||
**
|
||||
*************************************************************************/
|
||||
#include "vpiececarrousel.h"
|
||||
#include "ui_vpiececarrousel.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#include "vpuzzlelayer.h"
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <QMenu>
|
||||
#include <QPainter>
|
||||
|
||||
Q_LOGGING_CATEGORY(pCarrousel, "p.carrousel")
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPieceCarrousel::VPieceCarrousel(VPuzzleLayout *layout, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_layout(layout),
|
||||
m_comboBoxLayer(new QComboBox(this)),
|
||||
m_scrollArea(new QScrollArea(this)),
|
||||
m_layersContainer(new QWidget(this)),
|
||||
m_carrouselLayers(QList<VPieceCarrouselLayer *>())
|
||||
ui(new Ui::VPieceCarrousel),
|
||||
m_layout(layout)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPieceCarrousel::~VPieceCarrousel()
|
||||
{
|
||||
delete m_comboBoxLayer;
|
||||
delete m_layersContainer;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPieceCarrousel::Init()
|
||||
{
|
||||
// ------ first we initialize the structure of the carrousel
|
||||
ui->setupUi(this);
|
||||
|
||||
// init the combo box
|
||||
connect(m_comboBoxLayer, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&VPieceCarrousel::on_ActiveLayerChanged);
|
||||
connect(ui->comboBoxLayer, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&VPieceCarrousel::on_ActiveLayerChanged);
|
||||
|
||||
// init the layers container and corresponding scroll area
|
||||
QWidget *layersContainerWrapper = new QWidget();
|
||||
|
||||
QVBoxLayout *layersContainerWrapperLayout = new QVBoxLayout();
|
||||
layersContainerWrapperLayout->setMargin(0);
|
||||
layersContainerWrapper->setLayout(layersContainerWrapperLayout);
|
||||
|
||||
QVBoxLayout *layersContainerLayout = new QVBoxLayout();
|
||||
layersContainerLayout->setMargin(0);
|
||||
m_layersContainer->setLayout(layersContainerLayout);
|
||||
m_layersContainer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
QSpacerItem *spacer = new QSpacerItem(10, 10, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
|
||||
layersContainerWrapperLayout->addWidget(m_layersContainer);
|
||||
layersContainerWrapperLayout->addSpacerItem(spacer);
|
||||
|
||||
m_scrollArea->setWidgetResizable( true );
|
||||
m_scrollArea->setWidget(layersContainerWrapper);
|
||||
|
||||
// init the layout of the piece carrousel
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout();
|
||||
setLayout(mainLayout);
|
||||
|
||||
mainLayout->addWidget(m_comboBoxLayer);
|
||||
mainLayout->addWidget(m_scrollArea);
|
||||
ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
// ------ then we fill the carrousel with the layout content
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPieceCarrousel::Refresh()
|
||||
{
|
||||
|
||||
// NOTE: alternative to clearing the carrousel and adding things again, we could make comparision
|
||||
|
||||
// --- clears the content of the carrousel
|
||||
Clear();
|
||||
|
||||
// --- add the content saved in the layout to the carrousel.
|
||||
QList<VPuzzleLayer*> layers = m_layout->GetLayers();
|
||||
layers.prepend(m_layout->GetUnplacedPiecesLayer());
|
||||
// Do not rely on m_layout because we do not control it.
|
||||
m_layers = m_layout->GetLayers();
|
||||
m_layers.prepend(m_layout->GetUnplacedPiecesLayer());
|
||||
|
||||
for (auto layer : layers)
|
||||
for (auto layer : m_layers)
|
||||
{
|
||||
// add layer name to combo
|
||||
m_comboBoxLayer->addItem(layer->GetName());
|
||||
|
||||
// add new carrousel layer
|
||||
VPieceCarrouselLayer *carrouselLayer = new VPieceCarrouselLayer(layer, this);
|
||||
m_carrouselLayers.append(carrouselLayer);
|
||||
m_layersContainer->layout()->addWidget(carrouselLayer);
|
||||
ui->comboBoxLayer->blockSignals(true);
|
||||
ui->comboBoxLayer->addItem(layer->GetName());
|
||||
ui->comboBoxLayer->blockSignals(false);
|
||||
}
|
||||
|
||||
on_ActiveLayerChanged(0);
|
||||
|
@ -129,31 +88,9 @@ void VPieceCarrousel::Refresh()
|
|||
void VPieceCarrousel::Clear()
|
||||
{
|
||||
// remove the combobox entries
|
||||
int layerCount = m_comboBoxLayer->count();
|
||||
for(int i=0;i<layerCount;i++)
|
||||
{
|
||||
m_comboBoxLayer->removeItem(0);
|
||||
}
|
||||
ui->comboBoxLayer->clear();
|
||||
|
||||
// remove the carrousel layers from the qlayout
|
||||
while(!m_layersContainer->layout()->isEmpty())
|
||||
{
|
||||
QLayoutItem* item = m_layersContainer->layout()->takeAt(0);
|
||||
if(item != nullptr)
|
||||
{
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
// Removes and deletes the carrousel layers from the list
|
||||
while (!m_carrouselLayers.isEmpty())
|
||||
{
|
||||
VPieceCarrouselLayer *carrouselLayer = m_carrouselLayers.takeLast();
|
||||
if(carrouselLayer != nullptr)
|
||||
{
|
||||
delete carrouselLayer;
|
||||
}
|
||||
}
|
||||
ui->listWidget->clear();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -161,10 +98,21 @@ void VPieceCarrousel::on_ActiveLayerChanged(int index)
|
|||
{
|
||||
qCDebug(pCarrousel, "index changed %i", index);
|
||||
|
||||
int j=0;
|
||||
for (VPieceCarrouselLayer *carrouselLayer: m_carrouselLayers) {
|
||||
carrouselLayer->setVisible(j == index);
|
||||
j++;
|
||||
ui->listWidget->clear();
|
||||
|
||||
if (index >= 0 && index < m_layers.size())
|
||||
{
|
||||
VPuzzleLayer *layer = m_layers.at(index);
|
||||
|
||||
if (layer)
|
||||
{
|
||||
QList<VPuzzlePiece*> pieces = layer->GetPieces();
|
||||
|
||||
for (auto piece : pieces)
|
||||
{
|
||||
new QListWidgetItem(piece->PieceIcon(QSize(120, 120)) , piece->GetName(), ui->listWidget);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,47 +126,26 @@ void VPieceCarrousel::SetOrientation(Qt::Orientation orientation)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPieceCarrousel::RefreshOrientation()
|
||||
{
|
||||
QBoxLayout::Direction direction = (m_orientation == Qt::Horizontal)?
|
||||
QBoxLayout::LeftToRight
|
||||
:
|
||||
QBoxLayout::TopToBottom;
|
||||
|
||||
// Update the various qlayouts
|
||||
QBoxLayout* mainScrollAreaLayout = qobject_cast<QBoxLayout*>(m_layersContainer->layout());
|
||||
mainScrollAreaLayout->setDirection(direction);
|
||||
|
||||
QBoxLayout* layerContainerWrapper = qobject_cast<QBoxLayout*>(m_scrollArea->widget()->layout());
|
||||
layerContainerWrapper->setDirection(direction);
|
||||
|
||||
for (VPieceCarrouselLayer *widget: m_carrouselLayers) {
|
||||
QBoxLayout* layerLayout = qobject_cast<QBoxLayout*>(widget->layout());
|
||||
layerLayout->setDirection(direction);
|
||||
}
|
||||
|
||||
// then update the scrollarea min height / width and scrollbar behaviour
|
||||
if(m_orientation == Qt::Horizontal)
|
||||
{
|
||||
m_comboBoxLayer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
ui->comboBoxLayer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
// scroll bar policy of scroll area
|
||||
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
m_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
ui->listWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
|
||||
// FIXME: find a nicer way than putting directly the 120 height of the piece
|
||||
m_scrollArea->setMinimumHeight(128 + m_scrollArea->horizontalScrollBar()->sizeHint().height()+2);
|
||||
m_scrollArea->setMinimumWidth(0);
|
||||
ui->listWidget->setFlow(QListView::TopToBottom);
|
||||
}
|
||||
else // Qt::Vertical
|
||||
{
|
||||
m_comboBoxLayer->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
ui->comboBoxLayer->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
|
||||
// scroll bar policy of scroll area
|
||||
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
m_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
ui->listWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
|
||||
m_scrollArea->setMinimumHeight(0);
|
||||
m_scrollArea->setMinimumWidth(124 + m_scrollArea->verticalScrollBar()->sizeHint().width()+2);
|
||||
// FIXME: find a nicer way than putting directly the 120 width of the piece
|
||||
ui->listWidget->setFlow(QListView::LeftToRight);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,14 +34,18 @@
|
|||
#include <QScrollArea>
|
||||
#include "vpuzzlelayout.h"
|
||||
#include "vpuzzlepiece.h"
|
||||
#include "vpiececarrousellayer.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class VPieceCarrousel;
|
||||
}
|
||||
|
||||
class VPieceCarrousel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit VPieceCarrousel(VPuzzleLayout *layout, QWidget *parent = nullptr);
|
||||
virtual ~VPieceCarrousel();
|
||||
virtual ~VPieceCarrousel() = default;
|
||||
|
||||
/**
|
||||
* @brief SetOrientation Sets the orientation to the given value and refreshes
|
||||
|
@ -56,11 +60,6 @@ public:
|
|||
*/
|
||||
void RefreshOrientation();
|
||||
|
||||
/**
|
||||
* @brief Inits the carroussel
|
||||
*/
|
||||
void Init();
|
||||
|
||||
/**
|
||||
* @brief Refresh Refreshes the content of the carrousel
|
||||
*/
|
||||
|
@ -78,14 +77,10 @@ public:
|
|||
|
||||
private:
|
||||
Q_DISABLE_COPY(VPieceCarrousel)
|
||||
Ui::VPieceCarrousel *ui;
|
||||
|
||||
VPuzzleLayout *m_layout;
|
||||
|
||||
QComboBox *m_comboBoxLayer;
|
||||
QScrollArea *m_scrollArea;
|
||||
QWidget *m_layersContainer;
|
||||
|
||||
QList<VPieceCarrouselLayer*> m_carrouselLayers;
|
||||
QList<VPuzzleLayer*> m_layers{};
|
||||
|
||||
Qt::Orientation m_orientation{Qt::Vertical};
|
||||
|
||||
|
|
77
src/app/puzzle/vpiececarrousel.ui
Normal file
77
src/app/puzzle/vpiececarrousel.ui
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>VPieceCarrousel</class>
|
||||
<widget class="QWidget" name="VPieceCarrousel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>583</width>
|
||||
<height>557</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Carrousel</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBoxLayer">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::DragOnly</enum>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>120</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="movement">
|
||||
<enum>QListView::Static</enum>
|
||||
</property>
|
||||
<property name="flow">
|
||||
<enum>QListView::TopToBottom</enum>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::IconMode</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -277,7 +277,7 @@ void VPieceCarrouselPiece::on_ActionPieceMovedToLayer()
|
|||
{
|
||||
QAction *act = qobject_cast<QAction *>(sender());
|
||||
QVariant v = act->data();
|
||||
VPuzzleLayer *layer = (VPuzzleLayer *) v.value<VPuzzleLayer *>();
|
||||
VPuzzleLayer *layer = v.value<VPuzzleLayer *>();
|
||||
if(layer != nullptr)
|
||||
{
|
||||
layer->GetLayout()->MovePieceToLayer(m_piece, layer);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
class VPuzzleGraphicsLayout : public QGraphicsItem
|
||||
{
|
||||
public:
|
||||
VPuzzleGraphicsLayout(VPuzzleLayout *layout, QGraphicsItem *parent = nullptr);
|
||||
explicit VPuzzleGraphicsLayout(VPuzzleLayout *layout, QGraphicsItem *parent = nullptr);
|
||||
~VPuzzleGraphicsLayout();
|
||||
|
||||
QRectF boundingRect() const override;
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpuzzlemaingraphicsscene.cpp
|
||||
** @author Ronan Le Tiec
|
||||
** @date 3 5, 2020
|
||||
**
|
||||
** @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) 2020 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 "vpuzzlemaingraphicsscene.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPuzzleMainGraphicsScene::VPuzzleMainGraphicsScene(QObject *parent): QGraphicsScene(parent)
|
||||
{
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpuzzlemaingraphicsscene.cpp
|
||||
** @author Ronan Le Tiec
|
||||
** @date 3 5, 2020
|
||||
**
|
||||
** @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) 2020 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 VPUZZLEMAINGRAPHICSSCENE_H
|
||||
#define VPUZZLEMAINGRAPHICSSCENE_H
|
||||
|
||||
#include <QGraphicsScene>
|
||||
|
||||
// TODO: When ready, extend from QGraphicsScene instead
|
||||
|
||||
class VPuzzleMainGraphicsScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VPuzzleMainGraphicsScene(QObject *parent = nullptr);
|
||||
|
||||
};
|
||||
|
||||
#endif // VPUZZLEMAINGRAPHICSSCENE_H
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "vpuzzlemimedatapiece.h"
|
||||
#include "vpuzzlelayer.h"
|
||||
#include "../vwidgets/vmaingraphicsscene.h"
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
|
@ -42,30 +43,22 @@ Q_LOGGING_CATEGORY(pMainGraphicsView, "p.mainGraphicsView")
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPuzzleMainGraphicsView::VPuzzleMainGraphicsView(VPuzzleLayout *layout, QWidget *parent) :
|
||||
QGraphicsView(parent),
|
||||
m_layout(layout),
|
||||
m_graphicsPieces(QList<VPuzzleGraphicsPiece*>())
|
||||
VMainGraphicsView(parent),
|
||||
m_layout(layout)
|
||||
{
|
||||
m_scene = new VPuzzleMainGraphicsScene(this);
|
||||
m_scene = new VMainGraphicsScene(this);
|
||||
setScene(m_scene);
|
||||
|
||||
m_graphicsLayout = new VPuzzleGraphicsLayout(layout);
|
||||
m_graphicsLayout->setPos(0,0);
|
||||
m_graphicsLayout->setPos(0, 0);
|
||||
m_scene->addItem(m_graphicsLayout);
|
||||
|
||||
setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
|
||||
setAcceptDrops(true);
|
||||
|
||||
// add the connections
|
||||
connect(m_layout, &VPuzzleLayout::PieceMovedToLayer, this, &VPuzzleMainGraphicsView::on_PieceMovedToLayer);
|
||||
connect(m_scene, &VPuzzleMainGraphicsScene::selectionChanged, this, &VPuzzleMainGraphicsView::on_SceneSelectionChanged);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPuzzleMainGraphicsView::~VPuzzleMainGraphicsView()
|
||||
{
|
||||
|
||||
connect(m_scene, &VMainGraphicsScene::selectionChanged, this,
|
||||
&VPuzzleMainGraphicsView::on_SceneSelectionChanged);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -29,21 +29,19 @@
|
|||
#ifndef VPUZZLEMAINGRAPHICSVIEW_H
|
||||
#define VPUZZLEMAINGRAPHICSVIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
|
||||
#include "vpuzzlegraphicslayout.h"
|
||||
#include "vpuzzlemaingraphicsscene.h"
|
||||
#include "vpuzzlegraphicspiece.h"
|
||||
#include "../vwidgets/vmaingraphicsview.h"
|
||||
|
||||
class VMainGraphicsScene;
|
||||
|
||||
|
||||
// TODO: when ready, extend the VMainGrapchisView instead
|
||||
|
||||
class VPuzzleMainGraphicsView : public QGraphicsView
|
||||
class VPuzzleMainGraphicsView : public VMainGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VPuzzleMainGraphicsView(VPuzzleLayout *layout, QWidget *parent);
|
||||
~VPuzzleMainGraphicsView();
|
||||
~VPuzzleMainGraphicsView() = default;
|
||||
|
||||
/**
|
||||
* @brief RefreshLayout Refreshes the rectangles for the layout border and the margin
|
||||
|
@ -60,7 +58,8 @@ protected:
|
|||
|
||||
private slots:
|
||||
/**
|
||||
* @brief on_PieceMovedToLayer The slot is called when the given piece was moved from the given layer to the other given layer
|
||||
* @brief on_PieceMovedToLayer The slot is called when the given piece was moved from the given layer to the other
|
||||
* given layer
|
||||
* @param piece the piece that was moved
|
||||
* @param layerBefore the layer before the move
|
||||
* @param layerAfter the layer after the move
|
||||
|
@ -75,12 +74,12 @@ private slots:
|
|||
private:
|
||||
Q_DISABLE_COPY(VPuzzleMainGraphicsView)
|
||||
|
||||
VPuzzleMainGraphicsScene *m_scene{nullptr};
|
||||
VMainGraphicsScene *m_scene{nullptr};
|
||||
|
||||
VPuzzleGraphicsLayout *m_graphicsLayout{nullptr};
|
||||
VPuzzleLayout *m_layout{nullptr};
|
||||
|
||||
QList<VPuzzleGraphicsPiece*> m_graphicsPieces;
|
||||
QList<VPuzzleGraphicsPiece*> m_graphicsPieces{};
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -32,7 +32,9 @@
|
|||
#include "vpuzzlelayer.h"
|
||||
#include "../vmisc/def.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QLoggingCategory>
|
||||
#include <QPainter>
|
||||
|
||||
Q_LOGGING_CATEGORY(pPiece, "p.piece")
|
||||
|
||||
|
@ -245,7 +247,6 @@ VPuzzleLayer* VPuzzlePiece::GetLayer()
|
|||
return m_layer;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzlePiece::SetLayer(VPuzzleLayer* layer)
|
||||
{
|
||||
|
@ -254,3 +255,46 @@ void VPuzzlePiece::SetLayer(VPuzzleLayer* layer)
|
|||
m_layer = layer;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QIcon VPuzzlePiece::PieceIcon(const QSize &size) const
|
||||
{
|
||||
QVector<QPointF> points = GetSeamLine();
|
||||
if(points.isEmpty())
|
||||
{
|
||||
points = GetCuttingLine();
|
||||
}
|
||||
|
||||
QPolygonF shape(points);
|
||||
shape << shape.first();
|
||||
|
||||
QRectF boundingRect = shape.boundingRect();
|
||||
qreal canvasSize = qMax(boundingRect.height(), boundingRect.width());
|
||||
QRectF canvas = QRectF(0, 0, canvasSize, canvasSize);
|
||||
|
||||
qreal dx = canvas.center().x() - boundingRect.center().x();
|
||||
qreal dy = canvas.center().y() - boundingRect.center().y();
|
||||
|
||||
QPixmap pixmap(size);
|
||||
pixmap.fill(QColor("white"));
|
||||
|
||||
QPainter painter;
|
||||
painter.begin(&pixmap);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
|
||||
int spacing = 2;
|
||||
painter.translate(spacing, spacing);
|
||||
|
||||
qreal scaleFactorX = canvasSize * 100 / (size.width() - spacing*2) / 100;
|
||||
qreal scaleFactorY = canvasSize * 100 / (size.height() - spacing*2) / 100;
|
||||
painter.scale(1./scaleFactorX, 1./scaleFactorY);
|
||||
painter.setPen(QPen(Qt::black, 0.8*qMax(scaleFactorX, scaleFactorY)));
|
||||
|
||||
painter.translate(dx, dy);
|
||||
|
||||
painter.drawPolygon(shape);
|
||||
painter.end();
|
||||
|
||||
return QIcon(pixmap);
|
||||
}
|
||||
|
|
|
@ -198,6 +198,8 @@ public:
|
|||
*/
|
||||
void SetLayer(VPuzzleLayer* layer);
|
||||
|
||||
QIcon PieceIcon(const QSize &size) const;
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief SelectionChanged emited when the selection of the piece was
|
||||
|
|
81
src/app/puzzle/vpuzzlesettings.cpp
Normal file
81
src/app/puzzle/vpuzzlesettings.cpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpuzzlesettings.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 16 2, 2020
|
||||
**
|
||||
** @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) 2020 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 "vpuzzlesettings.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPropertiesActive, (QLatin1String("dockWidget/properties")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockPropertiesContentsActive, (QLatin1String("dockWidget/contents")))
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPuzzleSettings::VPuzzleSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
||||
QObject *parent)
|
||||
: VCommonSettings(format, scope, organization, application, parent)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPuzzleSettings::VPuzzleSettings(const QString &fileName, QSettings::Format format, QObject *parent)
|
||||
: VCommonSettings(fileName, format, parent)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPuzzleSettings::IsDockWidgetPropertiesActive() const
|
||||
{
|
||||
return value(*settingDockWidgetPropertiesActive, GetDefDockWidgetPropertiesActive()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPuzzleSettings::GetDefDockWidgetPropertiesActive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleSettings::SetDockWidgetPropertiesActive(bool value)
|
||||
{
|
||||
setValue(*settingDockWidgetPropertiesActive, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPuzzleSettings::IsDockWidgetPropertiesContentsActive() const
|
||||
{
|
||||
return value(*settingDockWidgetPropertiesActive, GetDefDockWidgetPropertiesActive()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPuzzleSettings::GetDefDockWidgetPropertiesContentsActive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleSettings::SetDockWidgetPropertiesContentsActive(bool value)
|
||||
{
|
||||
setValue(*settingDockPropertiesContentsActive, value);
|
||||
}
|
|
@ -38,6 +38,15 @@ class VPuzzleSettings : public VCommonSettings
|
|||
public:
|
||||
VPuzzleSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||
QObject *parent = nullptr);
|
||||
VPuzzleSettings(const QString &fileName, Format format, QObject *parent = nullptr);
|
||||
|
||||
bool IsDockWidgetPropertiesActive() const;
|
||||
static bool GetDefDockWidgetPropertiesActive();
|
||||
void SetDockWidgetPropertiesActive(bool value);
|
||||
|
||||
bool IsDockWidgetPropertiesContentsActive() const;
|
||||
static bool GetDefDockWidgetPropertiesContentsActive();
|
||||
void SetDockWidgetPropertiesContentsActive(bool value);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VPuzzleSettings)
|
|
@ -29,7 +29,7 @@
|
|||
#include "tapepreferencesconfigurationpage.h"
|
||||
#include "ui_tapepreferencesconfigurationpage.h"
|
||||
#include "../../mapplication.h"
|
||||
#include "../vmisc/vtapesettings.h"
|
||||
#include "../../vtapesettings.h"
|
||||
#include "../vpatterndb/variables/vmeasurement.h"
|
||||
#include "../vpatterndb/pmsystems.h"
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "tapepreferencespathpage.h"
|
||||
#include "ui_tapepreferencespathpage.h"
|
||||
#include "../../mapplication.h"
|
||||
#include "../vmisc/vtapesettings.h"
|
||||
#include "../../vtapesettings.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "ui_dialognewmeasurements.h"
|
||||
|
||||
#include "../vpatterndb/variables/vmeasurement.h"
|
||||
#include "../vmisc/vtapesettings.h"
|
||||
#include "../vtapesettings.h"
|
||||
#include "../mapplication.h"
|
||||
|
||||
#include <QShowEvent>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/vtapesettings.h"
|
||||
#include "vtapesettings.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "dialogs/dialogmdatabase.h"
|
||||
|
||||
|
@ -101,8 +101,8 @@ private:
|
|||
|
||||
void Clean();
|
||||
};
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline const VTranslateVars *MApplication::TrVars()
|
||||
{
|
||||
return trVars;
|
||||
|
|
|
@ -11,7 +11,8 @@ SOURCES += \
|
|||
$$PWD/vlitepattern.cpp \
|
||||
$$PWD/dialogs/dialogtapepreferences.cpp \
|
||||
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.cpp \
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.cpp
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.cpp \
|
||||
$$PWD/vtapesettings.cpp
|
||||
|
||||
*msvc*:SOURCES += $$PWD/stable.cpp
|
||||
|
||||
|
@ -26,7 +27,8 @@ HEADERS += \
|
|||
$$PWD/vlitepattern.h \
|
||||
$$PWD/dialogs/dialogtapepreferences.h \
|
||||
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.h \
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.h
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.h \
|
||||
$$PWD/vtapesettings.h
|
||||
|
||||
FORMS += \
|
||||
$$PWD/tmainwindow.ui \
|
||||
|
|
|
@ -6,11 +6,13 @@ HEADERS += \
|
|||
$$PWD/vformulaproperty.h \
|
||||
$$PWD/vformulapropertyeditor.h \
|
||||
$$PWD/vtooloptionspropertybrowser.h \
|
||||
$$PWD/vcmdexport.h
|
||||
$$PWD/vcmdexport.h \
|
||||
$$PWD/vvalentinasettings.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/vapplication.cpp \
|
||||
$$PWD/vformulaproperty.cpp \
|
||||
$$PWD/vformulapropertyeditor.cpp \
|
||||
$$PWD/vtooloptionspropertybrowser.cpp \
|
||||
$$PWD/vcmdexport.cpp
|
||||
$$PWD/vcmdexport.cpp \
|
||||
$$PWD/vvalentinasettings.cpp
|
||||
|
|
|
@ -445,9 +445,10 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
|
|||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VApplication::ActivateDarkMode()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
if (settings->GetDarkMode())
|
||||
{
|
||||
QFile f(QStringLiteral(":qdarkstyle/style.qss"));
|
||||
|
@ -465,7 +466,6 @@ void VApplication::ActivateDarkMode()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VApplication::TapeFilePath() const
|
||||
{
|
||||
|
@ -726,15 +726,15 @@ void VApplication::AboutToQuit()
|
|||
*/
|
||||
void VApplication::OpenSettings()
|
||||
{
|
||||
settings = new VSettings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(),
|
||||
QCoreApplication::applicationName(), this);
|
||||
settings = new VValentinaSettings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(),
|
||||
QCoreApplication::applicationName(), this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VSettings *VApplication::ValentinaSettings()
|
||||
VValentinaSettings *VApplication::ValentinaSettings()
|
||||
{
|
||||
SCASSERT(settings != nullptr)
|
||||
return qobject_cast<VSettings *>(settings);
|
||||
return qobject_cast<VValentinaSettings *>(settings);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vwidgets/vmaingraphicsview.h"
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "vsettings.h"
|
||||
#include "vvalentinasettings.h"
|
||||
#include "vcmdexport.h"
|
||||
|
||||
class VApplication;// use in define
|
||||
|
@ -76,7 +76,7 @@ public:
|
|||
virtual bool IsPedantic() const override;
|
||||
|
||||
virtual void OpenSettings() override;
|
||||
VSettings *ValentinaSettings();
|
||||
VValentinaSettings *ValentinaSettings();
|
||||
|
||||
protected:
|
||||
virtual void InitTrVars() override;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "../ifc/xml/vdomdocument.h"
|
||||
#include "../vformat/vmeasurements.h"
|
||||
#include "../vmisc/commandoptions.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
#include "vvalentinasettings.h"
|
||||
#include "../vmisc/dialogs/dialogexporttocsv.h"
|
||||
#include "../vlayout/vlayoutgenerator.h"
|
||||
#include "../vpatterndb/variables/vmeasurement.h"
|
||||
|
@ -801,7 +801,7 @@ QStringList VCommandLine::OptionValues(const QString &option) const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VCommandLine::OptNestingTime() const
|
||||
{
|
||||
int time = VSettings::GetDefNestingTime();
|
||||
int time = VValentinaSettings::GetDefNestingTime();
|
||||
if (IsOptionSet(LONG_OPTION_NESTING_TIME))
|
||||
{
|
||||
bool ok = false;
|
||||
|
@ -821,7 +821,7 @@ int VCommandLine::OptNestingTime() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VCommandLine::OptEfficiencyCoefficient() const
|
||||
{
|
||||
qreal coefficient = VSettings::GetDefEfficiencyCoefficient();
|
||||
qreal coefficient = VValentinaSettings::GetDefEfficiencyCoefficient();
|
||||
if (IsOptionSet(LONG_OPTION_EFFICIENCY_COEFFICIENT))
|
||||
{
|
||||
bool ok = false;
|
||||
|
|
|
@ -983,6 +983,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolArc(VPE::VProperty *property)
|
|||
SCASSERT(i != nullptr)
|
||||
switch (PropertiesList().indexOf(id))
|
||||
{
|
||||
case 0: // AttrName
|
||||
Q_UNREACHABLE();//The attribute is read only
|
||||
break;
|
||||
case 8: // AttrRadius
|
||||
i->SetFormulaRadius(value.value<VFormula>());
|
||||
break;
|
||||
|
@ -1021,6 +1024,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolArcWithLength(VPE::VProperty *pr
|
|||
SCASSERT(i != nullptr)
|
||||
switch (PropertiesList().indexOf(id))
|
||||
{
|
||||
case 0: // AttrName
|
||||
Q_UNREACHABLE();//The attribute is read only
|
||||
break;
|
||||
case 8: // AttrRadius
|
||||
i->SetFormulaRadius(value.value<VFormula>());
|
||||
break;
|
||||
|
@ -2019,6 +2025,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArc(QGraphicsItem *item)
|
|||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Arc"));
|
||||
|
||||
AddPropertyObjectName(i, tr("Name:"), true);
|
||||
AddPropertyParentPointName(i->CenterPointName(), tr("Center point:"), AttrCenter);
|
||||
AddPropertyFormula(tr("Radius:"), i->GetFormulaRadius(), AttrRadius);
|
||||
AddPropertyFormula(tr("First angle:"), i->GetFormulaF1(), AttrAngle1);
|
||||
|
@ -2035,6 +2042,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArcWithLength(QGraphicsItem *it
|
|||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Arc with given length"));
|
||||
|
||||
AddPropertyObjectName(i, tr("Name:"), true);
|
||||
AddPropertyParentPointName(i->CenterPointName(), tr("Center point:"), AttrCenter);
|
||||
AddPropertyFormula(tr("Radius:"), i->GetFormulaRadius(), AttrRadius);
|
||||
AddPropertyFormula(tr("First angle:"), i->GetFormulaF1(), AttrAngle1);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "vsettings.h"
|
||||
#include "vvalentinasettings.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QLocale>
|
||||
|
@ -47,26 +47,6 @@
|
|||
|
||||
Q_DECLARE_METATYPE(QMarginsF)
|
||||
|
||||
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;
|
||||
|
||||
namespace
|
||||
{
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
|
||||
|
@ -76,8 +56,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutoRefreshPatternMessage,
|
|||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLayout, (QLatin1String("paths/layout")))
|
||||
|
||||
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")))
|
||||
|
||||
|
@ -107,13 +85,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperHeight, (QLatin1Str
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperWidth, (QLatin1String("tiledPDF/paperWidth")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFOrientation, (QLatin1String("tiledPDF/orientation")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingDuration, (QLatin1String("scrolling/duration")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval, (QLatin1String("scrolling/updateInterval")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingSensorMouseScale,
|
||||
(QLatin1String("scrolling/sensorMouseScale")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale, (QLatin1String("scrolling/wheelMouseScale")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration, (QLatin1String("scrolling/acceleration")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingdockWidgetGroupsActive, (QLatin1String("dockWidget/groupsActive")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetToolOptionsActive,
|
||||
(QLatin1String("dockWidget/toolOptionsActive")))
|
||||
|
@ -122,17 +93,10 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPatternMessagesActive,
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternMessagesFontSize, (QLatin1String("font/patternMessagesSize")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkEditorSize, (QLatin1String("watermarkEditorSize")))
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VSettings::VSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
||||
VValentinaSettings::VValentinaSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
||||
QObject *parent)
|
||||
:VCommonSettings(format, scope, organization, application, parent)
|
||||
{
|
||||
|
@ -140,63 +104,39 @@ VSettings::VSettings(Format format, Scope scope, const QString &organization, co
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VSettings::VSettings(const QString &fileName, QSettings::Format format, QObject *parent)
|
||||
VValentinaSettings::VValentinaSettings(const QString &fileName, QSettings::Format format, QObject *parent)
|
||||
:VCommonSettings(fileName, format, parent)
|
||||
{
|
||||
qRegisterMetaTypeStreamOperators<QMarginsF>("QMarginsF");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VSettings::GetLabelLanguage() const
|
||||
QString VValentinaSettings::GetLabelLanguage() const
|
||||
{
|
||||
return value(*settingConfigurationLabelLanguage, QLocale().bcp47Name()).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLabelLanguage(const QString &value)
|
||||
void VValentinaSettings::SetLabelLanguage(const QString &value)
|
||||
{
|
||||
setValue(*settingConfigurationLabelLanguage, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VSettings::GetDefPathLayout()
|
||||
QString VValentinaSettings::GetDefPathLayout()
|
||||
{
|
||||
return QDir::homePath() + QStringLiteral("/valentina/") + tr("layouts");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VSettings::GetPathLayout() const
|
||||
QString VValentinaSettings::GetPathLayout() const
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
|
||||
return settings.value(*settingPathsLayout, GetDefPathLayout()).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetPathLayout(const QString &value)
|
||||
void VValentinaSettings::SetPathLayout(const QString &value)
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
|
||||
settings.setValue(*settingPathsLayout, value);
|
||||
|
@ -204,358 +144,334 @@ void VSettings::SetPathLayout(const QString &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetGraphicalOutput() const
|
||||
qreal VValentinaSettings::GetLayoutPaperHeight() const
|
||||
{
|
||||
return value(*settingPatternGraphicalOutput, 1).toBool();
|
||||
return ValueOrDef<qreal>(*this, *settingLayoutPaperHeight, UnitConvertor(1189/*A0*/, Unit::Mm, Unit::Px));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetGraphicalOutput(const bool &value)
|
||||
{
|
||||
setValue(*settingPatternGraphicalOutput, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::IsOpenGLRender() const
|
||||
{
|
||||
return value(*settingPatternUseOpenGLRender, 0).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetOpenGLRender(bool value)
|
||||
{
|
||||
setValue(*settingPatternUseOpenGLRender, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VSettings::GetLayoutPaperHeight() const
|
||||
{
|
||||
return ValueOrDef<qreal>(*settingLayoutPaperHeight, UnitConvertor(1189/*A0*/, Unit::Mm, Unit::Px));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLayoutPaperHeight(qreal value)
|
||||
void VValentinaSettings::SetLayoutPaperHeight(qreal value)
|
||||
{
|
||||
setValue(*settingLayoutPaperHeight, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VSettings::GetLayoutPaperWidth() const
|
||||
qreal VValentinaSettings::GetLayoutPaperWidth() const
|
||||
{
|
||||
return ValueOrDef<qreal>(*settingLayoutPaperWidth, UnitConvertor(841/*A0*/, Unit::Mm, Unit::Px));
|
||||
return ValueOrDef<qreal>(*this, *settingLayoutPaperWidth, UnitConvertor(841/*A0*/, Unit::Mm, Unit::Px));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLayoutPaperWidth(qreal value)
|
||||
void VValentinaSettings::SetLayoutPaperWidth(qreal value)
|
||||
{
|
||||
setValue(*settingLayoutPaperWidth, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VSettings::GetLayoutWidth() const
|
||||
qreal VValentinaSettings::GetLayoutWidth() const
|
||||
{
|
||||
return ValueOrDef<qreal>(*settingLayoutWidth, GetDefLayoutWidth());
|
||||
return ValueOrDef<qreal>(*this, *settingLayoutWidth, GetDefLayoutWidth());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VSettings::GetDefLayoutWidth()
|
||||
qreal VValentinaSettings::GetDefLayoutWidth()
|
||||
{
|
||||
return UnitConvertor(2.5, Unit::Mm, Unit::Px);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLayoutWidth(qreal value)
|
||||
void VValentinaSettings::SetLayoutWidth(qreal value)
|
||||
{
|
||||
setValue(*settingLayoutWidth, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VSettings::GetNestingTime() const
|
||||
int VValentinaSettings::GetNestingTime() const
|
||||
{
|
||||
return ValueOrDef<int>(*settingNestingTime, GetDefNestingTime());
|
||||
return ValueOrDef<int>(*this, *settingNestingTime, GetDefNestingTime());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetNestingTime(int value)
|
||||
void VValentinaSettings::SetNestingTime(int value)
|
||||
{
|
||||
setValue(*settingNestingTime, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VSettings::GetEfficiencyCoefficient() const
|
||||
qreal VValentinaSettings::GetEfficiencyCoefficient() const
|
||||
{
|
||||
return ValueOrDef<qreal>(*settingEfficiencyCoefficient, GetDefEfficiencyCoefficient());
|
||||
return ValueOrDef<qreal>(*this, *settingEfficiencyCoefficient, GetDefEfficiencyCoefficient());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetEfficiencyCoefficient(qreal value)
|
||||
void VValentinaSettings::SetEfficiencyCoefficient(qreal value)
|
||||
{
|
||||
setValue(*settingEfficiencyCoefficient, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QMarginsF VSettings::GetFields(const QMarginsF &def) const
|
||||
QMarginsF VValentinaSettings::GetFields(const QMarginsF &def) const
|
||||
{
|
||||
return ValueOrDef<QMarginsF>(*settingFields, def);
|
||||
return ValueOrDef<QMarginsF>(*this, *settingFields, def);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetFields(const QMarginsF &value)
|
||||
void VValentinaSettings::SetFields(const QMarginsF &value)
|
||||
{
|
||||
setValue(*settingFields, QVariant::fromValue(value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Cases VSettings::GetLayoutGroup() const
|
||||
Cases VValentinaSettings::GetLayoutGroup() const
|
||||
{
|
||||
return ValueOrDef<Cases>(*settingLayoutSorting, GetDefLayoutGroup());
|
||||
return ValueOrDef<Cases>(*this, *settingLayoutSorting, GetDefLayoutGroup());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Cases VSettings::GetDefLayoutGroup()
|
||||
Cases VValentinaSettings::GetDefLayoutGroup()
|
||||
{
|
||||
return Cases::CaseDesc;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLayoutGroup(const Cases &value)
|
||||
void VValentinaSettings::SetLayoutGroup(const Cases &value)
|
||||
{
|
||||
setValue(*settingLayoutSorting, static_cast<int>(value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetLayoutFollowGrainline() const
|
||||
bool VValentinaSettings::GetLayoutFollowGrainline() const
|
||||
{
|
||||
return value(*settingLayoutFollowGrainline, GetDefLayoutFollowGrainline()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefLayoutFollowGrainline()
|
||||
bool VValentinaSettings::GetDefLayoutFollowGrainline()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLayoutFollowGrainline(bool value)
|
||||
void VValentinaSettings::SetLayoutFollowGrainline(bool value)
|
||||
{
|
||||
setValue(*settingLayoutFollowGrainline, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetLayoutManualPriority() const
|
||||
bool VValentinaSettings::GetLayoutManualPriority() const
|
||||
{
|
||||
return value(*settingLayoutManualPriority, GetDefLayoutManualPriority()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefLayoutManualPriority()
|
||||
bool VValentinaSettings::GetDefLayoutManualPriority()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLayoutManualPriority(bool value)
|
||||
void VValentinaSettings::SetLayoutManualPriority(bool value)
|
||||
{
|
||||
setValue(*settingLayoutManualPriority, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetLayoutNestQuantity() const
|
||||
bool VValentinaSettings::GetLayoutNestQuantity() const
|
||||
{
|
||||
return value(*settingLayoutNestQuantity, GetDefLayoutNestQuantity()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefLayoutNestQuantity()
|
||||
bool VValentinaSettings::GetDefLayoutNestQuantity()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLayoutNestQuantity(bool value)
|
||||
void VValentinaSettings::SetLayoutNestQuantity(bool value)
|
||||
{
|
||||
setValue(*settingLayoutNestQuantity, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetLayoutAutoCropLength() const
|
||||
bool VValentinaSettings::GetLayoutAutoCropLength() const
|
||||
{
|
||||
return value(*settingLayoutAutoCropLength, GetDefLayoutAutoCropLength()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefLayoutAutoCropLength()
|
||||
bool VValentinaSettings::GetDefLayoutAutoCropLength()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLayoutAutoCropLength(bool value)
|
||||
void VValentinaSettings::SetLayoutAutoCropLength(bool value)
|
||||
{
|
||||
setValue(*settingLayoutAutoCropLength, value);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetLayoutAutoCropWidth() const
|
||||
bool VValentinaSettings::GetLayoutAutoCropWidth() const
|
||||
{
|
||||
return value(*settingLayoutAutoCropWidth, GetDefLayoutAutoCropWidth()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefLayoutAutoCropWidth()
|
||||
bool VValentinaSettings::GetDefLayoutAutoCropWidth()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLayoutAutoCropWidth(bool value)
|
||||
void VValentinaSettings::SetLayoutAutoCropWidth(bool value)
|
||||
{
|
||||
setValue(*settingLayoutAutoCropWidth, value);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetLayoutSaveLength() const
|
||||
bool VValentinaSettings::GetLayoutSaveLength() const
|
||||
{
|
||||
return value(*settingLayoutSaveLength, GetDefLayoutSaveLength()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefLayoutSaveLength()
|
||||
bool VValentinaSettings::GetDefLayoutSaveLength()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLayoutSaveLength(bool value)
|
||||
void VValentinaSettings::SetLayoutSaveLength(bool value)
|
||||
{
|
||||
setValue(*settingLayoutSaveLength, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetLayoutPreferOneSheetSolution() const
|
||||
bool VValentinaSettings::GetLayoutPreferOneSheetSolution() const
|
||||
{
|
||||
return value(*settingLayoutPreferOneSheetSolution, GetDefLayoutPreferOneSheetSolution()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefLayoutPreferOneSheetSolution()
|
||||
bool VValentinaSettings::GetDefLayoutPreferOneSheetSolution()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLayoutPreferOneSheetSolution(bool value)
|
||||
void VValentinaSettings::SetLayoutPreferOneSheetSolution(bool value)
|
||||
{
|
||||
setValue(*settingLayoutPreferOneSheetSolution, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetLayoutUnitePages() const
|
||||
bool VValentinaSettings::GetLayoutUnitePages() const
|
||||
{
|
||||
return value(*settingLayoutUnitePages, GetDefLayoutUnitePages()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefLayoutUnitePages()
|
||||
bool VValentinaSettings::GetDefLayoutUnitePages()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetLayoutUnitePages(bool value)
|
||||
void VValentinaSettings::SetLayoutUnitePages(bool value)
|
||||
{
|
||||
setValue(*settingLayoutUnitePages, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetIgnoreAllFields() const
|
||||
bool VValentinaSettings::GetIgnoreAllFields() const
|
||||
{
|
||||
return value(*settingIgnoreFields, GetDefIgnoreAllFields()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefIgnoreAllFields()
|
||||
bool VValentinaSettings::GetDefIgnoreAllFields()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetIgnoreAllFields(bool value)
|
||||
void VValentinaSettings::SetIgnoreAllFields(bool value)
|
||||
{
|
||||
setValue(*settingIgnoreFields, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetStripOptimization() const
|
||||
bool VValentinaSettings::GetStripOptimization() const
|
||||
{
|
||||
return value(*settingStripOptimization, GetDefStripOptimization()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefStripOptimization()
|
||||
bool VValentinaSettings::GetDefStripOptimization()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetStripOptimization(bool value)
|
||||
void VValentinaSettings::SetStripOptimization(bool value)
|
||||
{
|
||||
setValue(*settingStripOptimization, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint8 VSettings::GetMultiplier() const
|
||||
quint8 VValentinaSettings::GetMultiplier() const
|
||||
{
|
||||
return static_cast<quint8>(value(*settingMultiplier, GetDefMultiplier()).toUInt());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint8 VSettings::GetDefMultiplier()
|
||||
quint8 VValentinaSettings::GetDefMultiplier()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetMultiplier(quint8 value)
|
||||
void VValentinaSettings::SetMultiplier(quint8 value)
|
||||
{
|
||||
setValue(*settingMultiplier, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetTextAsPaths() const
|
||||
bool VValentinaSettings::GetTextAsPaths() const
|
||||
{
|
||||
return value(*settingTextAsPaths, GetDefTextAsPaths()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefTextAsPaths()
|
||||
bool VValentinaSettings::GetDefTextAsPaths()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetTextAsPaths(bool value)
|
||||
void VValentinaSettings::SetTextAsPaths(bool value)
|
||||
{
|
||||
setValue(*settingTextAsPaths, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QStringList VSettings::GetKnownMaterials() const
|
||||
QStringList VValentinaSettings::GetKnownMaterials() const
|
||||
{
|
||||
return value(*settingPatternKnownMaterials, QStringList()).toStringList();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetKnownMaterials(const QStringList &list)
|
||||
void VValentinaSettings::SetKnownMaterials(const QStringList &list)
|
||||
{
|
||||
setValue(*settingPatternKnownMaterials, list);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::IsRememberPatternMaterials() const
|
||||
bool VValentinaSettings::IsRememberPatternMaterials() const
|
||||
{
|
||||
return value(*settingPatternRememberMaterials, true).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetRememberPatternMaterials(bool value)
|
||||
void VValentinaSettings::SetRememberPatternMaterials(bool value)
|
||||
{
|
||||
setValue(*settingPatternRememberMaterials, value);
|
||||
}
|
||||
|
@ -569,10 +485,11 @@ void VSettings::SetRememberPatternMaterials(bool value)
|
|||
* internaly as mm so there is conversion beeing made.
|
||||
* @return tiled pdf margins
|
||||
*/
|
||||
QMarginsF VSettings::GetTiledPDFMargins(const Unit &unit) const
|
||||
QMarginsF VValentinaSettings::GetTiledPDFMargins(const Unit &unit) const
|
||||
{
|
||||
// default value is 10mm. We save the margins in mm in the setting.
|
||||
return UnitConvertor(ValueOrDef<QMarginsF>(*settingTiledPDFMargins, QMarginsF(10, 10, 10, 10)), Unit::Mm, unit);
|
||||
return UnitConvertor(ValueOrDef<QMarginsF>(*this, *settingTiledPDFMargins, QMarginsF(10, 10, 10, 10)), Unit::Mm,
|
||||
unit);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -582,7 +499,7 @@ QMarginsF VSettings::GetTiledPDFMargins(const Unit &unit) const
|
|||
* @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)
|
||||
void VValentinaSettings::SetTiledPDFMargins(const QMarginsF &value, const Unit &unit)
|
||||
{
|
||||
setValue(*settingTiledPDFMargins, QVariant::fromValue(UnitConvertor(value, unit, Unit::Mm)));
|
||||
}
|
||||
|
@ -594,9 +511,9 @@ void VSettings::SetTiledPDFMargins(const QMarginsF &value, const Unit &unit)
|
|||
* internaly as mm so there is conversion beeing made.
|
||||
* @return tiled pdf paper height
|
||||
*/
|
||||
qreal VSettings::GetTiledPDFPaperHeight(const Unit &unit) const
|
||||
qreal VValentinaSettings::GetTiledPDFPaperHeight(const Unit &unit) const
|
||||
{
|
||||
return UnitConvertor(ValueOrDef<qreal>(*settingTiledPDFPaperHeight, 297 /*A4*/), Unit::Mm, unit);
|
||||
return UnitConvertor(ValueOrDef<qreal>(*this, *settingTiledPDFPaperHeight, 297 /*A4*/), Unit::Mm, unit);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -605,7 +522,7 @@ qreal VSettings::GetTiledPDFPaperHeight(const Unit &unit) const
|
|||
* @param value in mm
|
||||
* @param unit unit of the given value
|
||||
*/
|
||||
void VSettings::SetTiledPDFPaperHeight(qreal value, const Unit &unit)
|
||||
void VValentinaSettings::SetTiledPDFPaperHeight(qreal value, const Unit &unit)
|
||||
{
|
||||
setValue(*settingTiledPDFPaperHeight, UnitConvertor(value, unit, Unit::Mm));
|
||||
}
|
||||
|
@ -617,9 +534,9 @@ void VSettings::SetTiledPDFPaperHeight(qreal value, const Unit &unit)
|
|||
* internaly as mm so there is conversion beeing made.
|
||||
* @return tiled pdf paper width
|
||||
*/
|
||||
qreal VSettings::GetTiledPDFPaperWidth(const Unit &unit) const
|
||||
qreal VValentinaSettings::GetTiledPDFPaperWidth(const Unit &unit) const
|
||||
{
|
||||
return UnitConvertor(ValueOrDef<qreal>(*settingTiledPDFPaperWidth, 210 /*A4*/), Unit::Mm, unit);
|
||||
return UnitConvertor(ValueOrDef<qreal>(*this, *settingTiledPDFPaperWidth, 210 /*A4*/), Unit::Mm, unit);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -628,13 +545,13 @@ qreal VSettings::GetTiledPDFPaperWidth(const Unit &unit) const
|
|||
* @param unit unit of the given value
|
||||
* @param value in mm
|
||||
*/
|
||||
void VSettings::SetTiledPDFPaperWidth(qreal value, const Unit &unit)
|
||||
void VValentinaSettings::SetTiledPDFPaperWidth(qreal value, const Unit &unit)
|
||||
{
|
||||
setValue(*settingTiledPDFPaperWidth, UnitConvertor(value,unit, Unit::Mm));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
PageOrientation VSettings::GetTiledPDFOrientation() const
|
||||
PageOrientation VValentinaSettings::GetTiledPDFOrientation() const
|
||||
{
|
||||
bool defaultValue = static_cast<bool>(PageOrientation::Portrait);
|
||||
bool result = value(*settingTiledPDFOrientation, defaultValue).toBool();
|
||||
|
@ -642,137 +559,69 @@ PageOrientation VSettings::GetTiledPDFOrientation() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetTiledPDFOrientation(PageOrientation value)
|
||||
void VValentinaSettings::SetTiledPDFOrientation(PageOrientation value)
|
||||
{
|
||||
setValue(*settingTiledPDFOrientation, static_cast<bool> (value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::IsDockWidgetGroupsActive() const
|
||||
bool VValentinaSettings::IsDockWidgetGroupsActive() const
|
||||
{
|
||||
return value(*settingdockWidgetGroupsActive, GetDefDockWidgetGroupsActive()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefDockWidgetGroupsActive()
|
||||
bool VValentinaSettings::GetDefDockWidgetGroupsActive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetDockWidgetGroupsActive(bool value)
|
||||
void VValentinaSettings::SetDockWidgetGroupsActive(bool value)
|
||||
{
|
||||
setValue(*settingdockWidgetGroupsActive, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::IsDockWidgetToolOptionsActive() const
|
||||
bool VValentinaSettings::IsDockWidgetToolOptionsActive() const
|
||||
{
|
||||
return value(*settingDockWidgetToolOptionsActive, GetDefDockWidgetToolOptionsActive()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefDockWidgetToolOptionsActive()
|
||||
bool VValentinaSettings::GetDefDockWidgetToolOptionsActive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetDockWidgetToolOptionsActive(bool value)
|
||||
void VValentinaSettings::SetDockWidgetToolOptionsActive(bool value)
|
||||
{
|
||||
setValue(*settingDockWidgetToolOptionsActive, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::IsDockWidgetPatternMessagesActive() const
|
||||
bool VValentinaSettings::IsDockWidgetPatternMessagesActive() const
|
||||
{
|
||||
return value(*settingDockWidgetPatternMessagesActive, GetDefDockWidgetPatternMessagesActive()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefDockWidgetPatternMessagesActive()
|
||||
bool VValentinaSettings::GetDefDockWidgetPatternMessagesActive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetDockWidgetPatternMessagesActive(bool value)
|
||||
void VValentinaSettings::SetDockWidgetPatternMessagesActive(bool value)
|
||||
{
|
||||
setValue(*settingDockWidgetPatternMessagesActive, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VSettings::GetPatternMessageFontSize(int fontSizeDef) const
|
||||
int VValentinaSettings::GetPatternMessageFontSize(int fontSizeDef) const
|
||||
{
|
||||
fontSizeDef = qBound(GetDefMinPatternMessageFontSize(), fontSizeDef, GetDefMaxPatternMessageFontSize());
|
||||
const int fontSize = value(*settingPatternMessagesFontSize, fontSizeDef).toInt();
|
||||
|
@ -780,56 +629,44 @@ int VSettings::GetPatternMessageFontSize(int fontSizeDef) const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VSettings::GetDefMinPatternMessageFontSize()
|
||||
int VValentinaSettings::GetDefMinPatternMessageFontSize()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VSettings::GetDefMaxPatternMessageFontSize()
|
||||
int VValentinaSettings::GetDefMaxPatternMessageFontSize()
|
||||
{
|
||||
return 40;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetPatternMessageFontSize(int size)
|
||||
void VValentinaSettings::SetPatternMessageFontSize(int size)
|
||||
{
|
||||
setValue(*settingPatternMessagesFontSize, qBound(GetDefMinPatternMessageFontSize(), size,
|
||||
GetDefMaxPatternMessageFontSize()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetAutoRefreshPatternMessage() const
|
||||
bool VValentinaSettings::GetAutoRefreshPatternMessage() const
|
||||
{
|
||||
return value(*settingAutoRefreshPatternMessage, true).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetAutoRefreshPatternMessage(bool value)
|
||||
void VValentinaSettings::SetAutoRefreshPatternMessage(bool value)
|
||||
{
|
||||
setValue(*settingAutoRefreshPatternMessage, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QSize VSettings::GetWatermarkEditorSize() const
|
||||
QSize VValentinaSettings::GetWatermarkEditorSize() const
|
||||
{
|
||||
return value(*settingWatermarkEditorSize, QSize(0, 0)).toSize();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetWatermarkEditorSize(const QSize &sz)
|
||||
void VValentinaSettings::SetWatermarkEditorSize(const QSize &sz)
|
||||
{
|
||||
setValue(*settingWatermarkEditorSize, sz);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<typename T>
|
||||
T VSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const
|
||||
{
|
||||
if (cache < 0)
|
||||
{
|
||||
cache = qBound(valueMin, ValueOrDef(setting, defValue), valueMax);
|
||||
}
|
||||
|
||||
return cache;
|
||||
}
|
|
@ -26,8 +26,8 @@
|
|||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef VSETTINGS_H
|
||||
#define VSETTINGS_H
|
||||
#ifndef VVALENTINASETTINGS_H
|
||||
#define VVALENTINASETTINGS_H
|
||||
|
||||
#include <QMetaObject>
|
||||
#include <QObject>
|
||||
|
@ -39,13 +39,13 @@
|
|||
#include "vcommonsettings.h"
|
||||
#include "../vlayout/vbank.h"
|
||||
|
||||
class VSettings : public VCommonSettings
|
||||
class VValentinaSettings : public VCommonSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||
VValentinaSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||
QObject *parent = nullptr);
|
||||
VSettings(const QString &fileName, Format format, QObject *parent = nullptr);
|
||||
VValentinaSettings(const QString &fileName, Format format, QObject *parent = nullptr);
|
||||
|
||||
QString GetLabelLanguage() const;
|
||||
void SetLabelLanguage(const QString &value);
|
||||
|
@ -54,12 +54,6 @@ public:
|
|||
QString GetPathLayout() const;
|
||||
void SetPathLayout(const QString &value);
|
||||
|
||||
bool GetGraphicalOutput() const;
|
||||
void SetGraphicalOutput(const bool &value);
|
||||
|
||||
bool IsOpenGLRender() const;
|
||||
void SetOpenGLRender(bool value);
|
||||
|
||||
// Layout settings
|
||||
qreal GetLayoutPaperHeight() const;
|
||||
void SetLayoutPaperHeight(qreal value);
|
||||
|
@ -153,36 +147,6 @@ public:
|
|||
PageOrientation GetTiledPDFOrientation() const;
|
||||
void SetTiledPDFOrientation(PageOrientation value);
|
||||
|
||||
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);
|
||||
|
||||
bool IsDockWidgetGroupsActive() const;
|
||||
static bool GetDefDockWidgetGroupsActive();
|
||||
void SetDockWidgetGroupsActive(bool value);
|
||||
|
@ -207,13 +171,7 @@ public:
|
|||
void SetWatermarkEditorSize(const QSize& sz);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VSettings)
|
||||
|
||||
template <typename T>
|
||||
T GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const;
|
||||
|
||||
template <class T>
|
||||
T ValueOrDef(const QString &setting, const T &defValue) const;
|
||||
Q_DISABLE_COPY(VValentinaSettings)
|
||||
};
|
||||
|
||||
#endif // VSETTINGS_H
|
||||
#endif // VVALENTINASETTINGS_H
|
|
@ -110,13 +110,13 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
|||
//----------------------------- Pattern Editing
|
||||
connect(ui->resetWarningsButton, &QPushButton::released, this, []()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
|
||||
settings->SetConfirmItemDelete(true);
|
||||
settings->SetConfirmFormatRewriting(true);
|
||||
});
|
||||
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
|
||||
ui->checkBoxFreeCurve->setChecked(settings->IsFreeCurveMode());
|
||||
ui->checkBoxZoomFitBestCurrentPP->setChecked(settings->IsDoubleClickZoomFitBestCurrentPP());
|
||||
|
@ -128,24 +128,24 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
|||
ui->darkModeCheck->setChecked(settings->GetDarkMode());
|
||||
|
||||
// Tab Scrolling
|
||||
ui->spinBoxDuration->setMinimum(VSettings::scrollingDurationMin);
|
||||
ui->spinBoxDuration->setMaximum(VSettings::scrollingDurationMax);
|
||||
ui->spinBoxDuration->setMinimum(VValentinaSettings::scrollingDurationMin);
|
||||
ui->spinBoxDuration->setMaximum(VValentinaSettings::scrollingDurationMax);
|
||||
ui->spinBoxDuration->setValue(settings->GetScrollingDuration());
|
||||
|
||||
ui->spinBoxUpdateInterval->setMinimum(VSettings::scrollingUpdateIntervalMin);
|
||||
ui->spinBoxUpdateInterval->setMaximum(VSettings::scrollingUpdateIntervalMax);
|
||||
ui->spinBoxUpdateInterval->setMinimum(VValentinaSettings::scrollingUpdateIntervalMin);
|
||||
ui->spinBoxUpdateInterval->setMaximum(VValentinaSettings::scrollingUpdateIntervalMax);
|
||||
ui->spinBoxUpdateInterval->setValue(settings->GetScrollingUpdateInterval());
|
||||
|
||||
ui->doubleSpinBoxSensor->setMinimum(VSettings::sensorMouseScaleMin);
|
||||
ui->doubleSpinBoxSensor->setMaximum(VSettings::sensorMouseScaleMax);
|
||||
ui->doubleSpinBoxSensor->setMinimum(VValentinaSettings::sensorMouseScaleMin);
|
||||
ui->doubleSpinBoxSensor->setMaximum(VValentinaSettings::sensorMouseScaleMax);
|
||||
ui->doubleSpinBoxSensor->setValue(settings->GetSensorMouseScale());
|
||||
|
||||
ui->doubleSpinBoxWheel->setMinimum(VSettings::wheelMouseScaleMin);
|
||||
ui->doubleSpinBoxWheel->setMaximum(VSettings::wheelMouseScaleMax);
|
||||
ui->doubleSpinBoxWheel->setMinimum(VValentinaSettings::wheelMouseScaleMin);
|
||||
ui->doubleSpinBoxWheel->setMaximum(VValentinaSettings::wheelMouseScaleMax);
|
||||
ui->doubleSpinBoxWheel->setValue(settings->GetWheelMouseScale());
|
||||
|
||||
ui->doubleSpinBoxAcceleration->setMinimum(VSettings::scrollingAccelerationMin);
|
||||
ui->doubleSpinBoxAcceleration->setMaximum(VSettings::scrollingAccelerationMax);
|
||||
ui->doubleSpinBoxAcceleration->setMinimum(VValentinaSettings::scrollingAccelerationMin);
|
||||
ui->doubleSpinBoxAcceleration->setMaximum(VValentinaSettings::scrollingAccelerationMax);
|
||||
ui->doubleSpinBoxAcceleration->setValue(settings->GetScrollingAcceleration());
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ QStringList PreferencesConfigurationPage::Apply()
|
|||
{
|
||||
// Tab General
|
||||
QStringList preferences;
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
settings->SetAutosaveState(ui->autoSaveCheck->isChecked());
|
||||
settings->SetAutosaveTime(ui->autoTime->value());
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "preferencespathpage.h"
|
||||
#include "ui_preferencespathpage.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
#include "../../core/vvalentinasettings.h"
|
||||
#include "../../core/vapplication.h"
|
||||
|
||||
#include <QDir>
|
||||
|
@ -65,7 +65,7 @@ PreferencesPathPage::~PreferencesPathPage()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QStringList PreferencesPathPage::Apply()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
settings->SetPathIndividualMeasurements(ui->pathTable->item(0, 1)->text());
|
||||
settings->SetPathMultisizeMeasurements(ui->pathTable->item(1, 1)->text());
|
||||
settings->SetPathPattern(ui->pathTable->item(2, 1)->text());
|
||||
|
@ -105,13 +105,13 @@ void PreferencesPathPage::DefaultPath()
|
|||
path = VCommonSettings::GetDefPathMultisizeMeasurements();
|
||||
break;
|
||||
case 2: // pattern path
|
||||
path = VSettings::GetDefPathPattern();
|
||||
path = VValentinaSettings::GetDefPathPattern();
|
||||
break;
|
||||
case 0: // individual measurements
|
||||
path = VCommonSettings::GetDefPathIndividualMeasurements();
|
||||
break;
|
||||
case 3: // layout path
|
||||
path = VSettings::GetDefPathLayout();
|
||||
path = VValentinaSettings::GetDefPathLayout();
|
||||
break;
|
||||
case 4: // templates
|
||||
path = VCommonSettings::GetDefPathTemplate();
|
||||
|
@ -206,7 +206,7 @@ void PreferencesPathPage::InitTable()
|
|||
ui->pathTable->setRowCount(7);
|
||||
ui->pathTable->setColumnCount(2);
|
||||
|
||||
const VSettings *settings = qApp->ValentinaSettings();
|
||||
const VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(0, 0, new QTableWidgetItem(tr("My Individual Measurements")));
|
||||
|
|
|
@ -63,7 +63,7 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
|
|||
ui->setupUi(this);
|
||||
RetranslateUi();
|
||||
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
|
||||
ui->graphOutputCheck->setChecked(settings->GetGraphicalOutput());
|
||||
ui->checkBoxOpenGLRender->setChecked(settings->IsOpenGLRender());
|
||||
|
@ -125,7 +125,7 @@ QStringList PreferencesPatternPage::Apply()
|
|||
{
|
||||
QStringList preferences;
|
||||
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
|
||||
// Scene antialiasing
|
||||
if (settings->GetGraphicalOutput() != ui->graphOutputCheck->isChecked())
|
||||
|
@ -200,7 +200,7 @@ void PreferencesPatternPage::changeEvent(QEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PreferencesPatternPage::EditDateTimeFormats()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
|
||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
||||
if (button == ui->pushButtonEditDateFormats)
|
||||
|
@ -230,7 +230,7 @@ void PreferencesPatternPage::ManageKnownMaterials()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PreferencesPatternPage::InitLabelDateTimeFormats()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
|
||||
InitComboBoxFormats(ui->comboBoxDateFormats,
|
||||
VCommonSettings::PredefinedDateFormats() + settings->GetUserDefinedDateFormats(),
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "dialogfinalmeasurements.h"
|
||||
#include "ui_dialogfinalmeasurements.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
#include "../core/vvalentinasettings.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../qmuparser/qmudef.h"
|
||||
#include "../qmuparser/qmutokenparser.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "dialogincrements.h"
|
||||
#include "ui_dialogincrements.h"
|
||||
#include "../vwidgets/vwidgetpopup.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
#include "../core/vvalentinasettings.h"
|
||||
#include "../qmuparser/qmudef.h"
|
||||
#include "../qmuparser/qmutokenparser.h"
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "dialoglayoutscale.h"
|
||||
#include "ui_dialoglayoutscale.h"
|
||||
#include "../core/vapplication.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
#include "../core/vvalentinasettings.h"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
|
@ -180,7 +180,7 @@ void DialogLayoutScale::VerticalScaleChanged(double d)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLayoutScale::ReadSettings()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
const Unit unit = qApp->patternUnit();
|
||||
|
||||
// read Margins top, right, bottom, left
|
||||
|
@ -200,7 +200,7 @@ void DialogLayoutScale::ReadSettings()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLayoutScale::WriteSettings() const
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
const Unit unit = qApp->patternUnit();
|
||||
|
||||
// write Margins top, right, bottom, left
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "ui_dialoglayoutsettings.h"
|
||||
#include "../core/vapplication.h"
|
||||
#include "../ifc/xml/vdomdocument.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
#include "../core/vvalentinasettings.h"
|
||||
#include "../vmisc/vmath.h"
|
||||
#include "../vlayout/vlayoutgenerator.h"
|
||||
|
||||
|
@ -698,17 +698,17 @@ void DialogLayoutSettings::RestoreDefaults()
|
|||
InitPrinter();
|
||||
ui->comboBoxPrinter->blockSignals(false);
|
||||
|
||||
SetLayoutWidth(VSettings::GetDefLayoutWidth());
|
||||
SetGroup(VSettings::GetDefLayoutGroup());
|
||||
SetFollowGrainline(VSettings::GetDefLayoutFollowGrainline());
|
||||
SetManualPriority(VSettings::GetDefLayoutManualPriority());
|
||||
SetLayoutWidth(VValentinaSettings::GetDefLayoutWidth());
|
||||
SetGroup(VValentinaSettings::GetDefLayoutGroup());
|
||||
SetFollowGrainline(VValentinaSettings::GetDefLayoutFollowGrainline());
|
||||
SetManualPriority(VValentinaSettings::GetDefLayoutManualPriority());
|
||||
SetFields(GetDefPrinterFields());
|
||||
SetIgnoreAllFields(VSettings::GetDefIgnoreAllFields());
|
||||
SetMultiplier(VSettings::GetDefMultiplier());
|
||||
SetNestingTime(VSettings::GetDefNestingTime());
|
||||
SetEfficiencyCoefficient(VSettings::GetDefEfficiencyCoefficient());
|
||||
SetNestQuantity(VSettings::GetDefLayoutNestQuantity());
|
||||
SetPreferOneSheetSolution(VSettings::GetDefLayoutPreferOneSheetSolution());
|
||||
SetIgnoreAllFields(VValentinaSettings::GetDefIgnoreAllFields());
|
||||
SetMultiplier(VValentinaSettings::GetDefMultiplier());
|
||||
SetNestingTime(VValentinaSettings::GetDefNestingTime());
|
||||
SetEfficiencyCoefficient(VValentinaSettings::GetDefEfficiencyCoefficient());
|
||||
SetNestQuantity(VValentinaSettings::GetDefLayoutNestQuantity());
|
||||
SetPreferOneSheetSolution(VValentinaSettings::GetDefLayoutPreferOneSheetSolution());
|
||||
|
||||
CorrectMaxFileds();
|
||||
IgnoreAllFields(ui->checkBoxIgnoreFileds->isChecked());
|
||||
|
@ -1019,7 +1019,7 @@ void DialogLayoutSettings::MinimumLayoutSize()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLayoutSettings::ReadSettings()
|
||||
{
|
||||
const VSettings *settings = qApp->ValentinaSettings();
|
||||
const VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
SetLayoutWidth(settings->GetLayoutWidth());
|
||||
SetNestingTime(settings->GetNestingTime());
|
||||
SetEfficiencyCoefficient(settings->GetEfficiencyCoefficient());
|
||||
|
@ -1051,7 +1051,7 @@ void DialogLayoutSettings::ReadSettings()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLayoutSettings::WriteSettings() const
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
settings->SetLayoutWidth(GetLayoutWidth());
|
||||
settings->SetLayoutGroup(GetGroup());
|
||||
settings->SetLayoutPaperHeight(GetPaperHeight());
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "dialognewpattern.h"
|
||||
#include "ui_dialognewpattern.h"
|
||||
#include "../core/vapplication.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
#include "../core/vvalentinasettings.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
|
|
@ -81,7 +81,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
|||
|
||||
SCASSERT(doc != nullptr)
|
||||
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
settings->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
patternMaterials = doc->GetPatternMaterials();
|
||||
|
@ -951,7 +951,7 @@ void DialogPatternProperties::EditLabel()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::ManagePatternMaterials()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
|
||||
DialogPatternMaterials editor(patternMaterials, settings->IsRememberPatternMaterials());
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "dialogsavelayout.h"
|
||||
#include "ui_dialogsavelayout.h"
|
||||
#include "../core/vapplication.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
#include "../core/vvalentinasettings.h"
|
||||
#include "../ifc/exception/vexception.h"
|
||||
|
||||
#include <QDir>
|
||||
|
@ -903,7 +903,7 @@ void DialogSaveLayout::RemoveFormatFromList(LayoutExportFormats format)
|
|||
*/
|
||||
void DialogSaveLayout::ReadSettings()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
const Unit unit = qApp->patternUnit();
|
||||
|
||||
// read Margins top, right, bottom, left
|
||||
|
@ -957,7 +957,7 @@ void DialogSaveLayout::WriteSettings() const
|
|||
return;
|
||||
}
|
||||
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
const Unit unit = qApp->patternUnit();
|
||||
|
||||
// write Margins top, right, bottom, left
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "version.h"
|
||||
#include "core/vapplication.h"
|
||||
#include "../vmisc/customevents.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
#include "core/vvalentinasettings.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/qxtcsvmodel.h"
|
||||
#include "../vmisc/vmodifierkey.h"
|
||||
|
@ -301,7 +301,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
connect(ui->toolButtonMessagesZoomInFont, &QToolButton::clicked, this, [this]()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
QFont f = ui->plainTextEditPatternMessages->font();
|
||||
if (f.pointSize() < settings->GetDefMaxPatternMessageFontSize())
|
||||
{
|
||||
|
@ -313,7 +313,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
connect(ui->toolButtonMessagesZoomOutFont, &QToolButton::clicked, this, [this]()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
QFont f = ui->plainTextEditPatternMessages->font();
|
||||
if (f.pointSize() > settings->GetDefMinPatternMessageFontSize())
|
||||
{
|
||||
|
@ -2195,7 +2195,7 @@ void MainWindow::ToolBarTools()
|
|||
ui->actionIncreaseLabelFont->setShortcut(QKeySequence(Qt::ShiftModifier + Qt::Key_Plus));
|
||||
connect(ui->actionIncreaseLabelFont, &QAction::triggered, this, [this]()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
settings->SetLabelFontSize(settings->GetLabelFontSize() + 1);
|
||||
if (sceneDraw)
|
||||
{
|
||||
|
@ -2211,7 +2211,7 @@ void MainWindow::ToolBarTools()
|
|||
ui->actionDecreaseLabelFont->setShortcut(QKeySequence(Qt::ShiftModifier + Qt::Key_Minus));
|
||||
connect(ui->actionDecreaseLabelFont, &QAction::triggered, this, [this]()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
settings->SetLabelFontSize(settings->GetLabelFontSize() - 1);
|
||||
if (sceneDraw)
|
||||
{
|
||||
|
@ -2227,7 +2227,7 @@ void MainWindow::ToolBarTools()
|
|||
ui->actionOriginalLabelFont->setShortcut(QKeySequence(Qt::ShiftModifier + Qt::Key_0));
|
||||
connect(ui->actionOriginalLabelFont, &QAction::triggered, this, [this]()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
settings->SetLabelFontSize(settings->GetDefLabelFontSize());
|
||||
if (sceneDraw)
|
||||
{
|
||||
|
@ -4172,7 +4172,7 @@ void MainWindow::setCurrentFile(const QString &fileName)
|
|||
if (not qApp->GetPatternPath().isEmpty() && VApplication::IsGUIMode())
|
||||
{
|
||||
qCDebug(vMainWindow, "Updating recent file list.");
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
QStringList files = settings->GetRecentFileList();
|
||||
files.removeAll(fileName);
|
||||
files.prepend(fileName);
|
||||
|
@ -4201,7 +4201,7 @@ void MainWindow::setCurrentFile(const QString &fileName)
|
|||
void MainWindow::ReadSettings()
|
||||
{
|
||||
qCDebug(vMainWindow, "Reading settings.");
|
||||
const VSettings *settings = qApp->ValentinaSettings();
|
||||
const VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
|
||||
if (settings->status() == QSettings::NoError)
|
||||
{
|
||||
|
@ -4243,7 +4243,7 @@ void MainWindow::WriteSettings()
|
|||
{
|
||||
ActionDraw(true);
|
||||
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
settings->SetGeometry(saveGeometry());
|
||||
settings->SetWindowState(saveState());
|
||||
settings->SetToolbarsState(saveState(APP_VERSION));
|
||||
|
|
|
@ -1820,7 +1820,7 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr
|
|||
}
|
||||
else
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
VValentinaSettings *settings = qApp->ValentinaSettings();
|
||||
pageMargin = QMarginsF(settings->GetTiledPDFMargins(Unit::Mm));
|
||||
orientation = settings->GetTiledPDFOrientation();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "../ifc/exception/vexceptionundo.h"
|
||||
#include "../ifc/xml/vpatternconverter.h"
|
||||
#include "../vmisc/customevents.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
#include "../core/vvalentinasettings.h"
|
||||
#include "../vmisc/vmath.h"
|
||||
#include "../vmisc/projectversion.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
|
|
|
@ -37,7 +37,17 @@
|
|||
#endif
|
||||
#define qApp (static_cast<TestVApplication*>(QCoreApplication::instance()))
|
||||
|
||||
class VTestSettings;
|
||||
class VTestSettings : public VCommonSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VTestSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||
QObject *parent = nullptr)
|
||||
: VCommonSettings(format, scope, organization, application, parent)
|
||||
{
|
||||
qRegisterMetaTypeStreamOperators<QMarginsF>("QMarginsF");
|
||||
}
|
||||
};
|
||||
|
||||
class TestVApplication : public VAbstractApplication
|
||||
{
|
||||
|
@ -50,7 +60,7 @@ public:
|
|||
setApplicationName("ValentinaTest");
|
||||
setOrganizationName(VER_COMPANYNAME_STR);
|
||||
|
||||
OpenSettings();
|
||||
TestVApplication::OpenSettings();
|
||||
}
|
||||
|
||||
virtual ~TestVApplication() Q_DECL_EQ_DEFAULT;
|
||||
|
@ -62,8 +72,8 @@ public:
|
|||
|
||||
virtual void OpenSettings() override
|
||||
{
|
||||
settings = new VSettings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(),
|
||||
QCoreApplication::applicationName(), this);
|
||||
settings = new VTestSettings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(),
|
||||
QCoreApplication::applicationName(), this);
|
||||
}
|
||||
|
||||
virtual bool IsAppInGUIMode() const override
|
||||
|
@ -88,16 +98,4 @@ private:
|
|||
VTranslateVars *m_trVars;
|
||||
};
|
||||
|
||||
class VTestSettings : public VCommonSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VTestSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||
QObject *parent = nullptr)
|
||||
: VCommonSettings(format, scope, organization, application, parent)
|
||||
{
|
||||
qRegisterMetaTypeStreamOperators<QMarginsF>("QMarginsF");
|
||||
}
|
||||
};
|
||||
|
||||
#endif // TESTVAPPLICATION_H
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "def.h"
|
||||
#include "vcommonsettings.h"
|
||||
#include "vlockguard.h"
|
||||
#include "vsettings.h"
|
||||
|
||||
class QUndoStack;
|
||||
class VAbstractApplication;// use in define
|
||||
|
|
|
@ -47,6 +47,26 @@
|
|||
#include "../vmisc/compatibility.h"
|
||||
#include "../vpatterndb/pmsystems.h"
|
||||
|
||||
const int VCommonSettings::defaultScrollingDuration = 300;
|
||||
const int VCommonSettings::scrollingDurationMin = 100;
|
||||
const int VCommonSettings::scrollingDurationMax = 1000;
|
||||
|
||||
const int VCommonSettings::defaultScrollingUpdateInterval = 30;
|
||||
const int VCommonSettings::scrollingUpdateIntervalMin = 10;
|
||||
const int VCommonSettings::scrollingUpdateIntervalMax = 100;
|
||||
|
||||
const qreal VCommonSettings::defaultSensorMouseScale = 2.0;
|
||||
const qreal VCommonSettings::sensorMouseScaleMin = 1.0;
|
||||
const qreal VCommonSettings::sensorMouseScaleMax = 10.0;
|
||||
|
||||
const qreal VCommonSettings::defaultWheelMouseScale = 45.0;
|
||||
const qreal VCommonSettings::wheelMouseScaleMin = 1.0;
|
||||
const qreal VCommonSettings::wheelMouseScaleMax = 100.0;
|
||||
|
||||
const qreal VCommonSettings::defaultScrollingAcceleration = 1.3;
|
||||
const qreal VCommonSettings::scrollingAccelerationMin = 1.0;
|
||||
const qreal VCommonSettings::scrollingAccelerationMax = 10.0;
|
||||
|
||||
namespace
|
||||
{
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsIndividualMeasurements, (QLatin1String("paths/individual_measurements")))
|
||||
|
@ -81,6 +101,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowCurveDetails, (QLatin
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternPieceShowMainPath, (QLatin1String("pattern/pieceShowMainPath")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFontSize, (QLatin1String("pattern/labelFontSize")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideLabels, (QLatin1String("pattern/hideLabels")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUseOpenGLRender, (QLatin1String("pattern/useOpenGLRender")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, (QLatin1String("pattern/graphicalOutput")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRecentFileList, (QLatin1String("recentFileList")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRestoreFileList, (QLatin1String("restoreFileList")))
|
||||
|
@ -105,12 +127,24 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserDateFormats, (QLatin1St
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelTimeFormat, (QLatin1String("label/timeFormat")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserTimeFormats, (QLatin1String("label/userTimeFormats")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingDuration, (QLatin1String("scrolling/duration")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval, (QLatin1String("scrolling/updateInterval")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingSensorMouseScale,
|
||||
(QLatin1String("scrolling/sensorMouseScale")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale, (QLatin1String("scrolling/wheelMouseScale")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration, (QLatin1String("scrolling/acceleration")))
|
||||
|
||||
// Reading settings file is very expensive, cache curve approximation to speed up getting value
|
||||
qreal curveApproximationCached = -1;
|
||||
Q_GLOBAL_STATIC(QString, localeCached)
|
||||
qreal lineWidthCached = 0;
|
||||
int labelFontSizeCached = 0;
|
||||
int pieceShowMainPath = -1;
|
||||
int scrollingDurationCached = -1;
|
||||
int scrollingUpdateIntervalCached = -1;
|
||||
qreal scrollingSensorMouseScaleCached = -1;
|
||||
qreal scrollingWheelMouseScaleCached = -1;
|
||||
qreal scrollingAccelerationCached = -1;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QStringList ClearFormats(const QStringList &predefinedFormats, QStringList formats)
|
||||
|
@ -1219,3 +1253,118 @@ qreal VCommonSettings::WidthHairLine() const
|
|||
{
|
||||
return WidthMainLine()/3.0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VCommonSettings::GetScrollingDuration() const
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
return GetCachedValue(settings, scrollingDurationCached, *settingScrollingDuration, defaultScrollingDuration,
|
||||
scrollingDurationMin, scrollingDurationMax);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VCommonSettings::SetScrollingDuration(int duration)
|
||||
{
|
||||
scrollingDurationCached = qBound(scrollingDurationMin, duration, scrollingDurationMax);
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
settings.setValue(*settingScrollingDuration, scrollingDurationCached);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VCommonSettings::GetScrollingUpdateInterval() const
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
return GetCachedValue(settings, scrollingUpdateIntervalCached, *settingScrollingUpdateInterval,
|
||||
defaultScrollingUpdateInterval, scrollingUpdateIntervalMin, scrollingUpdateIntervalMax);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VCommonSettings::SetScrollingUpdateInterval(int updateInterval)
|
||||
{
|
||||
scrollingUpdateIntervalCached = qBound(scrollingUpdateIntervalMin, updateInterval, scrollingUpdateIntervalMax);
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
settings.setValue(*settingScrollingUpdateInterval, scrollingUpdateIntervalCached);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VCommonSettings::GetSensorMouseScale() const
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
return GetCachedValue(settings, scrollingSensorMouseScaleCached, *settingScrollingSensorMouseScale,
|
||||
defaultSensorMouseScale, sensorMouseScaleMin, sensorMouseScaleMax);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VCommonSettings::SetSensorMouseScale(qreal scale)
|
||||
{
|
||||
scrollingSensorMouseScaleCached = qBound(sensorMouseScaleMin, scale, sensorMouseScaleMax);
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
settings.setValue(*settingScrollingSensorMouseScale, scrollingSensorMouseScaleCached);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VCommonSettings::GetWheelMouseScale() const
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
return GetCachedValue(settings, scrollingWheelMouseScaleCached, *settingScrollingWheelMouseScale,
|
||||
defaultWheelMouseScale, wheelMouseScaleMin, wheelMouseScaleMax);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VCommonSettings::SetWheelMouseScale(qreal scale)
|
||||
{
|
||||
scrollingWheelMouseScaleCached = qBound(wheelMouseScaleMin, scale, wheelMouseScaleMax);
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
settings.setValue(*settingScrollingWheelMouseScale, scrollingWheelMouseScaleCached);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VCommonSettings::GetScrollingAcceleration() const
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
return GetCachedValue(settings, scrollingAccelerationCached, *settingScrollingAcceleration,
|
||||
defaultScrollingAcceleration, scrollingAccelerationMin, scrollingAccelerationMax);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VCommonSettings::SetScrollingAcceleration(qreal acceleration)
|
||||
{
|
||||
scrollingAccelerationCached = qBound(scrollingAccelerationMin, acceleration, scrollingAccelerationMax);
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
settings.setValue(*settingScrollingAcceleration, scrollingAccelerationCached);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VCommonSettings::IsOpenGLRender() const
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
return settings.value(*settingPatternUseOpenGLRender, 0).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VCommonSettings::SetOpenGLRender(bool value)
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
settings.setValue(*settingPatternUseOpenGLRender, value);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VCommonSettings::GetGraphicalOutput() const
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
return settings.value(*settingPatternGraphicalOutput, 1).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VCommonSettings::SetGraphicalOutput(const bool &value)
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
settings.setValue(*settingPatternGraphicalOutput, value);
|
||||
settings.sync();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#include <QStringList>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "../vlayout/vbank.h"
|
||||
|
||||
class VCommonSettings : public QSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -225,6 +227,52 @@ public:
|
|||
void SetLineWidth(qreal width);
|
||||
qreal WidthMainLine() const;
|
||||
qreal WidthHairLine() const;
|
||||
|
||||
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);
|
||||
|
||||
bool IsOpenGLRender() const;
|
||||
void SetOpenGLRender(bool value);
|
||||
|
||||
bool GetGraphicalOutput() const;
|
||||
void SetGraphicalOutput(const bool &value);
|
||||
|
||||
protected:
|
||||
|
||||
template <typename T>
|
||||
static T GetCachedValue(const QSettings &settings, T &cache, const QString &setting, T defValue, T valueMin,
|
||||
T valueMax);
|
||||
|
||||
template <class T>
|
||||
static T ValueOrDef(const QSettings &settings, const QString &setting, const T &defValue);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VCommonSettings)
|
||||
};
|
||||
|
@ -247,4 +295,42 @@ inline qreal VCommonSettings::MaximalLineWidth()
|
|||
return 5.0; // mm
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<typename T>
|
||||
T VCommonSettings::GetCachedValue(const QSettings &settings, T &cache, const QString &setting, T defValue, T valueMin,
|
||||
T valueMax)
|
||||
{
|
||||
if (cache < 0)
|
||||
{
|
||||
cache = qBound(valueMin, ValueOrDef(settings, setting, defValue), valueMax);
|
||||
}
|
||||
|
||||
return cache;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
inline T VCommonSettings::ValueOrDef(const QSettings &settings, const QString &setting, const T &defValue)
|
||||
{
|
||||
const QVariant val = settings.value(setting, QVariant::fromValue(defValue));
|
||||
return val.canConvert<T>() ? val.value<T>() : defValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <>
|
||||
inline Cases VCommonSettings::ValueOrDef<Cases>(const QSettings &settings, const QString &setting,
|
||||
const Cases &defValue)
|
||||
{
|
||||
const QVariant val = settings.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);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // VCOMMONSETTINGS_H
|
||||
|
|
|
@ -3,18 +3,15 @@
|
|||
|
||||
SOURCES += \
|
||||
$$PWD/def.cpp \
|
||||
$$PWD/vsettings.cpp \
|
||||
$$PWD/vabstractapplication.cpp \
|
||||
$$PWD/projectversion.cpp \
|
||||
$$PWD/vcommonsettings.cpp \
|
||||
$$PWD/vtapesettings.cpp \
|
||||
$$PWD/commandoptions.cpp \
|
||||
$$PWD/qxtcsvmodel.cpp \
|
||||
$$PWD/vtablesearch.cpp \
|
||||
$$PWD/dialogs/dialogexporttocsv.cpp \
|
||||
$$PWD/literals.cpp \
|
||||
$$PWD/vmodifierkey.cpp \
|
||||
$$PWD/vpuzzlesettings.cpp
|
||||
$$PWD/vmodifierkey.cpp
|
||||
|
||||
*msvc*:SOURCES += $$PWD/stable.cpp
|
||||
|
||||
|
@ -29,11 +26,9 @@ HEADERS += \
|
|||
$$PWD/stable.h \
|
||||
$$PWD/def.h \
|
||||
$$PWD/vmath.h \
|
||||
$$PWD/vsettings.h \
|
||||
$$PWD/vabstractapplication.h \
|
||||
$$PWD/projectversion.h \
|
||||
$$PWD/vcommonsettings.h \
|
||||
$$PWD/vtapesettings.h \
|
||||
$$PWD/debugbreak.h \
|
||||
$$PWD/vlockguard.h \
|
||||
$$PWD/vsysexits.h \
|
||||
|
@ -51,8 +46,7 @@ HEADERS += \
|
|||
$$PWD/vdatastreamenum.h \
|
||||
$$PWD/vmodifierkey.h \
|
||||
$$PWD/typedef.h \
|
||||
$$PWD/backport/qscopeguard.h \
|
||||
$$PWD/vpuzzlesettings.h
|
||||
$$PWD/backport/qscopeguard.h
|
||||
|
||||
contains(DEFINES, APPIMAGE) {
|
||||
SOURCES += \
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpuzzlesettings.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 16 2, 2020
|
||||
**
|
||||
** @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) 2020 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 "vpuzzlesettings.h"
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPuzzleSettings::VPuzzleSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
||||
QObject *parent)
|
||||
:VCommonSettings(format, scope, organization, application, parent)
|
||||
{
|
||||
|
||||
}
|
|
@ -56,7 +56,7 @@
|
|||
#include "vsimplecurve.h"
|
||||
#include "vcontrolpointspline.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "vabstractmainwindow.h"
|
||||
|
||||
const qreal maxSceneSize = ((20.0 * 1000.0) / 25.4) * PrintDPI; // 20 meters in pixels
|
||||
|
@ -70,7 +70,7 @@ qreal ScrollingSteps(QWheelEvent* wheel_event)
|
|||
const QPoint numPixels = wheel_event->pixelDelta();
|
||||
const QPoint numDegrees = wheel_event->angleDelta() / 8;
|
||||
qreal numSteps = 0;
|
||||
VSettings *settings = qobject_cast<VSettings *>(qApp->Settings());
|
||||
VCommonSettings *settings = qApp->Settings();
|
||||
|
||||
if (not numPixels.isNull())
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ qreal PrepareScrolling(qreal scheduledScrollings, QWheelEvent *wheel_event)
|
|||
scheduledScrollings += numSteps;
|
||||
}
|
||||
|
||||
scheduledScrollings *= qobject_cast<VSettings *>(qApp->Settings())->GetScrollingAcceleration();
|
||||
scheduledScrollings *= qApp->Settings()->GetScrollingAcceleration();
|
||||
|
||||
return scheduledScrollings;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ void GraphicsViewZoom::set_zoom_factor_base(double value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void GraphicsViewZoom::InitScrollingAnimation()
|
||||
{
|
||||
VSettings *settings = qobject_cast<VSettings *>(qApp->Settings());
|
||||
VCommonSettings *settings = qApp->Settings();
|
||||
|
||||
if (not verticalScrollAnim.isNull())
|
||||
{
|
||||
|
@ -427,7 +427,7 @@ VMainGraphicsView::VMainGraphicsView(QWidget *parent)
|
|||
m_oldCursor(),
|
||||
m_currentCursor(Qt::ArrowCursor)
|
||||
{
|
||||
VSettings *settings = qobject_cast<VSettings *>(qApp->Settings());
|
||||
VCommonSettings *settings = qApp->Settings();
|
||||
if (settings && settings->IsOpenGLRender())
|
||||
{
|
||||
QOpenGLWidget *viewport = new QOpenGLWidget();
|
||||
|
|
Loading…
Reference in New Issue
Block a user