Carrier launcher: Usability improvements
- Support for <description> under <entry> in AI scenario - Carrier icon consistent with UI - Location "ship" icon toggles between ships and airports.
This commit is contained in:
parent
6b17604ba8
commit
e0fb27037b
7 changed files with 54 additions and 33 deletions
|
@ -686,6 +686,9 @@ void FGAICarrier::extractCarriersFromScenario(SGPropertyNode_ptr xmlNode, SGProp
|
|||
carrierNode->setDoubleValue("longitude", c->getDoubleValue("longitude"));
|
||||
carrierNode->setDoubleValue("latitude", c->getDoubleValue("latitude"));
|
||||
|
||||
// A description of the carrier is also available from the entry. Primarily for use by the launcher
|
||||
carrierNode->setStringValue("description", c->getStringValue("description"));
|
||||
|
||||
// the find code above just looks for anything called a name (so alias
|
||||
// are possible, for example)
|
||||
if (!name.empty()) carrierNode->addChild("name")->setStringValue(name);
|
||||
|
|
|
@ -12,7 +12,7 @@ CarriersLocationModel::CarriersLocationModel(QObject *parent)
|
|||
SGPropertyNode_ptr localRoot(new SGPropertyNode);
|
||||
FGAIManager::registerScenarios(localRoot);
|
||||
|
||||
// this code encodes some scenario structre, sorry
|
||||
// this code encodes some scenario structure, sorry
|
||||
for (auto s : localRoot->getNode("sim/ai/scenarios")->getChildren("scenario")) {
|
||||
const std::string scenarioId = s->getStringValue("id");
|
||||
for (auto c : s->getChildren("carrier")) {
|
||||
|
@ -26,6 +26,7 @@ void CarriersLocationModel::processCarrier(const string &scenario, SGPropertyNod
|
|||
const auto name = QString::fromStdString(carrierNode->getStringValue("name"));
|
||||
const auto pennant = QString::fromStdString(carrierNode->getStringValue("pennant-number"));
|
||||
const auto tacan = QString::fromStdString(carrierNode->getStringValue("TACAN-channel-ID"));
|
||||
const auto desc = QString::fromStdString(carrierNode->getStringValue("description"));
|
||||
SGGeod geod = SGGeod::fromDeg(carrierNode->getDoubleValue("longitude"),
|
||||
carrierNode->getDoubleValue("latitude"));
|
||||
|
||||
|
@ -38,6 +39,7 @@ void CarriersLocationModel::processCarrier(const string &scenario, SGPropertyNod
|
|||
QString::fromStdString(scenario),
|
||||
pennant,
|
||||
name,
|
||||
desc,
|
||||
geod,
|
||||
tacan,
|
||||
parkings
|
||||
|
@ -65,6 +67,8 @@ QVariant CarriersLocationModel::data(const QModelIndex &index, int role) const
|
|||
case NameRole: return c.mName;
|
||||
// case GeodRole: return QVariant::fromValue(c.mInitialLocation);
|
||||
case IdentRole: return c.mCallsign;
|
||||
case DescriptionRole: return c.mDescription;
|
||||
case TypeRole: return "Carrier";
|
||||
case IconRole: return QPixmap(":/svg/aircraft-carrier");
|
||||
default:
|
||||
break;
|
||||
|
@ -83,6 +87,7 @@ QHash<int, QByteArray> CarriersLocationModel::roleNames() const
|
|||
result[NameRole] = "name";
|
||||
result[IconRole] = "icon";
|
||||
result[TypeRole] = "type";
|
||||
result[DescriptionRole] = "description";
|
||||
result[NavFrequencyRole] = "frequency";
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ public:
|
|||
NameRole = Qt::UserRole + 4,
|
||||
IconRole = Qt::UserRole + 5,
|
||||
TypeRole = Qt::UserRole + 6,
|
||||
NavFrequencyRole = Qt::UserRole + 7
|
||||
NavFrequencyRole = Qt::UserRole + 7,
|
||||
DescriptionRole = Qt::UserRole + 8
|
||||
};
|
||||
|
||||
int indexOf(const QString name) const;
|
||||
|
@ -46,6 +47,7 @@ private:
|
|||
QString mScenario; // scenario ID for loading
|
||||
QString mCallsign; // pennant-number
|
||||
QString mName;
|
||||
QString mDescription;
|
||||
SGGeod mInitialLocation;
|
||||
// icon?
|
||||
QString mTACAN;
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="172.41008"
|
||||
height="72.426231"
|
||||
viewBox="0 0 456.16835 191.62773"
|
||||
width="87.149193"
|
||||
height="37.111004"
|
||||
viewBox="0 0 461.16447 196.37906"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:export-filename="/home/stuart/bitmap.png"
|
||||
|
@ -29,8 +29,8 @@
|
|||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="4"
|
||||
inkscape:cx="118.80392"
|
||||
inkscape:cy="-5.4573402"
|
||||
inkscape:cx="82.435073"
|
||||
inkscape:cy="-17.019439"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
|
@ -39,10 +39,10 @@
|
|||
inkscape:window-x="67"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
fit-margin-top="10"
|
||||
fit-margin-left="10"
|
||||
fit-margin-right="10"
|
||||
fit-margin-bottom="10"
|
||||
fit-margin-top="5"
|
||||
fit-margin-left="5"
|
||||
fit-margin-right="5"
|
||||
fit-margin-bottom="5"
|
||||
units="px"
|
||||
scale-x="10" />
|
||||
<metadata
|
||||
|
@ -62,49 +62,49 @@
|
|||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
style="display:inline"
|
||||
transform="translate(316.60899,-100.95989)">
|
||||
transform="translate(319.16852,-98.581295)">
|
||||
<path
|
||||
style="fill:#313434;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#009bff;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m -290.00765,177.53052 7.30519,71.36096 55.25252,16.03618 215.076885,1.06907 30.407428,-31.5378 94.930487,-12.2944 -1.4833,-45.43582 -94.559656,-10.69078 -31.890713,-38.48681 -219.155941,2.13815 -8.15808,34.74504 z"
|
||||
id="Outline"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:label="#path826"
|
||||
sodipodi:nodetypes="cccccccccccc" />
|
||||
<path
|
||||
style="fill:#b9b9b9;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m -98.747312,266.14668 0.200595,-46.99016 h -24.786803 l -0.73387,13.23009 -59.39478,-0.54281 -0.6013,33.61805 z"
|
||||
style="fill:#009bff;fill-opacity:1;fill-rule:evenodd;stroke:#009bff;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m -82.210854,265.48522 0.200595,-46.99016 h -24.786801 l -0.73387,13.23009 -59.39478,-0.54281 -0.6013,33.61805 z"
|
||||
id="Island"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:label="#path828"
|
||||
sodipodi:nodetypes="ccccccc" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#009aff;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m -286.7815,192.23034 4.44986,40.62497"
|
||||
id="path832"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m -14.968809,127.55112 -272.072271,62.05998 5.87874,50.4939 298.084244,-74.06707"
|
||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#009aff;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m -14.968809,127.55112 -271.812691,64.67922 2.97333,48.86685 300.730074,-75.05926"
|
||||
id="LandingMarks"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:label="#path834"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#b2b8b8;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M -40.740953,191.48199 106.69796,186.99186"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#009aff;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M -47.355536,198.09657 100.08338,193.60644"
|
||||
id="Cat1"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:label="#path836" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#b2b8b8;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M -38.145195,231.51897 107.99584,213.93263"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#009aff;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M -44.09832,226.88876 102.04272,209.30242"
|
||||
id="Cat2"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:label="#path836"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#ffff00;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:29.99999994, 4.99999999;stroke-dashoffset:0;stroke-opacity:1"
|
||||
d="M -280.84835,213.55846 -4.9195252,145.83235"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#009aff;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:29.99999994, 4.99999999;stroke-dashoffset:0;stroke-opacity:1"
|
||||
d="M -273.57231,212.56627 -18.148692,149.13964"
|
||||
id="Centerline"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:label="#path853"
|
||||
|
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
BIN
src/GUI/assets/icons8-airport-50.png
Normal file
BIN
src/GUI/assets/icons8-airport-50.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -109,6 +109,10 @@ Item {
|
|||
return "%1 - %2 (%3 MHz)".arg(model.ident).arg(model.name).arg(freq);
|
||||
}
|
||||
|
||||
if (model.type === "Carrier") {
|
||||
return "%1 - %2\n%3".arg(model.ident).arg(model.name).arg(model.description);
|
||||
}
|
||||
|
||||
// general case
|
||||
return "%1 - %2".arg(model.ident).arg(model.name);
|
||||
}
|
||||
|
@ -225,7 +229,13 @@ Item {
|
|||
icon: "qrc:///svg/icon-carrier"
|
||||
|
||||
onClicked: {
|
||||
root.showCarriers = true;
|
||||
root.showCarriers = ! root.showCarriers;
|
||||
|
||||
if (root.showCarriers) {
|
||||
this.icon = "qrc:///svg/icon-airport"
|
||||
} else {
|
||||
this.icon = "qrc:///svg/icon-carrier"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,6 +155,7 @@
|
|||
<file alias="icon-list-view">assets/icons8-menu.svg</file>
|
||||
<file alias="icon-hide">assets/icons8-hide-50.png</file>
|
||||
<file alias="icon-carrier">assets/icons8-cargo-ship-50.png</file>
|
||||
<file alias="icon-airport">assets/icons8-airport-50.png</file>
|
||||
<file alias="aircraft-carrier">assets/aircraft-carrier-icon.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Reference in a new issue