[netinstall] Build up a list of urls, rather than just one

- the list is unused, and doesn't drive the loading of groups either;
  the existing one-string entry is used.
main
Adriaan de Groot 4 years ago
parent ca1ae6fd1d
commit 04f4441182

@ -170,6 +170,19 @@ Config::receivedGroupData()
} }
} }
Config::SourceItem Config::SourceItem::makeSourceItem(const QVariantMap& configurationMap, const QString& groupsUrl)
{
if ( groupsUrl == QStringLiteral( "local" ) )
{
return SourceItem{ QUrl(), configurationMap.value( "groups" ).toList() };
}
else
{
return SourceItem{ QUrl{ groupsUrl }, QVariantList() };
}
}
void void
Config::setConfigurationMap( const QVariantMap& configurationMap ) Config::setConfigurationMap( const QVariantMap& configurationMap )
{ {
@ -193,6 +206,20 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
} }
// Lastly, load the groups data // Lastly, load the groups data
const QString key = QStringLiteral( "groupsUrl" );
const auto& groupsUrlVariant = configurationMap.value( key );
if ( groupsUrlVariant.type() == QVariant::String )
{
m_urls.append( SourceItem::makeSourceItem( configurationMap, groupsUrlVariant.toString() ) );
}
else if ( groupsUrlVariant.type() == QVariant::StringList )
{
for ( const auto& s : groupsUrlVariant.toStringList() )
{
m_urls.append( SourceItem::makeSourceItem( configurationMap, s ) );
}
}
QString groupsUrl = CalamaresUtils::getString( configurationMap, "groupsUrl" ); QString groupsUrl = CalamaresUtils::getString( configurationMap, "groupsUrl" );
if ( !groupsUrl.isEmpty() ) if ( !groupsUrl.isEmpty() )
{ {

@ -18,6 +18,7 @@
#include <QObject> #include <QObject>
#include <QUrl> #include <QUrl>
#include <QQueue>
#include <QVariantMap> #include <QVariantMap>
class QNetworkReply; class QNetworkReply;
@ -85,6 +86,23 @@ private slots:
void retranslate(); void retranslate();
private: private:
/** @brief Data about an entry in *groupsUrl*
*
* This can be a specific URL, or "local" which uses data stored
* in the configuration file itself.
*/
struct SourceItem
{
QUrl url;
QVariantList data;
bool isUrl() const { return url.isValid(); }
bool isLocal() const { return !data.isEmpty(); }
bool isValid() const { return isUrl() || isLocal(); }
static SourceItem makeSourceItem( const QVariantMap& configurationMap, const QString& groupsUrl);
};
QQueue< SourceItem > m_urls;
CalamaresUtils::Locale::TranslatedString* m_sidebarLabel = nullptr; // As it appears in the sidebar CalamaresUtils::Locale::TranslatedString* m_sidebarLabel = nullptr; // As it appears in the sidebar
CalamaresUtils::Locale::TranslatedString* m_titleLabel = nullptr; CalamaresUtils::Locale::TranslatedString* m_titleLabel = nullptr;
PackageModel* m_model = nullptr; PackageModel* m_model = nullptr;

Loading…
Cancel
Save