Skip to content

Commit

Permalink
address comment, update (and vectorize) zip icon
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Oct 2, 2018
1 parent 29ac3f4 commit 5e1348b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion images/images.qrc
Expand Up @@ -483,7 +483,7 @@
<file>themes/default/mIconWcs.svg</file>
<file>themes/default/mIconWfs.svg</file>
<file>themes/default/mIconWms.svg</file>
<file>themes/default/mIconZip.png</file>
<file>themes/default/mIconZip.svg</file>
<file>themes/default/mIconZoom.svg</file>
<file>themes/default/mIndicatorFilter.svg</file>
<file>themes/default/mLayoutItem.svg</file>
Expand Down
Binary file removed images/themes/default/mIconZip.png
Binary file not shown.
1 change: 1 addition & 0 deletions images/themes/default/mIconZip.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions src/core/qgsdataitem.cpp
Expand Up @@ -111,8 +111,7 @@ QVariant QgsFavoritesItem::sortKey() const

QIcon QgsZipItem::iconZip()
{
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconZip.png" ) );
// icon from http://www.softicons.com/free-icons/application-icons/mega-pack-icons-1-by-nikolay-verin/winzip-folder-icon
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconZip.svg" ) );
}

QgsAnimatedIcon *QgsDataItem::sPopulatingIcon = nullptr;
Expand Down Expand Up @@ -802,14 +801,16 @@ QVector<QgsDataItem *> QgsDirectoryItem::createChildren()
QString path = dir.absoluteFilePath( name );
QFileInfo fileInfo( path );

if ( fileInfo.suffix() == QLatin1String( "qgs" ) || fileInfo.suffix() == QLatin1String( "qgz" ) )
if ( fileInfo.suffix().compare( QLatin1String( "qgs" ), Qt::CaseInsensitive ) == 0 ||
fileInfo.suffix().compare( QLatin1String( "qgz" ), Qt::CaseInsensitive ) == 0 )
{
QgsDataItem *item = new QgsProjectItem( this, fileInfo.completeBaseName(), path );
children.append( item );
continue;
}

if ( fileInfo.suffix() == QLatin1String( "zip" ) )
if ( fileInfo.suffix().compare( QLatin1String( "zip" ), Qt::CaseInsensitive ) == 0 ||
fileInfo.suffix().compare( QLatin1String( "tar" ), Qt::CaseInsensitive ) == 0 )
{
QgsDataItem *item = QgsZipItem::itemFromPath( this, path, name, mPath + '/' + name );
if ( item )
Expand Down Expand Up @@ -1280,12 +1281,12 @@ QgsZipItem::QgsZipItem( QgsDataItem *parent, const QString &name, const QString
void QgsZipItem::init()
{
mType = Collection; //Zip??
mIconName = QStringLiteral( "/mIconZip.png" );
mIconName = QStringLiteral( "/mIconZip.svg" );
mVsiPrefix = vsiPrefix( mFilePath );

if ( sProviderNames.isEmpty() )
{
sProviderNames << QStringLiteral( "OGR" ) << QStringLiteral( "OGR" );
sProviderNames << QStringLiteral( "OGR" ) << QStringLiteral( "GDAL" );
}
}

Expand Down Expand Up @@ -1408,13 +1409,12 @@ QgsDataItem *QgsZipItem::itemFromPath( QgsDataItem *parent, const QString &fileP
}

// only display if has children or if is not populated
if ( zipItem && ( !populated || zipItem->rowCount() > 1 ) )
if ( zipItem && ( !populated || zipItem->rowCount() > 0 ) )
{
QgsDebugMsgLevel( "returning zipItem", 3 );
return zipItem;
}

// if 1 or 0 child found, let provider(s) create individual items
return nullptr;
}

Expand Down
2 changes: 1 addition & 1 deletion src/providers/gdal/qgsgdaldataitems.h
Expand Up @@ -45,7 +45,7 @@ class QgsGdalDataItemProvider : public QgsDataItemProvider
public:
QString name() override { return QStringLiteral( "GDAL" ); }

int capabilities() override { return QgsDataProvider::File | QgsDataProvider::Dir; }
int capabilities() override { return QgsDataProvider::File | QgsDataProvider::Dir | QgsDataProvider::Net; }

QgsDataItem *createDataItem( const QString &pathIn, QgsDataItem *parentItem ) override;
};
Expand Down
2 changes: 1 addition & 1 deletion src/providers/ogr/qgsogrdataitems.h
Expand Up @@ -108,7 +108,7 @@ class QgsOgrDataItemProvider : public QgsDataItemProvider
public:
QString name() override { return QStringLiteral( "OGR" ); }

int capabilities() override { return QgsDataProvider::File | QgsDataProvider::Dir; }
int capabilities() override { return QgsDataProvider::File | QgsDataProvider::Dir | QgsDataProvider::Net; }

QgsDataItem *createDataItem( const QString &path, QgsDataItem *parentItem ) override;

Expand Down

0 comments on commit 5e1348b

Please sign in to comment.