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

View File

@ -30,7 +30,7 @@
#include "opmapcontrol/opmapcontrol.h" #include "opmapcontrol/opmapcontrol.h"
struct pathPlanData { struct pathPlanData {
QString wpDescritption; QString wpDescription;
double latPosition; double latPosition;
double lngPosition; double lngPosition;
double disRelative; double disRelative;
@ -53,7 +53,7 @@ class flightDataModel : public QAbstractTableModel {
Q_OBJECT Q_OBJECT
public: public:
enum pathPlanDataEnum { 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, VELOCITY, MODE, MODE_PARAMS0, MODE_PARAMS1, MODE_PARAMS2, MODE_PARAMS3,
CONDITION, CONDITION_PARAMS0, CONDITION_PARAMS1, CONDITION_PARAMS2, CONDITION_PARAMS3, CONDITION, CONDITION_PARAMS0, CONDITION_PARAMS1, CONDITION_PARAMS2, CONDITION_PARAMS3,
COMMAND, JUMPDESTINATION, ERRORDESTINATION, LOCKED COMMAND, JUMPDESTINATION, ERRORDESTINATION, LOCKED

View File

@ -233,8 +233,8 @@ void modelMapProxy::dataChanged(const QModelIndex &topLeft, const QModelIndex &b
case flightDataModel::MODE: case flightDataModel::MODE:
refreshOverlays(); refreshOverlays();
break; break;
case flightDataModel::WPDESCRITPTION: case flightDataModel::WPDESCRIPTION:
index = model->index(x, flightDataModel::WPDESCRITPTION); index = model->index(x, flightDataModel::WPDESCRIPTION);
desc = index.data(Qt::DisplayRole).toString(); desc = index.data(Qt::DisplayRole).toString();
item->SetDescription(desc); item->SetDescription(desc);
break; break;
@ -299,7 +299,7 @@ void modelMapProxy::rowsInserted(const QModelIndex &parent, int first, int last)
distBearingAltitude distBearing; distBearingAltitude distBearing;
double altitude; double altitude;
bool relative; bool relative;
index = model->index(x, flightDataModel::WPDESCRITPTION); index = model->index(x, flightDataModel::WPDESCRIPTION);
QString desc = index.data(Qt::DisplayRole).toString(); QString desc = index.data(Qt::DisplayRole).toString();
index = model->index(x, flightDataModel::LATPOSITION); index = model->index(x, flightDataModel::LATPOSITION);
latlng.SetLat(index.data(Qt::DisplayRole).toDouble()); 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->doubleSpinBoxLatitude, flightDataModel::LATPOSITION);
mapper->addMapping(ui->doubleSpinBoxLongitude, flightDataModel::LNGPOSITION); mapper->addMapping(ui->doubleSpinBoxLongitude, flightDataModel::LNGPOSITION);
mapper->addMapping(ui->doubleSpinBoxAltitude, flightDataModel::ALTITUDE); 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->checkBoxRelative, flightDataModel::ISRELATIVE);
mapper->addMapping(ui->doubleSpinBoxBearing, flightDataModel::BEARELATIVE); mapper->addMapping(ui->doubleSpinBoxBearing, flightDataModel::BEARELATIVE);
mapper->addMapping(ui->doubleSpinBoxVelocity, flightDataModel::VELOCITY); 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)); ui->tableView->setItemDelegate(new MapDataDelegate(this));
connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(rowsInserted(const QModelIndex &, int, int))); connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(rowsInserted(const QModelIndex &, int, int)));
wid = new opmap_edit_waypoint_dialog(NULL, model, selection); 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) void pathPlanner::rowsInserted(const QModelIndex & parent, int start, int end)