Save show curve details state between sessions.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-10-29 15:13:13 +02:00
parent 1cd126856c
commit 8309fa8c7a
7 changed files with 24 additions and 4 deletions

View File

@ -4208,10 +4208,12 @@ void MainWindow::CreateActions()
} }
}); });
ui->actionShowCurveDetails->setChecked(qApp->ValentinaSettings()->IsShowCurveDetails());
connect(ui->actionShowCurveDetails, &QAction::triggered, this, [this](bool checked) connect(ui->actionShowCurveDetails, &QAction::triggered, this, [this](bool checked)
{ {
ui->view->itemClicked(nullptr); ui->view->itemClicked(nullptr);
sceneDraw->EnableDetailsMode(checked); sceneDraw->EnableDetailsMode(checked);
qApp->ValentinaSettings()->SetShowCurveDetails(checked);
}); });
connect(ui->actionLoadIndividual, &QAction::triggered, this, &MainWindow::LoadIndividual); connect(ui->actionLoadIndividual, &QAction::triggered, this, &MainWindow::LoadIndividual);

View File

@ -70,6 +70,7 @@ const QString settingDoublePassmark = QStringLiteral("pattern/do
const QString settingPatternDefaultSeamAllowance = QStringLiteral("pattern/defaultSeamAllowance"); const QString settingPatternDefaultSeamAllowance = QStringLiteral("pattern/defaultSeamAllowance");
const QString settingPatternLabelFont = QStringLiteral("pattern/labelFont"); const QString settingPatternLabelFont = QStringLiteral("pattern/labelFont");
const QString settingPatternCurveApproximationScale = QStringLiteral("pattern/curveApproximationScale"); const QString settingPatternCurveApproximationScale = QStringLiteral("pattern/curveApproximationScale");
const QString settingPatternShowCurveDetails = QStringLiteral("pattern/showCurveDetails");
const QString settingGeneralRecentFileList = QStringLiteral("recentFileList"); const QString settingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString settingGeneralRestoreFileList = QStringLiteral("restoreFileList"); const QString settingGeneralRestoreFileList = QStringLiteral("restoreFileList");
@ -986,3 +987,15 @@ void VCommonSettings::SetCurveApproximationScale(qreal value)
setValue(settingPatternCurveApproximationScale, value); setValue(settingPatternCurveApproximationScale, value);
} }
} }
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::IsShowCurveDetails() const
{
return value(settingPatternShowCurveDetails, false).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetShowCurveDetails(bool value)
{
setValue(settingPatternShowCurveDetails, value);
}

View File

@ -189,6 +189,8 @@ public:
qreal GetCurveApproximationScale() const; qreal GetCurveApproximationScale() const;
void SetCurveApproximationScale(qreal value); void SetCurveApproximationScale(qreal value);
bool IsShowCurveDetails() const;
void SetShowCurveDetails(bool value);
private: private:
Q_DISABLE_COPY(VCommonSettings) Q_DISABLE_COPY(VCommonSettings)
}; };

View File

@ -61,7 +61,7 @@ VAbstractSpline::VAbstractSpline(VAbstractPattern *doc, VContainer *data, quint3
controlPoints(), controlPoints(),
sceneType(SceneObject::Unknown), sceneType(SceneObject::Unknown),
m_isHovered(false), m_isHovered(false),
detailsMode(false), detailsMode(qApp->Settings()->IsShowCurveDetails()),
m_parentRefresh(false) m_parentRefresh(false)
{ {
InitDefShape(); InitDefShape();

View File

@ -118,7 +118,7 @@ VToolSpline::VToolSpline(VToolSplineInitData initData, QGraphicsItem *parent)
freeAngle2, freeLength2, this); freeAngle2, freeLength2, this);
InitControlPoint(controlPoint2); InitControlPoint(controlPoint2);
ShowHandles(false); ShowHandles(detailsMode);
ToolCreation(initData.typeCreation); ToolCreation(initData.typeCreation);
} }

View File

@ -126,7 +126,7 @@ VToolSplinePath::VToolSplinePath(const VToolSplinePathInitData &initData, QGraph
InitControlPoint(controlPoint); InitControlPoint(controlPoint);
} }
ShowHandles(false); ShowHandles(detailsMode);
ToolCreation(initData.typeCreation); ToolCreation(initData.typeCreation);
} }

View File

@ -46,7 +46,10 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VToolCut::VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula, VToolCut::VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &curveCutId, QGraphicsItem *parent) const quint32 &curveCutId, QGraphicsItem *parent)
:VToolSinglePoint(doc, data, id, parent), formula(formula), curveCutId(curveCutId), detailsMode(false) : VToolSinglePoint(doc, data, id, parent),
formula(formula),
curveCutId(curveCutId),
detailsMode(qApp->Settings()->IsShowCurveDetails())
{ {
Q_ASSERT_X(curveCutId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712 Q_ASSERT_X(curveCutId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712
} }