[TD]use local language for ProjectionType
This commit is contained in:
committed by
Kacper Donat
parent
5318d5338d
commit
bccd93758f
@@ -109,6 +109,11 @@ public:
|
||||
|
||||
void translateLabel(std::string context, std::string baseName, std::string uniqueName);
|
||||
|
||||
enum class PageProjectionConvention {
|
||||
FirstAngle = 0,
|
||||
ThirdAngle
|
||||
};
|
||||
|
||||
|
||||
protected:
|
||||
void onBeforeChange(const App::Property* prop) override;
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
// this needs to be kept in the same sequence as the enum in the h file and with the QComboBox
|
||||
// in TaskProjGroup.ui.
|
||||
const char* DrawProjGroup::ProjectionTypeEnums[] = {"First angle", "Third angle",
|
||||
"Default",//Use Page setting
|
||||
nullptr};
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#ifndef TECHDRAW_FEATUREVIEWGROUP_H_
|
||||
#define TECHDRAW_FEATUREVIEWGROUP_H_
|
||||
|
||||
#include <string>
|
||||
#include <QRectF>
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
@@ -74,6 +73,14 @@ public:
|
||||
|
||||
App::PropertyLink Anchor; /// Anchor Element to align views to
|
||||
|
||||
// this needs to be kept in the same sequence as the literals in the cpp file and with the QComboBox
|
||||
// in TaskProjGroup.ui.
|
||||
enum class ViewProjectionConvention {
|
||||
FirstAngle = 0,
|
||||
ThirdAngle,
|
||||
Page
|
||||
};
|
||||
|
||||
double autoScale() const override;
|
||||
double autoScale(double w, double h) const override;
|
||||
QRectF getRect() const override; //always scaled
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "Preferences.h"
|
||||
#include "DrawBrokenView.h"
|
||||
#include "DrawProjGroup.h"
|
||||
#include "LineGenerator.h"
|
||||
|
||||
//getters for parameters used in multiple places.
|
||||
@@ -151,7 +151,9 @@ bool Preferences::useGlobalDecimals()
|
||||
|
||||
int Preferences::projectionAngle()
|
||||
{
|
||||
return getPreferenceGroup("General")->GetInt("ProjectionAngle", 0); //First angle
|
||||
int defaultConvention = (int)DrawProjGroup::ViewProjectionConvention::FirstAngle;
|
||||
return getPreferenceGroup("General")->GetInt("ProjectionAngle",
|
||||
defaultConvention);
|
||||
}
|
||||
|
||||
bool Preferences::groupAutoDistribute()
|
||||
|
||||
@@ -109,8 +109,8 @@ void TaskProjGroup::connectWidgets()
|
||||
connect(ui->sbScaleDen, qOverload<int>(&QSpinBox::valueChanged), this, &TaskProjGroup::scaleManuallyChanged);
|
||||
|
||||
// Slot for Projection Type (layout)
|
||||
connect(ui->projection, qOverload<int>(&QComboBox::currentIndexChanged), this, [this](int index) {
|
||||
projectionTypeChanged(ui->projection->itemText(index));
|
||||
connect(ui->projection, qOverload<int>(&QComboBox::currentIndexChanged), this, [this]() {
|
||||
projectionTypeChanged(ui->projection->currentIndex());
|
||||
});
|
||||
|
||||
// Spacing
|
||||
@@ -211,7 +211,7 @@ void TaskProjGroup::saveGroupState()
|
||||
|
||||
if (multiView) {
|
||||
m_saveSource = multiView->Source.getValues();
|
||||
m_saveProjType = multiView->ProjectionType.getValueAsString();
|
||||
m_saveProjType = multiView->ProjectionType.getValue();
|
||||
m_saveAutoDistribute = multiView->AutoDistribute.getValue();
|
||||
m_saveSpacingX = multiView->spacingX.getValue();
|
||||
m_saveSpacingY = multiView->spacingY.getValue();
|
||||
@@ -238,7 +238,7 @@ void TaskProjGroup::restoreGroupState()
|
||||
view->Scale.setValue(m_saveScale);
|
||||
|
||||
if (multiView) {
|
||||
multiView->ProjectionType.setValue(m_saveProjType.c_str());
|
||||
multiView->ProjectionType.setValue(m_saveProjType);
|
||||
multiView->AutoDistribute.setValue(m_saveAutoDistribute);
|
||||
multiView->spacingX.setValue(m_saveSpacingX);
|
||||
multiView->spacingY.setValue(m_saveSpacingY);
|
||||
@@ -484,20 +484,13 @@ void TaskProjGroup::rotateButtonClicked()
|
||||
}
|
||||
}
|
||||
|
||||
//void TaskProjGroup::projectionTypeChanged(int index)
|
||||
void TaskProjGroup::projectionTypeChanged(QString qText)
|
||||
void TaskProjGroup::projectionTypeChanged(int index)
|
||||
{
|
||||
if(blockUpdate || !multiView) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (qText == QStringLiteral("Page")) {
|
||||
multiView->ProjectionType.setValue("Default");
|
||||
}
|
||||
else {
|
||||
std::string text = qText.toStdString();
|
||||
multiView->ProjectionType.setValue(text.c_str());
|
||||
}
|
||||
multiView->ProjectionType.setValue((long)index);
|
||||
|
||||
// Update checkboxes so checked state matches the drawing
|
||||
blockCheckboxes = true;
|
||||
@@ -687,18 +680,19 @@ bool TaskProjGroup::useThirdAngle()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool thirdAngle = (bool) Preferences::projectionAngle();
|
||||
if (!multiView) {
|
||||
return thirdAngle;
|
||||
if (!multiView) {
|
||||
return Preferences::projectionAngle();
|
||||
}
|
||||
|
||||
if (multiView->usedProjectionType().isValue("Third angle")) {
|
||||
thirdAngle = true;
|
||||
} else if (multiView->usedProjectionType().isValue("Default") &&
|
||||
page->ProjectionType.isValue("Third angle")) {
|
||||
thirdAngle = true;
|
||||
if (multiView->ProjectionType.getValue() == (long)DrawProjGroup::ViewProjectionConvention::ThirdAngle) {
|
||||
return true;
|
||||
}
|
||||
return thirdAngle;
|
||||
|
||||
if (multiView->ProjectionType.getValue() == (long)DrawProjGroup::ViewProjectionConvention::Page &&
|
||||
page->ProjectionType.getValue() == (long)DrawPage::PageProjectionConvention::ThirdAngle) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void TaskProjGroup::setupViewCheckboxes(bool addConnections)
|
||||
|
||||
@@ -99,7 +99,7 @@ protected Q_SLOTS:
|
||||
|
||||
void customDirectionClicked();
|
||||
|
||||
void projectionTypeChanged(QString qText);
|
||||
void projectionTypeChanged(int index);
|
||||
void scaleTypeChanged(int index);
|
||||
void AutoDistributeClicked(bool clicked);
|
||||
/// Updates item spacing
|
||||
@@ -127,7 +127,7 @@ private:
|
||||
QPushButton* m_btnCancel{nullptr};
|
||||
|
||||
std::vector<App::DocumentObject*> m_saveSource;
|
||||
std::string m_saveProjType;
|
||||
long m_saveProjType;
|
||||
std::string m_saveScaleType;
|
||||
double m_saveScale{1};
|
||||
bool m_saveAutoDistribute{false};
|
||||
|
||||
Reference in New Issue
Block a user