Refactoring. Merge similar switch cases together.
--HG-- branch : develop
This commit is contained in:
parent
731eb9ec89
commit
a6a8ef29b0
|
@ -224,8 +224,6 @@ void DialogLayoutSettings::SetGroup(const Cases &value)
|
|||
ui->radioButtonTwoGroups->setChecked(true);
|
||||
break;
|
||||
case Cases::CaseDesc:
|
||||
ui->radioButtonDescendingArea->setChecked(true);
|
||||
break;
|
||||
default:
|
||||
ui->radioButtonDescendingArea->setChecked(true);
|
||||
break;
|
||||
|
|
|
@ -174,11 +174,10 @@ void MainWindowsNoGUI::ErrorConsoleMode(const LayoutErrors &state)
|
|||
case LayoutErrors::PrepareLayoutError:
|
||||
qCritical() << tr("Couldn't prepare data for creation layout");
|
||||
break;
|
||||
case LayoutErrors::ProcessStoped:
|
||||
break;
|
||||
case LayoutErrors::EmptyPaperError:
|
||||
qCritical() << tr("Several workpieces left not arranged, but none of them match for paper");
|
||||
break;
|
||||
case LayoutErrors::ProcessStoped:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -990,11 +990,6 @@ QString VPattern::GetLabelBase(quint32 index) const
|
|||
alphabet = al.split(",");
|
||||
break;
|
||||
}
|
||||
case 1: // en
|
||||
{
|
||||
alphabet = def.split(",");
|
||||
break;
|
||||
}
|
||||
case 2: // fr
|
||||
{
|
||||
const QString al = QStringLiteral("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z");
|
||||
|
@ -1031,6 +1026,7 @@ QString VPattern::GetLabelBase(quint32 index) const
|
|||
alphabet = al.split(",");
|
||||
break;
|
||||
}
|
||||
case 1: // en
|
||||
default: // en
|
||||
{
|
||||
alphabet = def.split(",");
|
||||
|
|
|
@ -1578,12 +1578,7 @@ bool DL_Dxf::handleXData(DL_CreationInterface* creationInterface)
|
|||
creationInterface->addXDataReal(static_cast<int>(groupCode), toReal(groupValue));
|
||||
return true;
|
||||
}
|
||||
else if (groupCode>=1060 && groupCode<=1070)
|
||||
{
|
||||
creationInterface->addXDataInt(static_cast<int>(groupCode), toInt(groupValue));
|
||||
return true;
|
||||
}
|
||||
else if (groupCode==1071)
|
||||
else if (groupCode>=1060 && groupCode<=1071)
|
||||
{
|
||||
creationInterface->addXDataInt(static_cast<int>(groupCode), toInt(groupValue));
|
||||
return true;
|
||||
|
@ -2600,7 +2595,6 @@ void DL_Dxf::writeHeader(DL_WriterA& dw) const
|
|||
break;
|
||||
case DL_Codes::AC1009_MIN:
|
||||
// minimalistic DXF version is unidentified in file:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -4231,14 +4225,7 @@ void DL_Dxf::writeLinetype(DL_WriterA& dw,
|
|||
dw.dxfString(2, data.name);
|
||||
dw.dxfInt(70, data.flags);
|
||||
|
||||
if (nameUpper=="BYBLOCK")
|
||||
{
|
||||
dw.dxfString(3, "");
|
||||
dw.dxfInt(72, 65);
|
||||
dw.dxfInt(73, 0);
|
||||
dw.dxfReal(40, 0.0);
|
||||
}
|
||||
else if (nameUpper=="BYLAYER")
|
||||
if (nameUpper=="BYBLOCK" || nameUpper=="BYLAYER")
|
||||
{
|
||||
dw.dxfString(3, "");
|
||||
dw.dxfInt(72, 65);
|
||||
|
|
|
@ -479,24 +479,17 @@ std::string VDxfEngine::getPenStyle()
|
|||
{
|
||||
switch (state->pen().style())
|
||||
{
|
||||
case Qt::SolidLine:
|
||||
return "BYLAYER";
|
||||
break;
|
||||
case Qt::DashLine:
|
||||
return "DASHED";
|
||||
break;
|
||||
case Qt::DotLine:
|
||||
return "DOT";
|
||||
break;
|
||||
case Qt::DashDotLine:
|
||||
return "DASHDOT";
|
||||
break;
|
||||
case Qt::DashDotDotLine:
|
||||
return "DIVIDE";
|
||||
break;
|
||||
case Qt::SolidLine:
|
||||
default:
|
||||
return "BYLAYER";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -126,10 +126,6 @@ int VDxfPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
|
|||
return engine->getSize().width();
|
||||
case QPaintDevice::PdmHeight:
|
||||
return engine->getSize().height();
|
||||
case QPaintDevice::PdmDpiX:
|
||||
return static_cast<int>(engine->getResolution());
|
||||
case QPaintDevice::PdmDpiY:
|
||||
return static_cast<int>(engine->getResolution());
|
||||
case QPaintDevice::PdmHeightMM:
|
||||
return qRound(engine->getSize().height() * 25.4 / engine->getResolution());
|
||||
case QPaintDevice::PdmWidthMM:
|
||||
|
@ -137,8 +133,9 @@ int VDxfPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
|
|||
case QPaintDevice::PdmNumColors:
|
||||
return static_cast<int>(0xffffffff);
|
||||
case QPaintDevice::PdmPhysicalDpiX:
|
||||
return static_cast<int>(engine->getResolution());
|
||||
case QPaintDevice::PdmPhysicalDpiY:
|
||||
case QPaintDevice::PdmDpiX:
|
||||
case QPaintDevice::PdmDpiY:
|
||||
return static_cast<int>(engine->getResolution());
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 2)
|
||||
case QPaintDevice::PdmDevicePixelRatio:
|
||||
|
|
|
@ -147,18 +147,15 @@ int VObjPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
|
|||
return engine->getSize().width();
|
||||
case QPaintDevice::PdmHeight:
|
||||
return engine->getSize().height();
|
||||
case QPaintDevice::PdmDpiX:
|
||||
return engine->getResolution();
|
||||
case QPaintDevice::PdmDpiY:
|
||||
return engine->getResolution();
|
||||
case QPaintDevice::PdmHeightMM:
|
||||
return qRound(engine->getSize().height() * 25.4 / engine->getResolution());
|
||||
case QPaintDevice::PdmWidthMM:
|
||||
return qRound(engine->getSize().width() * 25.4 / engine->getResolution());
|
||||
case QPaintDevice::PdmNumColors:
|
||||
return static_cast<int>(0xffffffff);
|
||||
case QPaintDevice::PdmDpiX:
|
||||
case QPaintDevice::PdmDpiY:
|
||||
case QPaintDevice::PdmPhysicalDpiX:
|
||||
return engine->getResolution();
|
||||
case QPaintDevice::PdmPhysicalDpiY:
|
||||
return engine->getResolution();
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 2)
|
||||
|
|
|
@ -228,7 +228,7 @@ void VPE::VPropertyFormWidget::commitData(int row)
|
|||
if (oldValue != newValue)
|
||||
{
|
||||
VProperty *parent = tmpProperty->getParent();
|
||||
if (parent == nullptr)
|
||||
if (parent == nullptr || parent->propertyType() != Property::Complex)
|
||||
{
|
||||
tmpProperty->setValue(newValue);
|
||||
emit propertyDataSubmitted(tmpProperty);
|
||||
|
@ -238,11 +238,6 @@ void VPE::VPropertyFormWidget::commitData(int row)
|
|||
tmpProperty->UpdateParent(newValue);
|
||||
emit propertyDataSubmitted(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpProperty->setValue(newValue);
|
||||
emit propertyDataSubmitted(tmpProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,25 +174,17 @@ Qt::PenStyle VAbstractTool::LineStyleToPenStyle(const QString &typeLine)
|
|||
{
|
||||
case 0: // TypeLineNone
|
||||
return Qt::NoPen;
|
||||
break;
|
||||
case 1: // TypeLineLine
|
||||
return Qt::SolidLine;
|
||||
break;
|
||||
case 2: // TypeLineDashLine
|
||||
return Qt::DashLine;
|
||||
break;
|
||||
case 3: // TypeLineDotLine
|
||||
return Qt::DotLine;
|
||||
break;
|
||||
case 4: // TypeLineDashDotLine
|
||||
return Qt::DashDotLine;
|
||||
break;
|
||||
case 5: // TypeLineDashDotDotLine
|
||||
return Qt::DashDotDotLine;
|
||||
break;
|
||||
case 1: // TypeLineLine
|
||||
default:
|
||||
return Qt::SolidLine;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,9 +235,6 @@ QMap<QString, QString> VAbstractTool::ColorsList()
|
|||
QString name;
|
||||
switch (i)
|
||||
{
|
||||
case 0: // ColorBlack
|
||||
name = tr("black");
|
||||
break;
|
||||
case 1: // ColorGreen
|
||||
name = tr("green");
|
||||
break;
|
||||
|
@ -294,6 +283,7 @@ QMap<QString, QString> VAbstractTool::ColorsList()
|
|||
case 16: // ColorCornFlowerBlue
|
||||
name = tr("corn flower blue");
|
||||
break;
|
||||
case 0: // ColorBlack
|
||||
default:
|
||||
name = tr("black");
|
||||
break;
|
||||
|
|
|
@ -64,8 +64,6 @@ qreal VisLine::CorrectAngle(const qreal &angle)
|
|||
|
||||
switch (qFloor((qAbs(ang)+22.5)/45))
|
||||
{
|
||||
case 0: // <22.5
|
||||
return 0;
|
||||
case 1: // <67.5
|
||||
return 45;
|
||||
case 2: // <112.5
|
||||
|
@ -80,6 +78,7 @@ qreal VisLine::CorrectAngle(const qreal &angle)
|
|||
return 270;
|
||||
case 7: // <337.5
|
||||
return 315;
|
||||
case 0: // <22.5
|
||||
default: // <360
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user