[netinstall] Tighten up comments and code

- comment wandered away from the function it applies to
- use overloaded name for recursive helpers
- document this new feature
This commit is contained in:
Adriaan de Groot 2022-01-31 12:55:54 +01:00
parent 19afa46978
commit c0f4b80cbe
3 changed files with 18 additions and 14 deletions

View File

@ -24,6 +24,9 @@ This release contains contributions from (alphabetically by first name):
which allows distributions to change the value from `quiet`. which allows distributions to change the value from `quiet`.
The default, if nothing is set, remains `quiet`. Use an explicitly- The default, if nothing is set, remains `quiet`. Use an explicitly-
empty list to specify no-arguments-at-all. empty list to specify no-arguments-at-all.
- *packagechooser* can now export its choices for use by the *netinstall*
module. This makes it possible to use *packagechooser* for large-scale
choices, followed by *netinstall* for fine-grained control. (Thanks Evan)
- The *umount* module has been re-written in C++. The copy-a-log-file - The *umount* module has been re-written in C++. The copy-a-log-file
functionality has been removed. Use the *preservefiles* module for that. functionality has been removed. Use the *preservefiles* module for that.

View File

@ -14,24 +14,14 @@
#include "utils/Variant.h" #include "utils/Variant.h"
#include "utils/Yaml.h" #include "utils/Yaml.h"
/** @brief Appends groups to the tree /// Recursive helper for setSelections()
*
* Uses the data from @p groupList to add elements to the
* existing tree that m_rootItem points to. If m_rootItem
* is not valid, it does nothing
*
* Before adding anything to the model, it ensures that there
* is no existing data from the same source. If there is, that
* data is pruned first
*
*/
static void static void
setSelections2( const QStringList& selectNames, PackageTreeItem* item ) setSelections( const QStringList& selectNames, PackageTreeItem* item )
{ {
for ( int i = 0; i < item->childCount(); i++ ) for ( int i = 0; i < item->childCount(); i++ )
{ {
auto* child = item->child( i ); auto* child = item->child( i );
setSelections2( selectNames, child ); setSelections( selectNames, child );
} }
if ( item->isGroup() && selectNames.contains( item->name() ) ) if ( item->isGroup() && selectNames.contains( item->name() ) )
{ {
@ -222,7 +212,7 @@ PackageModel::setSelections( const QStringList& selectNames )
{ {
if ( m_rootItem ) if ( m_rootItem )
{ {
setSelections2( selectNames, m_rootItem ); ::setSelections( selectNames, m_rootItem );
} }
} }

View File

@ -68,6 +68,17 @@ public:
PackageTreeItem::List getPackages() const; PackageTreeItem::List getPackages() const;
PackageTreeItem::List getItemPackages( PackageTreeItem* item ) const; PackageTreeItem::List getItemPackages( PackageTreeItem* item ) const;
/** @brief Appends groups to the tree
*
* Uses the data from @p groupList to add elements to the
* existing tree that m_rootItem points to. If m_rootItem
* is not valid, it does nothing
*
* Before adding anything to the model, it ensures that there
* is no existing data from the same source. If there is, that
* data is pruned first
*
*/
void appendModelData(const QVariantList& groupList); void appendModelData(const QVariantList& groupList);
private: private: