17 #ifndef QGSCPTCITYARCHIVE_H
18 #define QGSCPTCITYARCHIVE_H
22 #include <QAbstractItemModel>
31 #define DEFAULT_CPTCITY_ARCHIVE "cpt-city-qgis-min"
37 QString baseDir = QString() );
41 QString baseDir()
const;
42 static QString baseDir( QString archiveName );
43 static QString defaultBaseDir();
44 void setBaseDir( QString dirName ) { mBaseDir = dirName; }
47 QString copyingFileName(
const QString& dirName )
const;
48 QString descFileName(
const QString& dirName )
const;
49 static QString findFileName(
const QString & target,
const QString & startDir,
const QString & baseDir );
50 static QMap< QString, QString > copyingInfo(
const QString& fileName );
51 static QMap< QString, QString > description(
const QString& fileName );
53 static QMap< double, QPair<QColor, QColor> > gradientColorMap(
const QString& fileName );
58 static void initArchives(
bool loadAll =
false );
59 static void initArchive( QString archiveName, QString archiveBaseDir );
60 static void initDefaultArchive();
61 static void clearArchives();
63 static QMap< QString, QgsCptCityArchive* > archiveRegistry();
66 QVector< QgsCptCityDataItem* >
rootItems()
const {
return mRootItems; }
67 QVector< QgsCptCityDataItem* >
selectionItems()
const {
return mSelectionItems; }
98 QString name, QString path );
105 virtual int leafCount()
const;
109 virtual void refresh();
112 virtual QVector<QgsCptCityDataItem*> createChildren();
115 virtual void populate();
134 virtual QList<QAction*>
actions() {
return QList<QAction*>(); }
140 virtual bool handleDrop(
const QMimeData * , Qt::DropAction ) {
return false; }
152 QVector<QgsCptCityDataItem*>
children()
const {
return mChildren; }
153 virtual QIcon
icon() {
return mIcon; }
154 virtual QIcon
icon(
const QSize&
size ) { Q_UNUSED( size ) ;
return icon(); }
155 QString
name()
const {
return mName; }
156 QString
path()
const {
return mPath; }
157 QString
info()
const {
return mInfo; }
183 void emitEndInsertItems();
185 void emitEndRemoveItems();
189 void endInsertItems();
191 void endRemoveItems();
200 QString name, QString path,
201 QString variantName = QString(),
202 bool initialize =
false );
204 QString name, QString path,
205 QStringList variantList,
206 bool initialize =
false );
216 QIcon
icon()
override;
217 QIcon
icon(
const QSize&
size )
override;
234 QString name, QString path );
239 QVector<QgsCptCityDataItem*> childrenRamps(
bool recursive );
251 QString name, QString path );
259 QString name, QString path );
262 QMap< QString, QStringList > rampsMap();
263 QStringList dirEntries()
const;
292 QVector<QgsCptCityDataItem*> items );
317 ViewType Type = Authors );
324 virtual Qt::ItemFlags flags(
const QModelIndex &
index )
const override;
330 virtual QVariant data(
const QModelIndex &
index,
int role = Qt::DisplayRole )
const override;
334 virtual QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
337 virtual int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
341 virtual int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
344 virtual QModelIndex
index(
int row,
int column,
const QModelIndex & parent = QModelIndex() )
const override;
351 virtual QModelIndex parent(
const QModelIndex &
index )
const override;
364 bool hasChildren(
const QModelIndex &parent = QModelIndex() )
const override;
370 void refresh( QString path );
373 void refresh(
const QModelIndex &
index = QModelIndex() );
376 QModelIndex findPath( QString path );
380 bool canFetchMore(
const QModelIndex & parent )
const override;
381 void fetchMore(
const QModelIndex & parent )
override;
391 void endInsertItems();
393 void endRemoveItems();
399 void removeRootItems();