From: James Turner Date: Fri, 15 Apr 2016 16:21:49 +0000 (+0100) Subject: Fixes to launcher description rendering. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=31cad6d384d6b6aa6be91535d87a1800c84c4cd3;p=flightgear.git Fixes to launcher description rendering. --- diff --git a/src/GUI/AircraftModel.cxx b/src/GUI/AircraftModel.cxx index 4c0b59886..b4fe7f675 100644 --- a/src/GUI/AircraftModel.cxx +++ b/src/GUI/AircraftModel.cxx @@ -90,6 +90,11 @@ AircraftItem::AircraftItem(QDir dir, QString filePath) : } + if (sim->hasChild("long-description")) { + // clean up any XML whitspace in the text. + longDescription = QString(sim->getStringValue("long-description")).simplified(); + } + if (sim->hasChild("variant-of")) { variantOf = sim->getStringValue("variant-of"); } @@ -124,7 +129,7 @@ void AircraftItem::fromDataStream(QDataStream& ds) return; } - ds >> description >> authors >> variantOf; + ds >> description >> longDescription >> authors >> variantOf; for (int i=0; i<4; ++i) ds >> ratings[i]; } @@ -135,7 +140,7 @@ void AircraftItem::toDataStream(QDataStream& ds) const return; } - ds << description << authors << variantOf; + ds << description << longDescription << authors << variantOf; for (int i=0; i<4; ++i) ds << ratings[i]; } @@ -157,7 +162,7 @@ QPixmap AircraftItem::thumbnail() const } -static quint32 CACHE_VERSION = 3; +static quint32 CACHE_VERSION = 5; class AircraftScanThread : public QThread { @@ -674,12 +679,7 @@ QVariant AircraftItemModel::dataFromItem(AircraftItemPtr item, quint32 variantIn } return have; } else if (role == AircraftLongDescriptionRole) { -#if 0 - return "Lorum Ipsum, etc. Is this the real life? Is this just fantasy? Caught in a land-slide, " - "no escape from reality. Open your eyes, like up to the skies and see. " - "I'm just a poor boy, I need no sympathy because I'm easy come, easy go." - "Litte high, little low. Anywhere the wind blows."; -#endif + return item->longDescription; } else if (role == AircraftIsHelicopterRole) { return item->usesHeliports; } else if (role == AircraftIsSeaplaneRole) { @@ -751,7 +751,7 @@ QVariant AircraftItemModel::dataFromPackage(const PackageRef& item, quint32 vari return QString::fromStdString(authors->getStringValue()); } } else if (role == AircraftLongDescriptionRole) { - return QString::fromStdString(item->description()); + return QString::fromStdString(item->description()).simplified(); } else if (role == AircraftPackageSizeRole) { return static_cast(item->fileSizeBytes()); } else if (role == AircraftURIRole) { diff --git a/src/GUI/AircraftModel.hxx b/src/GUI/AircraftModel.hxx index 96ea5aab6..401a6b6a2 100644 --- a/src/GUI/AircraftModel.hxx +++ b/src/GUI/AircraftModel.hxx @@ -77,6 +77,7 @@ struct AircraftItem bool excluded; QString path; QString description; + QString longDescription; QString authors; int ratings[4]; QString variantOf;