feat: "Noncheckable" option for netinstall package groups

The "Noncheckable" option, when true prevents a user from checking the whole group. This does not affect whether any child subgroups or packages can be selected or not

No breaking changes
This commit is contained in:
shivanandvp 2022-09-24 21:01:38 -05:00
parent f75b599e2a
commit f2ba0929d7
No known key found for this signature in database
GPG Key ID: 90465D24C5B3C731
5 changed files with 16 additions and 1 deletions

View File

@ -188,7 +188,7 @@ PackageModel::flags( const QModelIndex& index ) const
if ( index.column() == NameColumn ) if ( index.column() == NameColumn )
{ {
PackageTreeItem* item = static_cast< PackageTreeItem* >( index.internalPointer() ); PackageTreeItem* item = static_cast< PackageTreeItem* >( index.internalPointer() );
if ( item->isImmutable() ) if ( item->isImmutable() || item->isNoncheckable() )
{ {
return QAbstractItemModel::flags( index ); //Qt::NoItemFlags; return QAbstractItemModel::flags( index ); //Qt::NoItemFlags;
} }

View File

@ -49,6 +49,7 @@ PackageTreeItem::PackageTreeItem( const QString& packageName, PackageTreeItem* p
, m_isGroup( false ) , m_isGroup( false )
, m_isCritical( parent ? parent->isCritical() : false ) , m_isCritical( parent ? parent->isCritical() : false )
, m_showReadOnly( parent ? parent->isImmutable() : false ) , m_showReadOnly( parent ? parent->isImmutable() : false )
, m_showNoncheckable( false )
{ {
} }
@ -60,6 +61,7 @@ PackageTreeItem::PackageTreeItem( const QVariantMap& groupData, PackageTag&& par
, m_isGroup( false ) , m_isGroup( false )
, m_isCritical( parent.parent ? parent.parent->isCritical() : false ) , m_isCritical( parent.parent ? parent.parent->isCritical() : false )
, m_showReadOnly( parent.parent ? parent.parent->isImmutable() : false ) , m_showReadOnly( parent.parent ? parent.parent->isImmutable() : false )
, m_showNoncheckable( false )
{ {
} }
@ -75,6 +77,7 @@ PackageTreeItem::PackageTreeItem( const QVariantMap& groupData, GroupTag&& paren
, m_isCritical( parentCriticality( groupData, parent.parent ) ) , m_isCritical( parentCriticality( groupData, parent.parent ) )
, m_isHidden( CalamaresUtils::getBool( groupData, "hidden", false ) ) , m_isHidden( CalamaresUtils::getBool( groupData, "hidden", false ) )
, m_showReadOnly( CalamaresUtils::getBool( groupData, "immutable", false ) ) , m_showReadOnly( CalamaresUtils::getBool( groupData, "immutable", false ) )
, m_showNoncheckable( CalamaresUtils::getBool( groupData, "noncheckable", false ) )
, m_startExpanded( CalamaresUtils::getBool( groupData, "expanded", false ) ) , m_startExpanded( CalamaresUtils::getBool( groupData, "expanded", false ) )
{ {
} }

View File

@ -109,6 +109,13 @@ public:
*/ */
bool isImmutable() const { return m_showReadOnly; } bool isImmutable() const { return m_showReadOnly; }
/** @brief Is this a non-checkable item?
*
* Groups can be non-checkable: then you can't toggle the selected
* state of the group. This does not affect subgroups or packages.
*/
bool isNoncheckable() const { return m_showNoncheckable; }
/** @brief is this item selected? /** @brief is this item selected?
* *
* Groups may be partially selected; packages are only on or off. * Groups may be partially selected; packages are only on or off.
@ -165,6 +172,7 @@ private:
bool m_isCritical = false; bool m_isCritical = false;
bool m_isHidden = false; bool m_isHidden = false;
bool m_showReadOnly = false; bool m_showReadOnly = false;
bool m_showNoncheckable = false;
bool m_startExpanded = false; bool m_startExpanded = false;
}; };

View File

@ -183,6 +183,9 @@ label:
# really only makes sense in combination with *selected* set to true, # really only makes sense in combination with *selected* set to true,
# so that the packages will be installed. (Setting a group to immutable # so that the packages will be installed. (Setting a group to immutable
# can be seen as removing it from the user-interface.) # can be seen as removing it from the user-interface.)
# - *noncheckable*: if true, the entire group cannot be selected or
# deselected by a single click. This does not affect any subgroups
# or child packages
# - *expanded*: if true, the group is shown in an expanded form (that is, # - *expanded*: if true, the group is shown in an expanded form (that is,
# not-collapsed) in the treeview on start. This only affects the user- # not-collapsed) in the treeview on start. This only affects the user-
# interface. Only top-level groups are show expanded-initially. # interface. Only top-level groups are show expanded-initially.

View File

@ -33,6 +33,7 @@ definitions:
selected: { type: boolean } selected: { type: boolean }
critical: { type: boolean, default: false } critical: { type: boolean, default: false }
immutable: { type: boolean } immutable: { type: boolean }
noncheckable: { type: boolean }
expanded: { type: boolean } expanded: { type: boolean }
subgroups: subgroups:
type: array type: array