Skip to content

Commit

Permalink
Path: Several fixes suggested by wmayer
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Jul 14, 2015
1 parent 44ae0d7 commit 9b476e1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/Mod/Path/App/Command.cpp
Expand Up @@ -109,7 +109,7 @@ Vector3d Command::getCenter (void)
return vec;
}

const double Command::getValue(const std::string attr)
const double Command::getValue(const std::string& attr)
{
std::string a(attr);
boost::to_upper(a);
Expand All @@ -119,11 +119,11 @@ const double Command::getValue(const std::string attr)
return val;
}

const bool Command::has(const std::string attr)
const bool Command::has(const std::string& attr)
{
std::string a(attr);
boost::to_upper(a);
return (bool)Parameters.count(a);
return Parameters.count(a) > 0;
}

std::string Command::toGCode (void) const
Expand All @@ -139,7 +139,7 @@ std::string Command::toGCode (void) const
return str.str();
}

void Command::setFromGCode (std::string str)
void Command::setFromGCode (const std::string& str)
{
Parameters.clear();
std::string mode = "none";
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Path/App/Command.h
Expand Up @@ -53,11 +53,11 @@ namespace Path
Base::Vector3d getCenter (void); // returns a 3d vector from the i,j,k parameters
void setCenter(const Base::Vector3d&, bool clockwise=true); // sets the center coordinates and the command name
std::string toGCode (void) const; // returns a GCode string representation of the command
void setFromGCode (std::string); // sets the parameters from the contents of the given GCode string
void setFromGCode (const std::string&); // sets the parameters from the contents of the given GCode string
void setFromPlacement (const Base::Placement&); // sets the parameters from the contents of the given placement
const bool has(const std::string); // returns true if the given string exists in the parameters
const bool has(const std::string&); // returns true if the given string exists in the parameters
Command transform(const Base::Placement); // returns a transformed copy of this command
const double getValue(const std::string); // returns the value of a given parameter
const double getValue(const std::string&); // returns the value of a given parameter

// attributes
std::string Name;
Expand Down
1 change: 0 additions & 1 deletion src/Mod/Path/App/TooltablePyImp.cpp
Expand Up @@ -58,7 +58,6 @@ PyObject *ToolPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Pytho
// constructor method
int ToolPy::PyInit(PyObject* args, PyObject* kwd)
{
PyObject *pos;
char *name="Default tool";
char *type = "Undefined";
char *mat = "Undefined";
Expand Down
4 changes: 3 additions & 1 deletion src/Mod/Path/Gui/DlgProcessorChooser.cpp
Expand Up @@ -40,6 +40,8 @@

using namespace PathGui;

/* TRANSLATOR PathGui::DlgProcessorChooser */

DlgProcessorChooser::DlgProcessorChooser(std::vector<std::string> &scriptnames)
: QDialog(Gui::getMainWindow()), ui(new Ui_DlgProcessorChooser)
{
Expand All @@ -64,7 +66,7 @@ void DlgProcessorChooser::accept()
if (ui->comboBox->currentText() == tr("None"))
entry = "";
else
entry = ui->comboBox->currentText().toStdString();
entry = ui->comboBox->currentText().toUtf8().data();
QDialog::accept();
}
#include "moc_DlgProcessorChooser.cpp"
2 changes: 1 addition & 1 deletion src/Mod/Path/Gui/DlgSettingsPathColor.cpp
Expand Up @@ -30,7 +30,7 @@

using namespace PathGui;

/* TRANSLATOR PartGui::DlgSettingsPathColor */
/* TRANSLATOR PathGui::DlgSettingsPathColor */

/**
* Constructs a DlgSettingsObjectColor which is a child of 'parent', with the
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/Gui/ViewProviderPath.cpp
Expand Up @@ -231,7 +231,7 @@ void ViewProviderPath::updateData(const App::Property* prop)
bool absolute = true;
bool first = true;

for (int i = 0; i < tp.getSize(); i++) {
for (unsigned int i = 0; i < tp.getSize(); i++) {
Path::Command cmd = tp.getCommand(i);
std::string name = cmd.Name;
Base::Vector3d next = cmd.getPlacement().getPosition();
Expand Down

0 comments on commit 9b476e1

Please sign in to comment.