role = AircraftThumbnailRole; // use first thumbnail
}
+ if ((role >= AircraftVariantDescriptionRole) && (role < AircraftThumbnailRole)) {
+ int variantIndex = role - AircraftVariantDescriptionRole;
+ return QString::fromStdString(item->nameForVariant(variantIndex));
+ }
+
if (role == Qt::DisplayRole) {
- return QString::fromStdString(item->name());
+ return QString::fromStdString(item->nameForVariant(variantIndex));
} else if (role == AircraftPathRole) {
InstallRef i = item->existingInstall();
if (i.valid()) {
return QString::fromStdString(i->primarySetPath().str());
}
} else if (role == AircraftPackageIdRole) {
- return QString::fromStdString(item->id());
+ return QString::fromStdString(item->variants()[variantIndex]);
} else if (role == AircraftPackageStatusRole) {
InstallRef i = item->existingInstall();
if (i.valid()) {
} else {
return PackageNotInstalled;
}
+ } else if (role == AircraftVariantCountRole) {
+ // this value wants the number of aditional variants, i.e not
+ // including the primary. Hence the -1 term.
+ return static_cast<quint32>(item->variants().size() - 1);
} else if (role == AircraftThumbnailSizeRole) {
QPixmap pm = packageThumbnail(item, 0, false).value<QPixmap>();
if (pm.isNull())
} else if (role == AircraftPackageSizeRole) {
return static_cast<int>(item->fileSizeBytes());
} else if (role == AircraftURIRole) {
- return QUrl("package:" + QString::fromStdString(item->qualifiedId()));
+ return QUrl("package:" + QString::fromStdString(item->qualifiedVariantId(variantIndex)));
} else if (role == AircraftHasRatingsRole) {
return item->properties()->hasChild("rating");
} else if ((role >= AircraftRatingRole) && (role < AircraftVariantDescriptionRole)) {
bool AircraftItemModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
+ int row = index.row();
if (role == AircraftVariantRole) {
- m_activeVariant[index.row()] = value.toInt();
+ if (row >= m_activeVariant.size()) {
+ row -= m_activeVariant.size();
+ m_packageVariant[row] = value.toInt();
+ } else {
+ m_activeVariant[row] = value.toInt();
+ }
+
emit dataChanged(index, index);
return true;
}
setFile.truncate(setFile.count() - 8); // drop the '-set.xml' portion
opt->addOption("aircraft", setFile.toStdString());
} else if (m_selectedAircraft.scheme() == "package") {
- PackageRef pkg = packageForAircraftURI(m_selectedAircraft);
+ QString qualifiedId = m_selectedAircraft.path();
// no need to set aircraft-dir, handled by the corresponding code
// in fgInitAircraft
- opt->addOption("aircraft", pkg->qualifiedId());
+ opt->addOption("aircraft", qualifiedId.toStdString());
} else {
qWarning() << "unsupported aircraft launch URL" << m_selectedAircraft;
}
aircraftDir = setFileInfo.dir().absolutePath().toStdString();
aircraftPropValue = setFile.toStdString();
} else if (m_selectedAircraft.scheme() == "package") {
- PackageRef pkg = packageForAircraftURI(m_selectedAircraft);
// no need to set aircraft-dir, handled by the corresponding code
// in fgInitAircraft
- aircraftPropValue = pkg->qualifiedId();
+ aircraftPropValue = m_selectedAircraft.path().toStdString();
} else {
qWarning() << "unsupported aircraft launch URL" << m_selectedAircraft;
}