[netinstall] Implement pre-expanded groups
- Return relevant data - Document code - Add to README.md documentation about new key
This commit is contained in:
parent
b9b48cfbb1
commit
e2d9ce737c
@ -154,11 +154,10 @@ NetInstallPage::dataIsHere()
|
||||
ui->groupswidget->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
|
||||
ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch );
|
||||
|
||||
cDebug() << "Groups info rows=" << m_groups->rowCount();
|
||||
// Go backwards because expanding a group may cause rows to appear below it
|
||||
for ( int i = m_groups->rowCount() - 1; i >= 0; --i )
|
||||
{
|
||||
auto index = m_groups->index(i,0);
|
||||
cDebug() << Logger::SubEntry << i << m_groups->data(index, Qt::DisplayRole);
|
||||
if ( m_groups->data(index, PackageModel::MetaExpandRole).toBool() )
|
||||
{
|
||||
ui->groupswidget->setExpanded(index, true);
|
||||
|
@ -123,6 +123,8 @@ PackageModel::data( const QModelIndex& index, int role ) const
|
||||
return index.column() == NameColumn ? item->isSelected() : QVariant();
|
||||
case Qt::DisplayRole:
|
||||
return item->isHidden() ? QVariant() : item->data( index.column() );
|
||||
case MetaExpandRole:
|
||||
return item->isHidden() ? false : item->expandOnStart();
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -67,9 +67,14 @@ public:
|
||||
QString packageName() const;
|
||||
QString postScript() const;
|
||||
|
||||
/** @brief Is this item hidden?
|
||||
*
|
||||
* Hidden items (generally only groups) are maintained separately,
|
||||
* not shown to the user, but do enter into the package-installation process.
|
||||
*/
|
||||
bool isHidden() const;
|
||||
/**
|
||||
* @brief Is this hidden item, considered "selected"?
|
||||
|
||||
/** @brief Is this hidden item, considered "selected"?
|
||||
*
|
||||
* This asserts when called on a non-hidden item.
|
||||
* A hidden item has its own selected state, but really
|
||||
@ -77,8 +82,21 @@ public:
|
||||
*/
|
||||
bool hiddenSelected() const;
|
||||
|
||||
/** @brief Is this group critical?
|
||||
*
|
||||
* A critical group must be successfully installed, for the Calamares
|
||||
* installation to continue.
|
||||
*/
|
||||
bool isCritical() const;
|
||||
|
||||
/** @brief Is this group expanded on start?
|
||||
*
|
||||
* This does not affect installation, only the UI. A group
|
||||
* that expands on start is shown expanded (not collapsed)
|
||||
* in the treeview when the page is loaded.
|
||||
*/
|
||||
bool expandOnStart() const { return m_data.startExpanded; }
|
||||
|
||||
Qt::CheckState isSelected() const;
|
||||
void setSelected( Qt::CheckState isSelected );
|
||||
void setChildrenSelected( Qt::CheckState isSelected );
|
||||
|
@ -48,6 +48,8 @@ More keys (per group) are supported:
|
||||
- *critical*: if true, make the installation process fail if installing
|
||||
any of the packages in the group fails. Otherwise, just log a warning.
|
||||
Defaults to false.
|
||||
- *expanded*: if true, the group is shown in an expanded form (that is,
|
||||
not-collapsed) in the treeview on start.
|
||||
- *subgroups*: if present this follows the same structure as the top level
|
||||
of the YAML file, allowing there to be sub-groups of packages to an
|
||||
arbitary depth
|
||||
|
Loading…
Reference in New Issue
Block a user