fixed style issues
This commit is contained in:
parent
a4aef3bce5
commit
f5fe887a79
@ -103,14 +103,14 @@ void NetInstallPage::loadGroupList()
|
||||
QNetworkRequest request;
|
||||
request.setUrl( QUrl( confUrl ) );
|
||||
// Follows all redirects except unsafe ones (https to http).
|
||||
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||
request.setAttribute( QNetworkRequest::FollowRedirectsAttribute, true );
|
||||
// Not everybody likes the default User Agent used by this class (looking at you,
|
||||
// sourceforge.net), so let's set a more descriptive one.
|
||||
request.setRawHeader( "User-Agent", "Mozilla/5.0 (compatible; Calamares)" );
|
||||
|
||||
connect(&m_networkManager, &QNetworkAccessManager::finished,
|
||||
this, &NetInstallPage::dataIsHere);
|
||||
m_networkManager.get(request);
|
||||
connect( &m_networkManager, &QNetworkAccessManager::finished,
|
||||
this, &NetInstallPage::dataIsHere );
|
||||
m_networkManager.get( request );
|
||||
}
|
||||
|
||||
void NetInstallPage::onActivate()
|
||||
|
@ -126,8 +126,8 @@ NetInstallViewStep::onLeave()
|
||||
<< "to global storage";
|
||||
|
||||
QMap<QString, QVariant> packagesWithOperation;
|
||||
QList<QVariant> installPackages = m_widget->selectedPackages(true);
|
||||
QList<QVariant> tryInstallPackages = m_widget->selectedPackages(false);
|
||||
QList<QVariant> installPackages = m_widget->selectedPackages( true );
|
||||
QList<QVariant> tryInstallPackages = m_widget->selectedPackages( false );
|
||||
|
||||
if ( !installPackages.empty() )
|
||||
packagesWithOperation.insert( "install", installPackages );
|
||||
|
@ -41,7 +41,7 @@ PackageModel::~PackageModel()
|
||||
QModelIndex
|
||||
PackageModel::index( int row, int column, const QModelIndex& parent ) const
|
||||
{
|
||||
if ( !hasIndex(row, column, parent ) )
|
||||
if ( !hasIndex( row, column, parent ) )
|
||||
return QModelIndex();
|
||||
|
||||
PackageTreeItem* parentItem;
|
||||
@ -99,14 +99,10 @@ QVariant
|
||||
PackageModel::data( const QModelIndex& index, int role ) const
|
||||
{
|
||||
if ( !index.isValid() )
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
PackageTreeItem* item = static_cast<PackageTreeItem*>( index.internalPointer() );
|
||||
if ( index.column() == 0 && role == Qt::CheckStateRole )
|
||||
{
|
||||
return item->isSelected();
|
||||
}
|
||||
|
||||
if ( !item->childCount() ) // package
|
||||
{
|
||||
@ -120,9 +116,7 @@ PackageModel::data( const QModelIndex& index, int role ) const
|
||||
}
|
||||
|
||||
if ( item->isHidden() && role == Qt::DisplayRole ) // Hidden group
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
switch ( role )
|
||||
{
|
||||
@ -147,7 +141,7 @@ PackageModel::setData( const QModelIndex& index, const QVariant& value, int role
|
||||
PackageTreeItem* item = static_cast<PackageTreeItem*>( index.internalPointer() );
|
||||
item->setSelected( static_cast<Qt::CheckState>( value.toInt() ) );
|
||||
|
||||
emit dataChanged( this->index(0, 0), index.sibling( index.column(), index.row() + 1 ),
|
||||
emit dataChanged( this->index( 0, 0 ), index.sibling( index.column(), index.row() + 1 ),
|
||||
QVector<int>( Qt::CheckStateRole ) );
|
||||
}
|
||||
return true;
|
||||
@ -230,7 +224,7 @@ PackageModel::setupModelData( const YAML::Node& data, PackageTreeItem* parent )
|
||||
if ( itemDefinition["post-install"] )
|
||||
itemData.postScript =
|
||||
CalamaresUtils::yamlToVariant( itemDefinition["post-install"] ).toString();
|
||||
PackageTreeItem* item = new PackageTreeItem(itemData, parent );
|
||||
PackageTreeItem* item = new PackageTreeItem( itemData, parent );
|
||||
|
||||
if ( itemDefinition["selected"] )
|
||||
item->setSelected(
|
||||
|
@ -34,14 +34,14 @@ class PackageModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit PackageModel( const YAML::Node& data, const QVariantList& columnHeadings,
|
||||
QObject* parent = 0 );
|
||||
~PackageModel();
|
||||
|
||||
QVariant data( const QModelIndex& index, int role ) const Q_DECL_OVERRIDE;
|
||||
bool setData( const QModelIndex& index, const QVariant& value,
|
||||
int role = Qt::EditRole) Q_DECL_OVERRIDE;
|
||||
int role = Qt::EditRole ) Q_DECL_OVERRIDE;
|
||||
Qt::ItemFlags flags( const QModelIndex& index ) const Q_DECL_OVERRIDE;
|
||||
QVariant headerData( int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole ) const Q_DECL_OVERRIDE;
|
||||
@ -53,7 +53,7 @@ class PackageModel : public QAbstractItemModel
|
||||
QList<QVariant> getPackages( bool isCritical ) const;
|
||||
QList<PackageTreeItem*> getItemPackages( PackageTreeItem* item, bool isCritical ) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
void setupModelData( const YAML::Node& data, PackageTreeItem* parent );
|
||||
|
||||
PackageTreeItem* m_rootItem;
|
||||
|
@ -81,7 +81,7 @@ PackageTreeItem::data( int column ) const
|
||||
return QVariant( packageName() );
|
||||
return QVariant();
|
||||
}
|
||||
switch( column ) // group
|
||||
switch ( column ) // group
|
||||
{
|
||||
case 0:
|
||||
return QVariant( prettyName() );
|
||||
@ -175,7 +175,7 @@ PackageTreeItem::setSelected( Qt::CheckState isSelected )
|
||||
if ( currentItem->child( i )->isSelected() == Qt::PartiallyChecked )
|
||||
isChildPartiallySelected = true;
|
||||
}
|
||||
if ( !childrenSelected && !isChildPartiallySelected)
|
||||
if ( !childrenSelected && !isChildPartiallySelected )
|
||||
currentItem->m_selected = Qt::Unchecked;
|
||||
else if ( childrenSelected == currentItem->childCount() )
|
||||
currentItem->m_selected = Qt::Checked;
|
||||
|
@ -27,8 +27,9 @@
|
||||
|
||||
class PackageTreeItem : public QStandardItem
|
||||
{
|
||||
public:
|
||||
struct ItemData {
|
||||
public:
|
||||
struct ItemData
|
||||
{
|
||||
QString name;
|
||||
QString description;
|
||||
QString preScript;
|
||||
@ -52,9 +53,9 @@ class PackageTreeItem : public QStandardItem
|
||||
QString packageName() const;
|
||||
QString postScript() const;
|
||||
bool isHidden() const;
|
||||
void setHidden( bool isHidden);
|
||||
void setHidden( bool isHidden );
|
||||
bool isCritical() const;
|
||||
void setCritical( bool isCritical);
|
||||
void setCritical( bool isCritical );
|
||||
Qt::CheckState isSelected() const;
|
||||
void setSelected( Qt::CheckState isSelected );
|
||||
void setChildrenSelected( Qt::CheckState isSelected );
|
||||
@ -63,7 +64,7 @@ class PackageTreeItem : public QStandardItem
|
||||
static const int PreScriptRole = Qt::UserRole;
|
||||
static const int PackageNameRole = Qt::UserRole + 1;
|
||||
static const int PostScriptRole = Qt::UserRole + 2;
|
||||
private:
|
||||
private:
|
||||
QList<PackageTreeItem*> m_childItems;
|
||||
ItemData m_data;
|
||||
QString m_packageName;
|
||||
|
Loading…
Reference in New Issue
Block a user