fix Coverity issues

This commit is contained in:
wmayer
2016-08-22 15:02:18 +02:00
parent 7f2a9da5d3
commit 63ad26491f
12 changed files with 111 additions and 100 deletions

View File

@@ -65,11 +65,9 @@ ViewProviderPrimitive::~ViewProviderPrimitive()
}
void ViewProviderPrimitive::attach(App::DocumentObject* obj) {
ViewProviderAddSub::attach(obj);
}
bool ViewProviderPrimitive::setEdit(int ModNum)
{
if (ModNum == ViewProvider::Default ) {
@@ -80,8 +78,6 @@ bool ViewProviderPrimitive::setEdit(int ModNum)
// the task panel
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
TaskPrimitiveParameters *primitiveDlg = qobject_cast<TaskPrimitiveParameters *>(dlg);
if (primitiveDlg)
primitiveDlg = 0; // another pad left open its task panel
if (dlg && !primitiveDlg) {
QMessageBox msgBox;
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));
@@ -102,6 +98,7 @@ bool ViewProviderPrimitive::setEdit(int ModNum)
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
// another pad left open its task panel
if (primitiveDlg)
Gui::Control().showDialog(primitiveDlg);
else
@@ -119,14 +116,10 @@ void ViewProviderPrimitive::unsetEdit(int ModNum) {
}
void ViewProviderPrimitive::updateData(const App::Property* p) {
PartDesignGui::ViewProviderAddSub::updateData(p);
}
std::vector< App::DocumentObject* > ViewProviderPrimitive::claimChildren(void) const {
std::vector< App::DocumentObject* > vec;
vec.push_back(static_cast<PartDesign::FeaturePrimitive*>(getObject())->CoordinateSystem.getValue());
@@ -134,42 +127,41 @@ std::vector< App::DocumentObject* > ViewProviderPrimitive::claimChildren(void) c
}
QIcon ViewProviderPrimitive::getIcon(void) const {
QString str = QString::fromLatin1("PartDesign_");
auto* prim = static_cast<PartDesign::FeaturePrimitive*>(getObject());
if(prim->getAddSubType() == PartDesign::FeatureAddSub::Additive)
str += QString::fromLatin1("Additive_");
else
str += QString::fromLatin1("Subtractive_");
switch(prim->getPrimitiveType()) {
case PartDesign::FeaturePrimitive::Box:
str += QString::fromLatin1("Box");
break;
case PartDesign::FeaturePrimitive::Cylinder:
str += QString::fromLatin1("Cylinder");
break;
case PartDesign::FeaturePrimitive::Sphere:
str += QString::fromLatin1("Sphere");
break;
case PartDesign::FeaturePrimitive::Cone:
str += QString::fromLatin1("Cone");
break;
case PartDesign::FeaturePrimitive::Ellipsoid:
str += QString::fromLatin1("Ellipsoid");
break;
case PartDesign::FeaturePrimitive::Torus:
str += QString::fromLatin1("Torus");
break;
case PartDesign::FeaturePrimitive::Prism:
str += QString::fromLatin1("Prism");
break;
case PartDesign::FeaturePrimitive::Wedge:
str += QString::fromLatin1("Wedge");
break;
case PartDesign::FeaturePrimitive::Box:
str += QString::fromLatin1("Box");
break;
case PartDesign::FeaturePrimitive::Cylinder:
str += QString::fromLatin1("Cylinder");
break;
case PartDesign::FeaturePrimitive::Sphere:
str += QString::fromLatin1("Sphere");
break;
case PartDesign::FeaturePrimitive::Cone:
str += QString::fromLatin1("Cone");
break;
case PartDesign::FeaturePrimitive::Ellipsoid:
str += QString::fromLatin1("Ellipsoid");
break;
case PartDesign::FeaturePrimitive::Torus:
str += QString::fromLatin1("Torus");
break;
case PartDesign::FeaturePrimitive::Prism:
str += QString::fromLatin1("Prism");
break;
case PartDesign::FeaturePrimitive::Wedge:
str += QString::fromLatin1("Wedge");
break;
}
str += QString::fromLatin1(".svg");
return Gui::BitmapFactory().pixmap(str.toStdString().c_str());
}