Launcher: improve flight plan leg display
This commit is contained in:
parent
612693c276
commit
758518b248
1 changed files with 16 additions and 9 deletions
|
@ -52,9 +52,18 @@ public:
|
||||||
if (!leg)
|
if (!leg)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
const auto wp = leg->waypoint();
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole: {
|
||||||
|
if (wp->type() == "via") {
|
||||||
|
// we want the end waypoint name
|
||||||
|
return QString::fromStdString(wp->source()->ident());
|
||||||
|
}
|
||||||
|
|
||||||
return QString::fromStdString(leg->waypoint()->ident());
|
return QString::fromStdString(leg->waypoint()->ident());
|
||||||
|
}
|
||||||
|
|
||||||
case LegDistanceRole:
|
case LegDistanceRole:
|
||||||
return QVariant::fromValue(QuantityValue{Units::NauticalMiles, leg->distanceNm()});
|
return QVariant::fromValue(QuantityValue{Units::NauticalMiles, leg->distanceNm()});
|
||||||
case LegTrackRole:
|
case LegTrackRole:
|
||||||
|
@ -62,17 +71,15 @@ public:
|
||||||
|
|
||||||
case LegAirwayIdentRole:
|
case LegAirwayIdentRole:
|
||||||
{
|
{
|
||||||
const auto wp = leg->waypoint();
|
AirwayRef awy;
|
||||||
if (wp->type() == "via") {
|
if (wp->type() == "via") {
|
||||||
auto via = static_cast<flightgear::Via*>(leg->waypoint());
|
auto via = static_cast<flightgear::Via*>(leg->waypoint());
|
||||||
return QString::fromStdString(via->airway());
|
awy = via->airway();
|
||||||
|
} else if (wp->flag(WPT_VIA)) {
|
||||||
|
awy = static_cast<Airway*>(wp->owner());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wp->flag(WPT_VIA)) {
|
return awy ? QString::fromStdString(awy->ident()) : QVariant{};
|
||||||
AirwayRef awy = static_cast<Airway*>(wp->owner());
|
|
||||||
return QString::fromStdString(awy->ident());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case LegTerminatorNavRole:
|
case LegTerminatorNavRole:
|
||||||
|
|
Loading…
Reference in a new issue