Commit 0d941e0f authored by Emmanuel Promayon's avatar Emmanuel Promayon

UPDATED modernize with proper use of "auto" to determine variable type without...

UPDATED modernize with proper use of "auto" to determine variable type without sacrificing readibility
parent 7560e4d8
......@@ -126,7 +126,7 @@ void PMLExplorerWidget::buildPhysicalModelTreeWidgetItem() {
// --------------- buildMultiComponentTreeWidgetItem -------------------
QTreeWidgetItem* PMLExplorerWidget::buildMultiComponentTreeWidgetItem ( MultiComponent* inputMC, QTreeWidgetItem* parent ) {
// Add the current item in the QTreeView list
QTreeWidgetItem* mcItem = new QTreeWidgetItem ( parent );
auto* mcItem = new QTreeWidgetItem ( parent );
widgetComponentMap.insert ( mcItem, inputMC );
mcItem->setText ( 0, inputMC->getName().c_str() );
......@@ -148,7 +148,7 @@ QTreeWidgetItem* PMLExplorerWidget::buildMultiComponentTreeWidgetItem ( MultiCom
// --------------- buildStructuralComponentTreeWidgetItem -------------------
QTreeWidgetItem* PMLExplorerWidget::buildStructuralComponentTreeWidgetItem ( StructuralComponent* sc, QTreeWidgetItem* parent ) {
// Add the structural item in the QTreeView list
QTreeWidgetItem* scItem = new QTreeWidgetItem ( parent );
auto* scItem = new QTreeWidgetItem ( parent );
widgetComponentMap.insert ( scItem, sc );
scItem->setText ( 0, sc->getName().c_str() );
......@@ -169,7 +169,7 @@ QTreeWidgetItem* PMLExplorerWidget::buildStructuralComponentTreeWidgetItem ( Str
// --------------- buildAtomTreeWidgetItem -------------------
QTreeWidgetItem* PMLExplorerWidget::buildAtomTreeWidgetItem ( Atom* atom, QTreeWidgetItem* parent ) {
QTreeWidgetItem* atomItem = new QTreeWidgetItem ( parent );
auto* atomItem = new QTreeWidgetItem ( parent );
widgetAtomMap.insert ( atomItem, atom );
QString atomItemText = "Atom #" + QString::number ( atom->getIndex() );
......@@ -181,7 +181,7 @@ QTreeWidgetItem* PMLExplorerWidget::buildAtomTreeWidgetItem ( Atom* atom, QTreeW
// --------------- buildCellTreeWidgetItem -------------------
QTreeWidgetItem* PMLExplorerWidget::buildCellTreeWidgetItem ( Cell* cell, QTreeWidgetItem* parent ) {
QTreeWidgetItem* cellItem = new QTreeWidgetItem ( parent );
auto* cellItem = new QTreeWidgetItem ( parent );
widgetComponentMap.insert ( cellItem, cell );
QString cellItemText = "Cell ";
......@@ -400,7 +400,7 @@ void PMLExplorerWidget::createNewProperty() {
editedObject = widgetPropertiesMap.value ( editedItem );
}
// the cast should always be ok
CamiTKPropertyList* propList = dynamic_cast<CamiTKPropertyList*> ( editedObject );
auto* propList = dynamic_cast<CamiTKPropertyList*> ( editedObject );
if (propList != nullptr) {
propList->addProperty ( newProp );
// update object controller
......@@ -417,7 +417,7 @@ void PMLExplorerWidget::createNewProperty() {
// --------------- createAtomPropertyList -------------------
CamiTKPropertyList* PMLExplorerWidget::createAtomPropertyList ( Atom* a ) {
CamiTKPropertyList* itemProperties = new CamiTKPropertyList;
auto* itemProperties = new CamiTKPropertyList;
// index
camitk::Property* indexProp = new camitk::Property ( "index", QVariant ( ( int ) a->getIndex() ), "Unique index of the atom (can be different than its order number in the atom structure, atom indexes do not have to be contiguous). <br/><b>WARNING :</b> if physical model not valid if two atoms have the same index, becareful when you modify this value!", "unsigned int" );
......@@ -466,7 +466,7 @@ CamiTKPropertyList* PMLExplorerWidget::createAtomPropertyList ( Atom* a ) {
// --------------- createCellPropertyList -------------------
CamiTKPropertyList* PMLExplorerWidget::createCellPropertyList ( Cell* c ) {
CamiTKPropertyList* itemProperties = new CamiTKPropertyList;
auto* itemProperties = new CamiTKPropertyList;
// index
camitk::Property* indexProp = new camitk::Property ( "index", QVariant ( ( int ) c->getIndex() ), "Unique index of the cell (can be totally arbirtrary, cell indexes do not have to be contiguous)", "unsigned int" );
......@@ -507,7 +507,7 @@ CamiTKPropertyList* PMLExplorerWidget::createCellPropertyList ( Cell* c ) {
// --------------- createSCPropertyList -------------------
CamiTKPropertyList* PMLExplorerWidget::createSCPropertyList ( StructuralComponent* sc ) {
CamiTKPropertyList* itemProperties = new CamiTKPropertyList;
auto* itemProperties = new CamiTKPropertyList;
// sc name
QString scName ( sc->getName().c_str() );
......@@ -554,7 +554,7 @@ CamiTKPropertyList* PMLExplorerWidget::createSCPropertyList ( StructuralComponen
// --------------- createMCPropertyList -------------------
CamiTKPropertyList* PMLExplorerWidget::createMCPropertyList ( MultiComponent* mc ) {
CamiTKPropertyList* itemProperties = new CamiTKPropertyList;
auto* itemProperties = new CamiTKPropertyList;
// mc name
QString mcName ( mc->getName().c_str() );
......@@ -587,7 +587,7 @@ void PMLExplorerWidget::propertyChanged() {
if ( Atom* a = widgetAtomMap.value ( editedItem ) ) {
QObject* editedObject = atomPropertiesMap.value ( a );
CamiTKPropertyList* propList = dynamic_cast<CamiTKPropertyList*> ( editedObject );
auto* propList = dynamic_cast<CamiTKPropertyList*> ( editedObject );
QVector3D pos = propList->property ( "Position" ).value<QVector3D>();
a->setPosition ( pos.x(), pos.y(), pos.z() );
......@@ -616,7 +616,7 @@ void PMLExplorerWidget::propertyChanged() {
}
else if ( widgetComponentMap.contains ( editedItem ) ) {
QObject* editedObject = widgetPropertiesMap.value ( editedItem );
CamiTKPropertyList* propList = dynamic_cast<CamiTKPropertyList*> ( editedObject );
auto* propList = dynamic_cast<CamiTKPropertyList*> ( editedObject );
Component* comp = widgetComponentMap.value ( editedItem );
QString name = propList->property ( "name" ).value<QString>();
......
......@@ -48,7 +48,7 @@
MMLDisplay::MMLDisplay( MMLComponent* mmlManager ): QObject() {
this->mmlManager = mmlManager;
QObject* qobj = ( QObject*)( mmlManager->getMonitoringGuiManager() );
auto* qobj = ( QObject*)( mmlManager->getMonitoringGuiManager() );
QObject* qobj2 = ( QObject*)( mmlManager->getMonitoringGuiManager()->getDialog() );
connect( qobj, SIGNAL( changed() ), this, SLOT( updateDisplay() ) );
connect( qobj2, SIGNAL( monitorsChanged() ), this, SLOT( updateMonitorsTable() ) );
......@@ -59,10 +59,10 @@ MMLDisplay::MMLDisplay( MMLComponent* mmlManager ): QObject() {
QTableWidget* table = mmlManager->getMonitoringGuiManager()->getDialog()->getMonitorsTableWidget();
int i = table->columnCount();
table->setColumnCount( i + 2 );
QTableWidgetItem* item1 = new QTableWidgetItem();
auto* item1 = new QTableWidgetItem();
item1->setText( tr( "Display" ) );
table->setHorizontalHeaderItem( i, item1 );
QTableWidgetItem* item2 = new QTableWidgetItem();
auto* item2 = new QTableWidgetItem();
item2->setText( tr( "Display Type" ) );
table->setHorizontalHeaderItem( i + 1, item2 );
}
......@@ -103,7 +103,7 @@ void MMLDisplay::connectMonitor() {
QTableWidget* table = mmlManager->getMonitoringGuiManager()->getDialog()->getMonitorsTableWidget();
for ( int i = 0; i < table->rowCount(); i++ ) {
QRadioButton* qrb = ( QRadioButton*)( table->cellWidget( i, 5 ) );
auto* qrb = ( QRadioButton*)( table->cellWidget( i, 5 ) );
if ( qrb->isChecked() ) {
m = mmlManager->getMonitoringGuiManager()->getMonitoringManager()->getMonitor( i );
QComboBox* qcb = ( QComboBox*)( table->cellWidget( i, 6 ) );
......@@ -128,7 +128,7 @@ void MMLDisplay::updateMonitorsTable() {
QTableWidget* table = mmlManager->getMonitoringGuiManager()->getDialog()->getMonitorsTableWidget();
for ( int i = 0; i < table->rowCount(); i++ ) {
QRadioButton* r = new QRadioButton();
auto* r = new QRadioButton();
table->setCellWidget( i , 5 , r );
connect( r, SIGNAL( toggled( bool ) ), this, SLOT( connectMonitor() ) );
......@@ -151,7 +151,7 @@ Monitor* MMLDisplay::getDisplayedMonitor() {
QTableWidget* table = mmlManager->getMonitoringGuiManager()->getDialog()->getMonitorsTableWidget();
for ( int i = 0; i < table->rowCount(); i++ ) {
QRadioButton* qrb = ( QRadioButton*)( table->cellWidget( i, 5 ) );
auto* qrb = ( QRadioButton*)( table->cellWidget( i, 5 ) );
if ( qrb->isChecked() ) {
return mmlManager->getMonitoringGuiManager()->getMonitoringManager()->getMonitor( i );
}
......@@ -164,7 +164,7 @@ int MMLDisplay::getDisplayedMonitorLine() {
QTableWidget* table = mmlManager->getMonitoringGuiManager()->getDialog()->getMonitorsTableWidget();
for ( int i = 0; i < table->rowCount(); i++ ) {
QRadioButton* qrb = ( QRadioButton*)( table->cellWidget( i, 5 ) );
auto* qrb = ( QRadioButton*)( table->cellWidget( i, 5 ) );
if ( qrb->isChecked() ) {
return i;
}
......
......@@ -42,7 +42,7 @@ Statistics::Statistics(Monitor* monitor, MMLComponent* manager): MMLMonitorDispl
int j = t->columnCount();
oldRowSize = t->rowHeight(line);
t->setColumnCount(j + 1);
QTableWidgetItem* item = new QTableWidgetItem();
auto* item = new QTableWidgetItem();
item->setText(("Statistics"));
t->setHorizontalHeaderItem(j, item);
table = new QTableWidget;
......@@ -62,13 +62,13 @@ void Statistics::update() {
QString s;
table->setColumnCount(3);
table->setRowCount(1);
QTableWidgetItem* item1 = new QTableWidgetItem();
auto* item1 = new QTableWidgetItem();
item1->setText(tr("minimum"));
table->setHorizontalHeaderItem(0, item1);
QTableWidgetItem* item2 = new QTableWidgetItem();
auto* item2 = new QTableWidgetItem();
item2->setText(tr("maximum"));
table->setHorizontalHeaderItem(1, item2);
QTableWidgetItem* item3 = new QTableWidgetItem();
auto* item3 = new QTableWidgetItem();
item3->setText(tr("average"));
table->setHorizontalHeaderItem(2, item3);
table->verticalHeader()->hide();
......
......@@ -43,7 +43,7 @@ Tabular::Tabular(Monitor* monitor, MMLComponent* manager): MMLMonitorDisplay(mon
int j = t->columnCount();
oldRowSize = t->rowHeight(line);
t->setColumnCount(j + 1);
QTableWidgetItem* item = new QTableWidgetItem();
auto* item = new QTableWidgetItem();
item->setText(("Tabular"));
t->setHorizontalHeaderItem(j, item);
table = new QTableWidget;
......@@ -156,7 +156,7 @@ void Tabular::copy() {
// ---------------------- eventFilter ----------------------------
bool Tabular::eventFilter(QObject* obj, QEvent* event) {
if (event->type() == QEvent::ContextMenu) {
QMouseEvent* mEvent = static_cast<QMouseEvent*>(event);
auto* mEvent = static_cast<QMouseEvent*>(event);
QMenu menu(table);
menu.addAction("special copy for spreadsheet", this, SLOT(copy()));
menu.exec(mEvent->globalPos());
......
......@@ -64,7 +64,7 @@ camitk::Component* PMLComponentExtension::open(const QString& fileName) {
Application::showStatusBarMessage("Loading " + fileName + "...");
// instanciate the component
PMLComponent* pmlComponent = new PMLComponent(fileName);
auto* pmlComponent = new PMLComponent(fileName);
// reset the progress bar
Application::resetProgressBar();
......
......@@ -230,7 +230,7 @@ CellProperties* Cell::getProperties() {
// ------------------ getTriangleFaces ---------------------
StructuralComponent* Cell::getTriangleFaces() {
StructuralComponent* facets = new StructuralComponent (getPhysicalModel());
auto* facets = new StructuralComponent (getPhysicalModel());
Cell* face;
switch (getProperties()->getType()) {
......@@ -383,7 +383,7 @@ StructuralComponent* Cell::getTriangleFaces() {
// ------------------ getQuadFaces ---------------------
StructuralComponent* Cell::getQuadFaces() {
StructuralComponent* facets = new StructuralComponent (getPhysicalModel());
auto* facets = new StructuralComponent (getPhysicalModel());
Cell* face;
switch (getProperties()->getType()) {
......@@ -457,7 +457,7 @@ StructuralComponent* Cell::getQuadFaces() {
// ------------------ normal ---------------------
double* Cell::normal() {
if (getProperties()->getType() == StructureProperties::QUAD || getProperties()->getType() == StructureProperties::TRIANGLE) {
double* N = new double[3];
auto* N = new double[3];
double v1[3], v2[3];
double posi[3], posip1[3];
( (Atom*) getStructure (0))->getPosition (posip1);
......
......@@ -171,7 +171,7 @@ inline void Component::addParentMultiComponent(MultiComponent* c) {
parentMultiComponentList.push_back(c);
}
inline void Component::removeParentMultiComponent(MultiComponent* c) {
std::vector <MultiComponent*>::iterator it = std::find(parentMultiComponentList.begin(), parentMultiComponentList.end(), c);
auto it = std::find(parentMultiComponentList.begin(), parentMultiComponentList.end(), c);
if (it != parentMultiComponentList.end()) {
parentMultiComponentList.erase(it);
}
......
......@@ -128,14 +128,14 @@ inline void MultiComponent::addSubComponent(Component* c) {
c->setExclusive(isExclusive());
}
inline void MultiComponent::removeSubComponent(Component* c) {
std::vector <Component*>::iterator it = std::find(components.begin(), components.end(), c);
auto it = std::find(components.begin(), components.end(), c);
if (it != components.end()) {
components.erase(it);
c->removeParentMultiComponent(this);
}
}
inline Component* MultiComponent::getComponentByName(const std::string n) {
std::vector <Component*>::iterator it = components.begin();
auto it = components.begin();
Component* foundC = nullptr;
while (it != components.end() && !foundC) {
foundC = ((*it)->getName() == n) ? (*it) : NULL;
......
......@@ -516,7 +516,7 @@ MultiComponent* PMLTransform::generateExternalSurface(StructuralComponent* sc) {
// just add in a new SC all the one that are used only once
StructuralComponent* facet = new StructuralComponent(nullptr, "extern");
for (std::vector <Facet*>::iterator it = allFacets.begin(); it != allFacets.end(); it++) {
for (auto it = allFacets.begin(); it != allFacets.end(); it++) {
//(*it)->debug();
if ((*it)->getUsed() == 1) { // used only once
facet->addStructure((*it)->getCell(sc->getPhysicalModel()));
......@@ -524,7 +524,7 @@ MultiComponent* PMLTransform::generateExternalSurface(StructuralComponent* sc) {
}
// delete all facets
for (std::vector <Facet*>::iterator it = allFacets.begin(); it != allFacets.end(); it++) {
for (auto it = allFacets.begin(); it != allFacets.end(); it++) {
delete (*it);
}
......
......@@ -434,7 +434,7 @@ bool PhysicalModel::parseTree(std::unique_ptr<physicalModel::PhysicalModel> root
physicalModel::ExclusiveComponent ecs = root->exclusiveComponents();
physicalModel::MultiComponent xmlExclusiveMC = ecs.multiComponent();
// Get the top level multicomponent node (with name + unkown attributes)
MultiComponent* exclusiveMC = new MultiComponent(this);
auto* exclusiveMC = new MultiComponent(this);
// recursively build the tree of exclusive components
parseComponents(xmlExclusiveMC, exclusiveMC, true);
// Add it to the structure
......@@ -445,7 +445,7 @@ bool PhysicalModel::parseTree(std::unique_ptr<physicalModel::PhysicalModel> root
physicalModel::InformativeComponent ics = root->informativeComponents().get();
physicalModel::MultiComponent xmlInformativeMC = ics.multiComponent();
// Get the top level multicomponent node (with name + unkown attributes)
MultiComponent* informativeMC = new MultiComponent(this);
auto* informativeMC = new MultiComponent(this);
// recursively build the tree of informative components
parseComponents(xmlInformativeMC, informativeMC, false);
......@@ -490,7 +490,7 @@ bool PhysicalModel::parseAtoms(physicalModel::PhysicalModel::atoms_type atomsRoo
bool PhysicalModel::parseComponents(physicalModel::MultiComponent xmlFatherMC, Component* father, bool isExclusive) {
// Parse the name and unkown properties attribute of the main multiComponent
MultiComponent* fatherMC = (MultiComponent*) father;
auto* fatherMC = (MultiComponent*) father;
fatherMC->setName(xmlFatherMC.name().get());
fatherMC->getProperties()->xmlToFields(xmlFatherMC.any_attribute());
......
......@@ -422,7 +422,7 @@ inline Structure* PhysicalModel::getStructureByName(const std::string n) {
// look for structures into the global maps
// look for a cell with this name
std::GlobalIndexStructureMapIterator mapIt = cellMap.begin();
auto mapIt = cellMap.begin();
while (mapIt != cellMap.end() && mapIt->second->getName() != n) {
mapIt++;
......
......@@ -71,7 +71,7 @@ unsigned int Properties::numberOfFields() const {
// ---------------- getField -----------------
std::string Properties::getField(unsigned int id) const {
std::map<std::string, std::string>::const_iterator it = fields.begin();
auto it = fields.begin();
unsigned int i = 0;
while (it != fields.end() && i != id) {
......
......@@ -138,12 +138,12 @@ private:
};
inline bool Properties::isAField(std::string attName) const {
std::map<std::string, std::string>::const_iterator it = fields.find(attName);
auto it = fields.find(attName);
return (it != fields.end());
}
inline double Properties::getDouble(std::string attName) {
std::map<std::string, std::string>::iterator it = fields.find(attName);
auto it = fields.find(attName);
if (it != fields.end()) {
return atof( it->second.c_str());
......@@ -154,7 +154,7 @@ inline double Properties::getDouble(std::string attName) {
}
inline int Properties::getInt(std::string attName) const {
std::map<std::string, std::string>::const_iterator it = fields.find(attName);
auto it = fields.find(attName);
if (it != fields.end()) {
return std::atoi( it->second.c_str());
......@@ -165,7 +165,7 @@ inline int Properties::getInt(std::string attName) const {
}
inline bool Properties::getBool(std::string attName) const {
std::map<std::string, std::string>::const_iterator it = fields.find(attName);
auto it = fields.find(attName);
if (it == fields.end() || it->second == "false" || it->second == "0") {
return false;
......@@ -176,7 +176,7 @@ inline bool Properties::getBool(std::string attName) const {
}
inline std::string Properties::getString(std::string attName) const {
std::map<std::string, std::string>::const_iterator it = fields.find(attName);
auto it = fields.find(attName);
if (it != fields.end()) {
return it->second;
......@@ -187,7 +187,7 @@ inline std::string Properties::getString(std::string attName) const {
}
inline void Properties::get(std::string attName, std::string& attVal) const {
std::map<std::string, std::string>::const_iterator it = fields.find(attName);
auto it = fields.find(attName);
if (it != fields.end()) {
attVal = it->second;
......@@ -200,7 +200,7 @@ inline void Properties::get(std::string attName, std::string& attVal) const {
inline void Properties::set(std::string attName, double val) {
std::ostringstream oss;
oss << val;
std::map<std::string, std::string>::iterator it = fields.find(attName);
auto it = fields.find(attName);
if (it != fields.end()) {
it->second = oss.str();
......@@ -213,7 +213,7 @@ inline void Properties::set(std::string attName, double val) {
inline void Properties::set(std::string attName, int val) {
std::ostringstream oss;
oss << val;
std::map<std::string, std::string>::iterator it = fields.find(attName);
auto it = fields.find(attName);
if (it != fields.end()) {
it->second = oss.str() ;
......@@ -226,7 +226,7 @@ inline void Properties::set(std::string attName, int val) {
inline void Properties::set(std::string attName, bool val) {
std::ostringstream oss;
oss << val;
std::map<std::string, std::string>::iterator it = fields.find(attName);
auto it = fields.find(attName);
if (it != fields.end()) {
it->second = oss.str() ;
......@@ -237,7 +237,7 @@ inline void Properties::set(std::string attName, bool val) {
}
inline void Properties::set(std::string attName, std::string val) {
std::map<std::string, std::string>::iterator it = fields.find(attName);
auto it = fields.find(attName);
if (it != fields.end()) {
it->second = val ;
......
......@@ -226,7 +226,7 @@ inline Structure* StructuralComponent::getStructure(const unsigned int i) const
}
}
inline Structure* StructuralComponent::getStructureByIndex(const unsigned int i) {
std::vector <Structure*>::iterator it = structures.begin();
auto it = structures.begin();
while (it != structures.end() && (*it)->getIndex() != i) {
it++;
}
......@@ -238,7 +238,7 @@ inline Structure* StructuralComponent::getStructureByIndex(const unsigned int i)
}
}
inline Structure* StructuralComponent::getStructureByName(const std::string n) {
std::vector <Structure*>::iterator it = structures.begin();
auto it = structures.begin();
while (it != structures.end() && (*it)->getName() != n) {
it++;
}
......@@ -255,7 +255,7 @@ inline unsigned int StructuralComponent::getNumberOfStructures() const {
inline void StructuralComponent::removeStructure(Structure* s) {
if (s) {
// remove it from the list
std::vector <Structure*>::iterator it = std::find(structures.begin(), structures.end(), s);
auto it = std::find(structures.begin(), structures.end(), s);
if (it != structures.end()) {
structures.erase(it);
// tell s that it is no more used by this structural component
......
......@@ -130,7 +130,7 @@ inline void Structure::addStructuralComponent(StructuralComponent* sc) {
}
inline void Structure::removeStructuralComponent(StructuralComponent* sc) {
std::vector <StructuralComponent*>::iterator it = std::find(mySCs.begin(), mySCs.end(), sc);
auto it = std::find(mySCs.begin(), mySCs.end(), sc);
if (it != mySCs.end()) {
mySCs.erase(it);
}
......
......@@ -45,7 +45,7 @@ void ReportBugDialog::showBugReport(const QString& bugReport) {
// -------------------- setBugReport --------------------
void ReportBugDialog::setBugReport() {
GenerateBugReportProcess* bGProcess = new GenerateBugReportProcess();
auto* bGProcess = new GenerateBugReportProcess();
connect(bGProcess, SIGNAL(resultReady(QString)), this, SLOT(showBugReport(QString)));
connect(bGProcess, SIGNAL(finished()), bGProcess, SLOT(deleteLater()));
bGProcess->start();
......
......@@ -57,7 +57,7 @@ void FrameEditor::init() {
for (int j = 0; j < 4; j++) {
transfromMatrixElements[j].resize(4);
for (int i = 0; i < 4; i++) {
QLineEdit *tmpLineEdit = new QLineEdit();
auto *tmpLineEdit = new QLineEdit();
tmpLineEdit->setText("line: " + QString::number(i) + ", column: " + QString::number(j));
transfromMatrixElements[j][i] = tmpLineEdit;
ui.transformationGridLayout->addWidget(tmpLineEdit, i+1, j+1);
......@@ -194,7 +194,7 @@ void FrameEditor::initializeDialogWithCurrentComponent() {
ui.transformationGroupBox->blockSignals(transformSignalState);
double * pos = new double[3];
auto * pos = new double[3];
currentComponent->getTransform()->GetPosition(pos);
bool translationSignalState = ui.translationGroupBox->blockSignals(true);
......@@ -203,7 +203,7 @@ void FrameEditor::initializeDialogWithCurrentComponent() {
ui.zTranslationLineEdit->setText(QString::number(pos[2]));
ui.translationGroupBox->blockSignals(translationSignalState);
double * rotation = new double[3];
auto * rotation = new double[3];
currentComponent->getTransform()->GetOrientation(rotation);
bool rotationSignalState = ui.rotationGroupBox->blockSignals(true);
......@@ -267,7 +267,7 @@ void FrameEditor::transformationChanged() {
matrixTransform->SetMatrix(matrix);
double * pos = new double[3];
auto * pos = new double[3];
matrixTransform->GetPosition(pos);
bool translationSignalState = ui.translationGroupBox->blockSignals(true);
......@@ -276,7 +276,7 @@ void FrameEditor::transformationChanged() {
ui.zTranslationLineEdit->setText(QString::number(pos[2]));
ui.translationGroupBox->blockSignals(translationSignalState);
double * rotation = new double[3];
auto * rotation = new double[3];
matrixTransform->GetOrientation(rotation);
bool rotationSignalState = ui.rotationGroupBox->blockSignals(true);
......
......@@ -65,7 +65,7 @@ BoxVOI::~BoxVOI() {
// --------------- getWidget --------------
QWidget* BoxVOI::getWidget() {
BoxVOIWidget* rgWidget = dynamic_cast<BoxVOIWidget*>(theWidget);
auto* rgWidget = dynamic_cast<BoxVOIWidget*>(theWidget);
//-- create the widget if needed
if (!rgWidget) {
......@@ -83,7 +83,7 @@ QWidget* BoxVOI::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus BoxVOI::apply() {
// check the widget
BoxVOIWidget* rgWidget = dynamic_cast<BoxVOIWidget*>(theWidget);
auto* rgWidget = dynamic_cast<BoxVOIWidget*>(theWidget);
// Get the image
ImageComponent* input = dynamic_cast<ImageComponent*>(getTargets().last());
......
......@@ -107,7 +107,7 @@ void ImageLutWidget::updateComponent(ImageComponent* comp) {
double imgMinColor = imgRange[0];
double imgMaxColor = imgRange[1];
double nbColorsOrg = imgMaxColor - imgMinColor;
long int nbOfColors = (long int) (nbColorsOrg);
auto nbOfColors = (long int) (nbColorsOrg);
// as this widget is only grayscale, compute the average of the color values
lutMin = imgMinColor;
......@@ -371,13 +371,13 @@ void ImageLutWidget::fillHistogramTable(DATATYPE* data, unsigned int dataDim, DA
}
// scale factor from [min,max] to [0..nbHistoBins]
DATATYPE intervalLength = (DATATYPE) ((maxVal - minVal) / (DATATYPE)nbHistoBins);
auto intervalLength = (DATATYPE) ((maxVal - minVal) / (DATATYPE)nbHistoBins);
if ( intervalLength != 0 ) {
//-- build histogram
for (unsigned int i = 0; i < dataDim; i++ ) {
// Find the corresponding interval index
unsigned int pointIndex = (unsigned int) ((data[i] - minVal) / intervalLength);
auto pointIndex = (unsigned int) ((data[i] - minVal) / intervalLength);
// build the histogram (increment the corresponding value)
greyLevels[pointIndex] += 1.0;
}
......
......@@ -56,7 +56,7 @@ ColorPointWidget::ColorPointWidget(QWidget* dad, int grayLevel, QColor color) :
}
void ColorPointWidget::remove() {
VolumeRenderingWidget* dadVR = dynamic_cast<VolumeRenderingWidget*> (this->dad);
auto* dadVR = dynamic_cast<VolumeRenderingWidget*> (this->dad);
if (dadVR) {
dadVR->removeColorPoint(this);
}
......
......@@ -46,7 +46,7 @@ GradientOpacityWidget::GradientOpacityWidget(QWidget* dad, int grayLevel, double
}
void GradientOpacityWidget::remove() {
VolumeRenderingWidget* dadVR = dynamic_cast<VolumeRenderingWidget*> (this->dad);
auto* dadVR = dynamic_cast<VolumeRenderingWidget*> (this->dad);
if (dadVR) {
dadVR->removeOpacityPoint(this);
}
......
......@@ -46,7 +46,7 @@ TransparencyPointWidget::TransparencyPointWidget(QWidget* dad, int grayLevel, do
}
void TransparencyPointWidget::remove() {
VolumeRenderingWidget* dadVR = dynamic_cast<VolumeRenderingWidget*> (this->dad);
auto* dadVR = dynamic_cast<VolumeRenderingWidget*> (this->dad);
if (dadVR) {
dadVR->removeTransparencyPoint(this);
}
......
......@@ -469,7 +469,7 @@ void VolumeRenderingWidget::save() {
// ---------------------- refreshVolumeRendering ----------------------
void VolumeRenderingWidget::refreshVolumeRendering() {
VolumeRenderingAction* dadVR = dynamic_cast<VolumeRenderingAction*> (dad);
auto* dadVR = dynamic_cast<VolumeRenderingAction*> (dad);
if (dadVR) {
dadVR->createVolumeRendering(myImage);
}
......
......@@ -64,7 +64,7 @@ QWidget* MeshPicking::getWidget() {
QObject::connect(InteractiveViewer::get3DViewer(), SIGNAL(selectionChanged()), this, SLOT(apply()));
//-- the vertical layout, put every GUI elements in it
QVBoxLayout* informationFrameLayout = new QVBoxLayout();
auto* informationFrameLayout = new QVBoxLayout();
informationFrameLayout->addWidget(informationLabel);
//-- set the layout for the action widget
......
......@@ -79,7 +79,7 @@ QWidget* MeshQuality::getWidget() {
qualityInfo = new QTableWidget();
//-- the grid layout, put every GUI elements in it
QGridLayout* informationFrameLayout = new QGridLayout();
auto* informationFrameLayout = new QGridLayout();
//-- add the widgets
informationFrameLayout->addWidget(informationLabel, 0, 0, 1, 2);
......
......@@ -66,7 +66,7 @@ QWidget* ActionStateViewer::getWidget(QWidget* parent) {
myWidget = new QWidget();
}
QVBoxLayout* actionStateWidgetLayout = new QVBoxLayout();
auto* actionStateWidgetLayout = new QVBoxLayout();
//-- build the stackedWidget to the action widget layout
actionStateWidgetStack = new QStackedWidget();
......
......@@ -44,11 +44,11 @@ void ActionTransition::onTransition(QEvent* e) {
if (logStream != nullptr) {
startTime = new QTime();
startTime->start();
ActionState* asS = dynamic_cast<ActionState*>(sourceState());
auto* asS = dynamic_cast<ActionState*>(sourceState());
if (asS!=nullptr) {
QString comment;
comment = "\t<!-- ActionTransition::onTransition source:" + asS->getName();
ActionState* asD = dynamic_cast<ActionState*>(targetState());
auto* asD = dynamic_cast<ActionState*>(targetState());
if (asD!=nullptr) {
comment += " dest:" + asD->getName();
}
......@@ -66,7 +66,7 @@ void ActionTransition::onTransition(QEvent* e) {
// Apply Previous action (if necessary)
QAbstractState* previousState = this->sourceState();
ActionState* previousActionState = dynamic_cast<ActionState*> (previousState);
auto* previousActionState = dynamic_cast<ActionState*> (previousState);
// if previous is initialState, then just call "onExit()"
if ((previousState) && (applyPreviousAction)) {
......@@ -128,7 +128,7 @@ void ActionTransition::onTransition(QEvent* e) {
// Go to next State
QAbstractState* nextState = this->targetState();