From 0ebf61184a6fbd12b8c8eebec10f8af2838544ad Mon Sep 17 00:00:00 2001 From: wandererfan Date: Thu, 10 Nov 2022 16:08:53 -0500 Subject: [PATCH] [TD]Section dialogs minor fixes - make simple and complex dialogs consistent - fix translation contexts --- src/Mod/TechDraw/Gui/TaskComplexSection.cpp | 2 +- src/Mod/TechDraw/Gui/TaskSectionView.cpp | 45 ++++++++++++--------- src/Mod/TechDraw/Gui/TaskSectionView.h | 1 + src/Mod/TechDraw/Gui/TaskSectionView.ui | 36 ++++++----------- 4 files changed, 39 insertions(+), 45 deletions(-) diff --git a/src/Mod/TechDraw/Gui/TaskComplexSection.cpp b/src/Mod/TechDraw/Gui/TaskComplexSection.cpp index d4594143e0..b241a9d80d 100644 --- a/src/Mod/TechDraw/Gui/TaskComplexSection.cpp +++ b/src/Mod/TechDraw/Gui/TaskComplexSection.cpp @@ -176,7 +176,7 @@ void TaskComplexSection::setUiPrimary() //don't allow updates until a direction is picked ui->pbUpdateNow->setEnabled(false); ui->cbLiveUpdate->setEnabled(false); - QString msgLiteral = QString::fromUtf8(QT_TRANSLATE_NOOP("TaskPojGroup", "No direction set")); + QString msgLiteral = QString::fromUtf8(QT_TRANSLATE_NOOP("TaskComplexSection", "No direction set")); ui->lPendingUpdates->setText(msgLiteral); } diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.cpp b/src/Mod/TechDraw/Gui/TaskSectionView.cpp index 19439d0ca4..85f4305839 100644 --- a/src/Mod/TechDraw/Gui/TaskSectionView.cpp +++ b/src/Mod/TechDraw/Gui/TaskSectionView.cpp @@ -75,7 +75,8 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewPart* base) : m_doc(nullptr), m_createMode(true), m_saved(false), - m_applyDeferred(0) + m_applyDeferred(0), + m_directionIsSet(false) { //existence of base is guaranteed by CmdTechDrawSectionView (Command.cpp) @@ -90,7 +91,6 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewPart* base) : m_applyDeferred = 0; //setting the direction widgets causes an increment of the deferred count, //so we reset the counter and the message. - ui->lPendingUpdates->setText(QString()); } //ctor for edit @@ -102,7 +102,8 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewSection* section) : m_doc(nullptr), m_createMode(false), m_saved(false), - m_applyDeferred(0) + m_applyDeferred(0), + m_directionIsSet(true) { //existence of section is guaranteed by ViewProviderViewSection.setEdit @@ -148,6 +149,12 @@ void TaskSectionView::setUiPrimary() setUiCommon(origin); m_viewDirectionWidget->setValue(Base::Vector3d(1.0, 0.0, 0.0)); + + //don't allow updates until a direction is picked + ui->pbUpdateNow->setEnabled(false); + ui->cbLiveUpdate->setEnabled(false); + QString msgLiteral = QString::fromUtf8(QT_TRANSLATE_NOOP("TaskSectionView", "No direction set")); + ui->lPendingUpdates->setText(msgLiteral); } void TaskSectionView::setUiEdit() @@ -294,41 +301,36 @@ void TaskSectionView::slotChangeAngle(double newAngle) void TaskSectionView::onUpClicked() { // Base::Console().Message("TSV::onUpClicked()\n"); - m_compass->setToNorth(); - Base::Vector3d localUnit(0.0, 1.0, 0.0); - m_viewDirectionWidget->setValue(localUnit); checkAll(false); - applyAligned(localUnit); -} + m_compass->setToNorth(); + m_viewDirectionWidget->setValueNoNotify(Base::Vector3d(0.0, 1.0, 0.0)); + applyAligned(Base::Vector3d(0.0, 1.0, 0.0));} void TaskSectionView::onDownClicked() { // Base::Console().Message("TSV::onDownClicked()\n"); - m_compass->setToSouth(); - Base::Vector3d localUnit(0.0, -1.0, 0.0); - m_viewDirectionWidget->setValue(localUnit); checkAll(false); - applyAligned(localUnit); + m_compass->setToSouth(); + m_viewDirectionWidget->setValueNoNotify(Base::Vector3d(0.0, -1.0, 0.0)); + applyAligned(Base::Vector3d(0.0, -1.0, 0.0)); } void TaskSectionView::onLeftClicked() { // Base::Console().Message("TSV::onLeftClicked()\n"); - m_compass->setToWest(); - Base::Vector3d localUnit(-1.0, 0.0, 0.0); - m_viewDirectionWidget->setValue(localUnit); checkAll(false); - applyAligned(localUnit); + m_compass->setToWest(); + m_viewDirectionWidget->setValueNoNotify(Base::Vector3d(-1.0, 0.0, 0.0)); + applyAligned(Base::Vector3d(-1.0, 0.0, 0.0)); } void TaskSectionView::onRightClicked() { // Base::Console().Message("TSV::onRightClicked()\n"); - m_compass->setToEast(); - Base::Vector3d localUnit(1.0, 0.0, 0.0); - m_viewDirectionWidget->setValue(localUnit); checkAll(false); - applyAligned(localUnit); + m_compass->setToEast(); + m_viewDirectionWidget->setValueNoNotify(Base::Vector3d(1.0, 0.0, 0.0)); + applyAligned(Base::Vector3d(1.0, 0.0, 0.0)); } void TaskSectionView::onIdentifierChanged() @@ -483,6 +485,9 @@ void TaskSectionView::applyAligned(Base::Vector3d localUnit) m_dirName = "Aligned"; m_localUnit = localUnit; enableAll(true); + m_directionIsSet = true; + ui->pbUpdateNow->setEnabled(true); + ui->cbLiveUpdate->setEnabled(true); apply(); } diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.h b/src/Mod/TechDraw/Gui/TaskSectionView.h index a6a0353a31..bf7e5e0b85 100644 --- a/src/Mod/TechDraw/Gui/TaskSectionView.h +++ b/src/Mod/TechDraw/Gui/TaskSectionView.h @@ -125,6 +125,7 @@ private: Base::Vector3d m_localUnit; CompassWidget* m_compass; VectorEditWidget* m_viewDirectionWidget; + bool m_directionIsSet; }; class TaskDlgSectionView : public Gui::TaskView::TaskDialog diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.ui b/src/Mod/TechDraw/Gui/TaskSectionView.ui index d92b8204cd..97dc0c8c08 100644 --- a/src/Mod/TechDraw/Gui/TaskSectionView.ui +++ b/src/Mod/TechDraw/Gui/TaskSectionView.ui @@ -118,7 +118,7 @@ - + 0 @@ -140,19 +140,16 @@ Scale factor for the section view - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + false - + 0.000000000000000 - + 999.000000000000000 - + 1.000000000000000 @@ -365,7 +362,7 @@ - + 0 @@ -378,10 +375,7 @@ 22 - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + false @@ -409,7 +403,7 @@ - + 0 @@ -422,10 +416,7 @@ 22 - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + false @@ -453,7 +444,7 @@ - + 0 @@ -466,10 +457,7 @@ 22 - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + false @@ -520,7 +508,7 @@ - false + true