diff --git a/ground/openpilotgcs/src/plugins/opmap/flightdatamodel.cpp b/ground/openpilotgcs/src/plugins/opmap/flightdatamodel.cpp index 4bf2f664e..5a7b3d1ce 100644 --- a/ground/openpilotgcs/src/plugins/opmap/flightdatamodel.cpp +++ b/ground/openpilotgcs/src/plugins/opmap/flightdatamodel.cpp @@ -100,7 +100,7 @@ bool flightDataModel::setColumnByIndex(pathPlanData *row,const int index,const return true; break; case ISRELATIVE: - row->isRelative=value.toDouble(); + row->isRelative=value.toBool(); return true; break; case ALTITUDE: @@ -116,19 +116,19 @@ bool flightDataModel::setColumnByIndex(pathPlanData *row,const int index,const return true; break; case MODE_PARAMS0: - row->mode_params[0]=value.toInt(); + row->mode_params[0]=value.toFloat(); return true; break; case MODE_PARAMS1: - row->mode_params[1]=value.toInt(); + row->mode_params[1]=value.toFloat(); return true; break; case MODE_PARAMS2: - row->mode_params[2]=value.toInt(); + row->mode_params[2]=value.toFloat(); return true; break; case MODE_PARAMS3: - row->mode_params[3]=value.toInt(); + row->mode_params[3]=value.toFloat(); return true; break; case CONDITION: @@ -136,19 +136,19 @@ bool flightDataModel::setColumnByIndex(pathPlanData *row,const int index,const return true; break; case CONDITION_PARAMS0: - row->condition_params[0]=value.toInt(); + row->condition_params[0]=value.toFloat(); return true; break; case CONDITION_PARAMS1: - row->condition_params[1]=value.toInt(); + row->condition_params[1]=value.toFloat(); return true; break; case CONDITION_PARAMS2: - row->condition_params[2]=value.toInt(); + row->condition_params[2]=value.toFloat(); return true; break; case CONDITION_PARAMS3: - row->condition_params[3]=value.toInt(); + row->condition_params[3]=value.toFloat(); return true; break; case COMMAND: @@ -366,15 +366,15 @@ bool flightDataModel::insertRows(int row, int count, const QModelIndex &/*parent data->disRelative=0; data->beaRelative=0; data->altitudeRelative=0; - data->isRelative=0; + data->isRelative=true; data->altitude=0; data->velocity=0; - data->mode=0; + data->mode=1; data->mode_params[0]=0; data->mode_params[1]=0; data->mode_params[2]=0; data->mode_params[3]=0; - data->condition=0; + data->condition=3; data->condition_params[0]=0; data->condition_params[1]=0; data->condition_params[2]=0; @@ -383,6 +383,25 @@ bool flightDataModel::insertRows(int row, int count, const QModelIndex &/*parent data->jumpdestination=0; data->errordestination=0; data->locked=false; + if(rowCount()>0) + { + data->altitude=this->data(this->index(rowCount()-1,ALTITUDE)).toDouble(); + data->altitudeRelative=this->data(this->index(rowCount()-1,ALTITUDERELATIVE)).toDouble(); + data->isRelative=this->data(this->index(rowCount()-1,ISRELATIVE)).toBool(); + data->velocity=this->data(this->index(rowCount()-1,VELOCITY)).toFloat(); + data->mode=this->data(this->index(rowCount()-1,MODE)).toInt(); + data->mode_params[0]=this->data(this->index(rowCount()-1,MODE_PARAMS0)).toFloat(); + data->mode_params[1]=this->data(this->index(rowCount()-1,MODE_PARAMS1)).toFloat(); + data->mode_params[2]=this->data(this->index(rowCount()-1,MODE_PARAMS2)).toFloat(); + data->mode_params[3]=this->data(this->index(rowCount()-1,MODE_PARAMS3)).toFloat(); + data->condition=this->data(this->index(rowCount()-1,CONDITION)).toInt(); + data->condition_params[0]=this->data(this->index(rowCount()-1,CONDITION_PARAMS0)).toFloat(); + data->condition_params[1]=this->data(this->index(rowCount()-1,CONDITION_PARAMS1)).toFloat(); + data->condition_params[2]=this->data(this->index(rowCount()-1,CONDITION_PARAMS2)).toFloat(); + data->condition_params[3]=this->data(this->index(rowCount()-1,CONDITION_PARAMS3)).toFloat(); + data->command=this->data(this->index(rowCount()-1,COMMAND)).toInt(); + data->errordestination=this->data(this->index(rowCount()-1,ERRORDESTINATION)).toInt(); + } dataStorage.insert(row,data); } endInsertRows(); @@ -601,13 +620,13 @@ void flightDataModel::readFromFile(QString fileName) else if(field.attribute("name")=="mode") data->mode=field.attribute("value").toInt(); else if(field.attribute("name")=="mode_param0") - data->mode_params[0]=field.attribute("value").toDouble(); + data->mode_params[0]=field.attribute("value").toFloat(); else if(field.attribute("name")=="mode_param1") - data->mode_params[1]=field.attribute("value").toDouble(); + data->mode_params[1]=field.attribute("value").toFloat(); else if(field.attribute("name")=="mode_param2") - data->mode_params[2]=field.attribute("value").toDouble(); + data->mode_params[2]=field.attribute("value").toFloat(); else if(field.attribute("name")=="mode_param3") - data->mode_params[3]=field.attribute("value").toDouble(); + data->mode_params[3]=field.attribute("value").toFloat(); else if(field.attribute("name")=="condition") data->condition=field.attribute("value").toDouble(); else if(field.attribute("name")=="condition_param0") diff --git a/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp b/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp index 11df41f88..2aef32311 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp +++ b/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp @@ -40,7 +40,6 @@ opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent,QAbstract connect(ui->checkBoxLocked,SIGNAL(toggled(bool)),this,SLOT(enableEditWidgets(bool))); connect(ui->cbMode,SIGNAL(currentIndexChanged(int)),this,SLOT(setupModeWidgets())); connect(ui->cbCondition,SIGNAL(currentIndexChanged(int)),this,SLOT(setupConditionWidgets())); - connect(ui->pushButtonApply,SIGNAL(clicked()),this,SLOT(pushButtonApply_clicked())); connect(ui->pushButtonCancel,SIGNAL(clicked()),this,SLOT(pushButtonCancel_clicked())); MapDataDelegate::loadComboBox(ui->cbMode,flightDataModel::MODE); MapDataDelegate::loadComboBox(ui->cbCondition,flightDataModel::CONDITION); @@ -50,7 +49,7 @@ opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent,QAbstract mapper->setItemDelegate(new MapDataDelegate(this)); connect(mapper,SIGNAL(currentIndexChanged(int)),this,SLOT(currentIndexChanged(int))); mapper->setModel(model); - mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); + mapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); mapper->addMapping(ui->checkBoxLocked,flightDataModel::LOCKED); mapper->addMapping(ui->doubleSpinBoxLatitude,flightDataModel::LATPOSITION); mapper->addMapping(ui->doubleSpinBoxLongitude,flightDataModel::LNGPOSITION); @@ -234,10 +233,6 @@ void opmap_edit_waypoint_dialog::pushButtonCancel_clicked() mapper->revert(); close(); } -void opmap_edit_waypoint_dialog::pushButtonApply_clicked() -{ - mapper->submit(); -} void opmap_edit_waypoint_dialog::editWaypoint(mapcontrol::WayPointItem *waypoint_item) { if (!waypoint_item) return; diff --git a/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.h b/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.h index 2219de69e..95cc64ed7 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.h +++ b/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.h @@ -64,7 +64,6 @@ private slots: void setupConditionWidgets(); void pushButtonCancel_clicked(); void on_pushButtonOK_clicked(); - void pushButtonApply_clicked(); void on_pushButton_clicked(); void on_pushButton_2_clicked(); void enableEditWidgets(bool); diff --git a/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.ui b/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.ui index 13ae47eba..de94b5395 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.ui +++ b/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.ui @@ -386,6 +386,9 @@ 999999999.000000000000000 + + 0.010000000000000 + @@ -469,6 +472,9 @@ 999999999.000000000000000 + + 0.010000000000000 + @@ -476,6 +482,9 @@ 999999999.000000000000000 + + 0.010000000000000 + @@ -483,6 +492,9 @@ 999999999.000000000000000 + + 0.010000000000000 + @@ -545,6 +557,9 @@ 999999999.000000000000000 + + 0.010000000000000 + @@ -628,6 +643,9 @@ 999999999.000000000000000 + + 0.010000000000000 + @@ -635,6 +653,9 @@ 999999999.000000000000000 + + 0.010000000000000 + @@ -642,6 +663,9 @@ 999999999.000000000000000 + + 0.010000000000000 + @@ -798,13 +822,6 @@ - - - - Apply - - -