[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,7 +232,14 @@ PackageChooserViewStep::fillModel( const QVariantList& items )
continue; continue;
} }
m_model->addPackage( PackageItem( item_map ) ); if ( item_map.contains( "appdata" ) )
{
m_model->addPackage( PackageItem::fromAppData( CalamaresUtils::getString( item_map, "appdata" ) ) );
}
else
{
m_model->addPackage( PackageItem( item_map ) );
}
} }
} }

View File

@ -24,8 +24,11 @@ mode: required
# pretty short list to avoid overwhelming the UI. This is a list # pretty short list to avoid overwhelming the UI. This is a list
# of objects, and the items are displayed in list order. # of objects, and the items are displayed in list order.
# #
# Each item has an id, which is used in setting # the value of # Either provide the data for an item in the list (using the keys
# *packagechooser_<module-id>*). The following fields # 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: # are mandatory:
# #
# - *id* ID for the product. The ID "" is special, and is used for # - *id* ID for the product. The ID "" is special, and is used for
@ -33,13 +36,24 @@ mode: required
# selecting none. # selecting none.
# - *package* Package name for the product. While mandatory, this is # - *package* Package name for the product. While mandatory, this is
# not actually used anywhere. # not actually used anywhere.
# - *name* Human-readable, but untranslated, name of the product. # - *name* Human-readable name of the product. To provide translations,
# - *description* Human-readable, but untranslated, description. # 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 # - *screenshot* Path to a single screenshot of the product. May be
# a filesystem path or a QRC path (e.g. ":/images/no-selection.png"). # 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 # Use the empty string "" as ID / key for the "no selection" item if
# you want to customize the display of that item as well. # 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: items:
- id: "" - id: ""
package: "" package: ""
@ -58,5 +72,5 @@ items:
name: GNOME name: GNOME
description: GNU Networked Object Modeling Environment Desktop description: GNU Networked Object Modeling Environment Desktop
screenshot: ":/images/gnome.png" screenshot: ":/images/gnome.png"
- appdata: ../io.calamares.calamares.appdata.xml