1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

LP-572 Made Pathplanner editor more readable + typo fix

This commit is contained in:
Laurent Lalanne 2017-12-29 20:26:54 +01:00
parent c8f81b9956
commit fada2f659c
5 changed files with 61 additions and 38 deletions

View File

@ -76,8 +76,8 @@ bool flightDataModel::setColumnByIndex(pathPlanData *row, const int index, const
bool b;
switch (index) {
case WPDESCRITPTION:
row->wpDescritption = value.toString();
case WPDESCRIPTION:
row->wpDescription = value.toString();
b = true;
break;
case LATPOSITION:
@ -180,8 +180,8 @@ QVariant flightDataModel::getColumnByIndex(const pathPlanData *row, const int in
QVariant value;
switch (index) {
case WPDESCRITPTION:
value = row->wpDescritption;
case WPDESCRIPTION:
value = row->wpDescription;
break;
case LATPOSITION:
value = row->latPosition;
@ -262,77 +262,77 @@ QVariant flightDataModel::headerData(int section, Qt::Orientation orientation, i
value = QString::number(section + 1);
} else if (orientation == Qt::Horizontal) {
switch (section) {
case WPDESCRITPTION:
value = QString("Description");
case WPDESCRIPTION:
value = "Description";
break;
case LATPOSITION:
value = QString("Latitude");
value = "Latitude";
break;
case LNGPOSITION:
value = QString("Longitude");
value = "Longitude";
break;
case DISRELATIVE:
value = QString("Distance to home");
value = "Distance\nto home";
break;
case BEARELATIVE:
value = QString("Bearing from home");
value = "Bearing\nfrom home";
break;
case ALTITUDERELATIVE:
value = QString("Altitude above home");
value = "Altitude\nabove\nhome";
break;
case ISRELATIVE:
value = QString("Relative to home");
value = "Relative\nto home";
break;
case ALTITUDE:
value = QString("Altitude");
value = "Altitude";
break;
case VELOCITY:
value = QString("Velocity");
value = "Velocity";
break;
case MODE:
value = QString("Mode");
value = "Mode";
break;
case MODE_PARAMS0:
value = QString("Mode parameter 0");
value = "Mode\nparam0";
break;
case MODE_PARAMS1:
value = QString("Mode parameter 1");
value = "Mode\nparam1";
break;
case MODE_PARAMS2:
value = QString("Mode parameter 2");
value = "Mode\nparam2";
break;
case MODE_PARAMS3:
value = QString("Mode parameter 3");
value = "Mode\nparam3";
break;
case CONDITION:
value = QString("Condition");
value = "Condition";
break;
case CONDITION_PARAMS0:
value = QString("Condition parameter 0");
value = "Cond.\nparam0";
break;
case CONDITION_PARAMS1:
value = QString("Condition parameter 1");
value = "Cond.\nparam1";
break;
case CONDITION_PARAMS2:
value = QString("Condition parameter 2");
value = "Cond.\nparam2";
break;
case CONDITION_PARAMS3:
value = QString("Condition parameter 3");
value = "Cond.\nparam3";
break;
case COMMAND:
value = QString("Command");
value = "Command";
break;
case JUMPDESTINATION:
value = QString("Jump Destination");
value = "Jump\nDest.";
break;
case ERRORDESTINATION:
value = QString("Error Destination");
value = "Error\nDest.";
break;
case LOCKED:
value = QString("Locked");
value = "Locked";
break;
default:
value = QString();
value = "";
break;
}
}
@ -448,7 +448,7 @@ bool flightDataModel::writeToFile(QString fileName)
waypoint.setAttribute("number", dataStorage.indexOf(obj));
root.appendChild(waypoint);
QDomElement field = doc.createElement("field");
field.setAttribute("value", obj->wpDescritption);
field.setAttribute("value", obj->wpDescription);
field.setAttribute("name", "description");
waypoint.appendChild(field);
@ -612,7 +612,7 @@ void flightDataModel::readFromFile(QString fileName)
if (name == "altitude") {
data->altitude = value.toDouble();
} else if (name == "description") {
data->wpDescritption = value;
data->wpDescription = value;
} else if (name == "latitude") {
data->latPosition = value.toDouble();
} else if (name == "longitude") {

View File

@ -30,7 +30,7 @@
#include "opmapcontrol/opmapcontrol.h"
struct pathPlanData {
QString wpDescritption;
QString wpDescription;
double latPosition;
double lngPosition;
double disRelative;
@ -53,7 +53,7 @@ class flightDataModel : public QAbstractTableModel {
Q_OBJECT
public:
enum pathPlanDataEnum {
WPDESCRITPTION, LATPOSITION, LNGPOSITION, DISRELATIVE, BEARELATIVE, ALTITUDERELATIVE, ISRELATIVE, ALTITUDE,
WPDESCRIPTION, LATPOSITION, LNGPOSITION, DISRELATIVE, BEARELATIVE, ALTITUDERELATIVE, ISRELATIVE, ALTITUDE,
VELOCITY, MODE, MODE_PARAMS0, MODE_PARAMS1, MODE_PARAMS2, MODE_PARAMS3,
CONDITION, CONDITION_PARAMS0, CONDITION_PARAMS1, CONDITION_PARAMS2, CONDITION_PARAMS3,
COMMAND, JUMPDESTINATION, ERRORDESTINATION, LOCKED

View File

@ -233,8 +233,8 @@ void modelMapProxy::dataChanged(const QModelIndex &topLeft, const QModelIndex &b
case flightDataModel::MODE:
refreshOverlays();
break;
case flightDataModel::WPDESCRITPTION:
index = model->index(x, flightDataModel::WPDESCRITPTION);
case flightDataModel::WPDESCRIPTION:
index = model->index(x, flightDataModel::WPDESCRIPTION);
desc = index.data(Qt::DisplayRole).toString();
item->SetDescription(desc);
break;
@ -299,7 +299,7 @@ void modelMapProxy::rowsInserted(const QModelIndex &parent, int first, int last)
distBearingAltitude distBearing;
double altitude;
bool relative;
index = model->index(x, flightDataModel::WPDESCRITPTION);
index = model->index(x, flightDataModel::WPDESCRIPTION);
QString desc = index.data(Qt::DisplayRole).toString();
index = model->index(x, flightDataModel::LATPOSITION);
latlng.SetLat(index.data(Qt::DisplayRole).toDouble());

View File

@ -57,7 +57,7 @@ opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent, QAbstrac
mapper->addMapping(ui->doubleSpinBoxLatitude, flightDataModel::LATPOSITION);
mapper->addMapping(ui->doubleSpinBoxLongitude, flightDataModel::LNGPOSITION);
mapper->addMapping(ui->doubleSpinBoxAltitude, flightDataModel::ALTITUDE);
mapper->addMapping(ui->lineEditDescription, flightDataModel::WPDESCRITPTION);
mapper->addMapping(ui->lineEditDescription, flightDataModel::WPDESCRIPTION);
mapper->addMapping(ui->checkBoxRelative, flightDataModel::ISRELATIVE);
mapper->addMapping(ui->doubleSpinBoxBearing, flightDataModel::BEARELATIVE);
mapper->addMapping(ui->doubleSpinBoxVelocity, flightDataModel::VELOCITY);

View File

@ -54,7 +54,30 @@ void pathPlanner::setModel(flightDataModel *model, QItemSelectionModel *selectio
ui->tableView->setItemDelegate(new MapDataDelegate(this));
connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(rowsInserted(const QModelIndex &, int, int)));
wid = new opmap_edit_waypoint_dialog(NULL, model, selection);
ui->tableView->resizeColumnsToContents();
ui->tableView->setColumnWidth(flightDataModel::WPDESCRIPTION, 120);
ui->tableView->setColumnWidth(flightDataModel::LATPOSITION, 100);
ui->tableView->setColumnWidth(flightDataModel::LNGPOSITION, 100);
ui->tableView->setColumnWidth(flightDataModel::DISRELATIVE, 80);
ui->tableView->setColumnWidth(flightDataModel::BEARELATIVE, 80);
ui->tableView->setColumnWidth(flightDataModel::ALTITUDERELATIVE, 70);
ui->tableView->setColumnWidth(flightDataModel::ISRELATIVE, 70);
ui->tableView->setColumnWidth(flightDataModel::ALTITUDE, 80);
ui->tableView->setColumnWidth(flightDataModel::VELOCITY, 60);
ui->tableView->setColumnWidth(flightDataModel::MODE, 120);
ui->tableView->setColumnWidth(flightDataModel::MODE_PARAMS0, 60);
ui->tableView->setColumnWidth(flightDataModel::MODE_PARAMS1, 60);
ui->tableView->setColumnWidth(flightDataModel::MODE_PARAMS2, 60);
ui->tableView->setColumnWidth(flightDataModel::MODE_PARAMS3, 60);
ui->tableView->setColumnWidth(flightDataModel::CONDITION, 150);
ui->tableView->setColumnWidth(flightDataModel::CONDITION_PARAMS0, 60);
ui->tableView->setColumnWidth(flightDataModel::CONDITION_PARAMS1, 60);
ui->tableView->setColumnWidth(flightDataModel::CONDITION_PARAMS2, 60);
ui->tableView->setColumnWidth(flightDataModel::CONDITION_PARAMS3, 60);
ui->tableView->setColumnWidth(flightDataModel::COMMAND, 150);
ui->tableView->setColumnWidth(flightDataModel::JUMPDESTINATION, 60);
ui->tableView->setColumnWidth(flightDataModel::ERRORDESTINATION, 60);
ui->tableView->setColumnWidth(flightDataModel::LOCKED, 60);
}
void pathPlanner::rowsInserted(const QModelIndex & parent, int start, int end)