[netinstall] Implement local
loading of packages
- For a static list of selectable packages (e.g. what you might otherwise use file:/// for with a static file on the ISO) you can now stick the list in the config file itself, simplifying some setups. - Also saves faffing about with network. SEE #1319
This commit is contained in:
parent
f59cae2dbb
commit
1a5c916923
@ -154,6 +154,14 @@ NetInstallPage::dataIsHere()
|
||||
ui->groupswidget->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
|
||||
ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch );
|
||||
|
||||
expandGroups();
|
||||
|
||||
emit checkReady( true );
|
||||
}
|
||||
|
||||
void
|
||||
NetInstallPage::expandGroups()
|
||||
{
|
||||
// Go backwards because expanding a group may cause rows to appear below it
|
||||
for ( int i = m_groups->rowCount() - 1; i >= 0; --i )
|
||||
{
|
||||
@ -163,8 +171,6 @@ NetInstallPage::dataIsHere()
|
||||
ui->groupswidget->setExpanded( index, true );
|
||||
}
|
||||
}
|
||||
|
||||
emit checkReady( true );
|
||||
}
|
||||
|
||||
PackageTreeItem::List
|
||||
@ -203,6 +209,23 @@ NetInstallPage::loadGroupList( const QString& confUrl )
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NetInstallPage::loadGroupList( const QVariantList& l )
|
||||
{
|
||||
// This short-cuts through loading and just uses the data,
|
||||
// containing cruft from dataIsHere() and readGroups().
|
||||
m_groups = new PackageModel( l );
|
||||
retranslate(); // For changed model
|
||||
ui->groupswidget->setModel( m_groups );
|
||||
ui->groupswidget->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
|
||||
ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch );
|
||||
|
||||
expandGroups();
|
||||
|
||||
emit checkReady( true );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
NetInstallPage::setRequired( bool b )
|
||||
{
|
||||
|
@ -64,6 +64,8 @@ public:
|
||||
* displaying the page.
|
||||
*/
|
||||
void loadGroupList( const QString& url );
|
||||
/// @brief Retrieve pre-processed and fetched group data
|
||||
void loadGroupList( const QVariantList& l );
|
||||
|
||||
// Sets the "required" state of netinstall data. Influences whether
|
||||
// corrupt or unavailable data causes checkReady() to be emitted
|
||||
@ -90,6 +92,13 @@ private:
|
||||
// of this module to know the format expected of the YAML files.
|
||||
bool readGroups( const QByteArray& yamlData );
|
||||
|
||||
/** @brief Expand entries that should be pre-expanded
|
||||
*
|
||||
* Follows the *expanded* key / the startExpanded field in the
|
||||
* group entries of the model. Call this after filling up the model.
|
||||
*/
|
||||
void expandGroups();
|
||||
|
||||
Ui::Page_NetInst* ui;
|
||||
|
||||
std::unique_ptr< CalamaresUtils::Locale::TranslatedString > m_title; // Above the treeview
|
||||
|
@ -209,7 +209,15 @@ NetInstallViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
// Keep putting groupsUrl into the global storage,
|
||||
// even though it's no longer used for in-module data-passing.
|
||||
Calamares::JobQueue::instance()->globalStorage()->insert( "groupsUrl", groupsUrl );
|
||||
m_widget->loadGroupList( groupsUrl );
|
||||
if ( groupsUrl == QStringLiteral( "local" ) )
|
||||
{
|
||||
QVariantList l = configurationMap.value( "groups" ).toList();
|
||||
m_widget->loadGroupList( l );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_widget->loadGroupList( groupsUrl );
|
||||
}
|
||||
}
|
||||
|
||||
bool bogus = false;
|
||||
|
Loading…
Reference in New Issue
Block a user