Skip to content
Permalink
Browse files

address comment, update (and vectorize) zip icon

  • Loading branch information
nirvn committed Oct 2, 2018
1 parent 29ac3f4 commit 5e1348bbdcb4f091cdb2dc5f6d30fded8f6d5b8e
@@ -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>
Binary file not shown.
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#eeeeec" stroke="#888a85" d="M1.5 1.5h13v13h-13z"/><path d="M5 2v4c0 1.1.895 2 2 2s2-.9 2-2V2z" fill="#888a85"/><path d="M7 2v1h1V2zm0 1H6v1h1zm0 1v1h1V4zm0 1H6v1h1zm0 1v1c.552 0 1-.5 1-1z" fill="#2b3b4d"/><path d="M6 2v1h1V2zm0 2v1h1V4zm0 2c0 .5.448 1 1 1V6z" fill="#ddd"/><path d="M7 3h1v1H7zm0 2h1v1H7z" fill="#b3b3b3"/><path d="M7 7c-1.105 0-2 .9-2 2v4c0 1.1.895 2 2 2s2-.9 2-2V9c0-1.1-.895-2-2-2zm0 1c.552 0 1 .4 1 1 0 .5-.448 1-1 1s-1-.5-1-1c0-.6.448-1 1-1zm0 3c.552 0 1 .4 1 1v1c0 .5-.448 1-1 1s-1-.5-1-1v-1c0-.6.448-1 1-1zM6 1h1v1H6z" fill="#2b3b4d"/><path fill="#b3b3b3" d="M7 1h1v1H7z"/></svg>
@@ -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;
@@ -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 )
@@ -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" );
}
}

@@ -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;
}

@@ -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;
};
@@ -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;

0 comments on commit 5e1348b

Please sign in to comment.
You can’t perform that action at this time.