[packagechooser] Implement AppData loading

- An item can refer to *appdata* and load that, or provide
   the data in the config file itself.
 - Fix documentation about translations.
This commit is contained in:
Adriaan de Groot 2019-08-06 15:55:27 +02:00
parent 9a8b2c5a1e
commit d72391942f
2 changed files with 27 additions and 6 deletions

View File

@ -232,8 +232,15 @@ PackageChooserViewStep::fillModel( const QVariantList& items )
continue;
}
if ( item_map.contains( "appdata" ) )
{
m_model->addPackage( PackageItem::fromAppData( CalamaresUtils::getString( item_map, "appdata" ) ) );
}
else
{
m_model->addPackage( PackageItem( item_map ) );
}
}
}
void

View File

@ -24,8 +24,11 @@ mode: required
# pretty short list to avoid overwhelming the UI. This is a list
# of objects, and the items are displayed in list order.
#
# Each item has an id, which is used in setting # the value of
# *packagechooser_<module-id>*). The following fields
# Either provide the data for an item in the list (using the keys
# below), or use existing AppData XML files as a source for the data.
#
# For data provided by the list: the item has an id, which is used in
# setting the value of *packagechooser_<module-id>*). The following fields
# are mandatory:
#
# - *id* ID for the product. The ID "" is special, and is used for
@ -33,13 +36,24 @@ mode: required
# selecting none.
# - *package* Package name for the product. While mandatory, this is
# not actually used anywhere.
# - *name* Human-readable, but untranslated, name of the product.
# - *description* Human-readable, but untranslated, description.
# - *name* Human-readable name of the product. To provide translations,
# add a *[lang]* decoration as part of the key name, e.g. `name[nl]`
# for Dutch. The list of usable languages can be found in
# `CMakeLists.txt` or as part of the debug output of Calamares.
# - *description* Human-readable description. These can be translated
# as well.
# - *screenshot* Path to a single screenshot of the product. May be
# a filesystem path or a QRC path (e.g. ":/images/no-selection.png").
#
# Use the empty string "" as ID / key for the "no selection" item if
# you want to customize the display of that item as well.
#
# For data provided by AppData XML: the item has an *appdata*
# key which points to an AppData XML file in the local filesystem.
# This file is parsed to provide the id (from AppData id), name
# (from AppData name), description (from AppData description paragraphs
# or the summary entries), and a screenshot (the defautl screenshot
# from AppData). No package is set (but that is unused anyway).
items:
- id: ""
package: ""
@ -58,5 +72,5 @@ items:
name: GNOME
description: GNU Networked Object Modeling Environment Desktop
screenshot: ":/images/gnome.png"
- appdata: ../io.calamares.calamares.appdata.xml