17 #ifndef QGSCPTCITYARCHIVE_H
18 #define QGSCPTCITYARCHIVE_H
20 #include "qgis_core.h"
25 #include <QAbstractItemModel>
34 #define DEFAULT_CPTCITY_ARCHIVE "cpt-city-qgis-min"
44 const QString &baseDir = QString() );
53 QString baseDir()
const;
54 static QString baseDir( QString archiveName );
55 static QString defaultBaseDir();
56 void setBaseDir(
const QString &dirName ) { mBaseDir = dirName; }
59 QString copyingFileName(
const QString &dirName )
const;
60 QString descFileName(
const QString &dirName )
const;
61 static QString findFileName(
const QString &target,
const QString &startDir,
const QString &baseDir );
62 static QMap< QString, QString > copyingInfo(
const QString &fileName );
63 static QMap< QString, QString > description(
const QString &fileName );
65 static QMap< double, QPair<QColor, QColor> > gradientColorMap(
const QString &fileName )
SIP_SKIP;
70 static void initArchives(
bool loadAll =
false );
71 static void initArchive(
const QString &archiveName,
const QString &archiveBaseDir );
72 static void initDefaultArchive();
73 static void clearArchives();
75 static QMap< QString, QgsCptCityArchive * > archiveRegistry();
78 QVector< QgsCptCityDataItem * >
rootItems()
const {
return mRootItems; }
79 QVector< QgsCptCityDataItem * >
selectionItems()
const {
return mSelectionItems; }
86 QVector< QgsCptCityDataItem * > mRootItems;
87 QVector<QgsCptCityDataItem *> mSelectionItems;
114 const QString &name,
const QString &path );
120 virtual int leafCount()
const;
124 virtual void refresh();
127 virtual QVector<QgsCptCityDataItem *> createChildren();
130 virtual void populate();
149 virtual QList<QAction *>
actions() {
return QList<QAction *>(); }
155 virtual bool handleDrop(
const QMimeData * , Qt::DropAction ) {
return false; }
167 QVector<QgsCptCityDataItem *>
children()
const {
return mChildren; }
168 virtual QIcon
icon() {
return mIcon; }
169 virtual QIcon
icon( QSize size ) { Q_UNUSED( size )
return icon(); }
170 QString
name()
const {
return mName; }
171 QString
path()
const {
return mPath; }
172 QString
info()
const {
return mInfo; }
175 void setIcon(
const QIcon &icon ) { mIcon = icon; }
212 const QString &name,
const QString &path,
213 const QString &variantName = QString(),
214 bool initialize =
false );
216 const QString &name,
const QString &path,
217 const QStringList &variantList,
218 bool initialize =
false );
227 QIcon
icon()
override;
228 QIcon
icon( QSize size )
override;
248 const QString &name,
const QString &path );
253 QVector<QgsCptCityDataItem *> childrenRamps(
bool recursive );
268 const QString &name,
const QString &path );
275 const QString &name,
const QString &path );
278 QMap< QString, QStringList > rampsMap();
279 QStringList dirEntries()
const;
314 const QVector<QgsCptCityDataItem *> &items );
341 ViewType Type = Authors );
345 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
346 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
347 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
348 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
349 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
350 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
354 QModelIndex parent(
const QModelIndex &index )
const override;
367 bool hasChildren(
const QModelIndex &parent = QModelIndex() )
const override;
373 void refresh(
const QString &path );
376 void refresh(
const QModelIndex &index = QModelIndex() );
379 QModelIndex findPath(
const QString &path );
383 bool canFetchMore(
const QModelIndex &parent )
const override;
384 void fetchMore(
const QModelIndex &parent )
override;
394 void endInsertItems();
396 void endRemoveItems();
402 void removeRootItems();