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