17 #ifndef QGSCPTCITYARCHIVE_H
18 #define QGSCPTCITYARCHIVE_H
20 #include "qgis_core.h"
25 #include <QAbstractItemModel>
33 #define DEFAULT_CPTCITY_ARCHIVE "cpt-city-qgis-min"
43 const QString &baseDir = QString() );
52 QString baseDir()
const;
53 static QString baseDir( QString archiveName );
54 static QString defaultBaseDir();
55 void setBaseDir(
const QString &dirName ) { mBaseDir = dirName; }
58 QString copyingFileName(
const QString &dirName )
const;
59 QString descFileName(
const QString &dirName )
const;
60 static QString findFileName(
const QString &target,
const QString &startDir,
const QString &baseDir );
61 static QMap< QString, QString > copyingInfo(
const QString &fileName );
62 static QMap< QString, QString > description(
const QString &fileName );
64 static QMap< double, QPair<QColor, QColor> > gradientColorMap(
const QString &fileName )
SIP_SKIP;
69 static void initArchives(
bool loadAll =
false );
70 static void initArchive(
const QString &archiveName,
const QString &archiveBaseDir );
71 static void initDefaultArchive();
72 static void clearArchives();
74 static QMap< QString, QgsCptCityArchive * > archiveRegistry();
77 QVector< QgsCptCityDataItem * >
rootItems()
const {
return mRootItems; }
78 QVector< QgsCptCityDataItem * >
selectionItems()
const {
return mSelectionItems; }
85 QVector< QgsCptCityDataItem * > mRootItems;
86 QVector<QgsCptCityDataItem *> mSelectionItems;
113 const QString &name,
const QString &path );
119 virtual int leafCount()
const;
123 virtual void refresh();
126 virtual QVector<QgsCptCityDataItem *> createChildren();
129 virtual void populate();
151 virtual bool handleDrop(
const QMimeData * , Qt::DropAction ) {
return false; }
163 QVector<QgsCptCityDataItem *>
children()
const {
return mChildren; }
164 virtual QIcon
icon() {
return mIcon; }
165 virtual QIcon
icon( QSize size ) { Q_UNUSED( size )
return icon(); }
166 QString
name()
const {
return mName; }
167 QString
path()
const {
return mPath; }
168 QString
info()
const {
return mInfo; }
171 void setIcon(
const QIcon &icon ) { mIcon = icon; }
194 void endInsertItems();
196 void endRemoveItems();
208 const QString &name,
const QString &path,
209 const QString &variantName = QString(),
210 bool initialize =
false );
212 const QString &name,
const QString &path,
213 const QStringList &variantList,
214 bool initialize =
false );
223 QIcon
icon()
override;
224 QIcon
icon( QSize size )
override;
244 const QString &name,
const QString &path );
249 QVector<QgsCptCityDataItem *> childrenRamps(
bool recursive );
264 const QString &name,
const QString &path );
271 const QString &name,
const QString &path );
274 QMap< QString, QStringList > rampsMap();
275 QStringList dirEntries()
const;
310 const QVector<QgsCptCityDataItem *> &items );
337 ViewType Type = Authors );
341 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
342 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
343 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
344 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
345 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
346 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
350 QModelIndex parent(
const QModelIndex &index )
const override;
363 bool hasChildren(
const QModelIndex &parent = QModelIndex() )
const override;
369 void refresh(
const QString &path );
372 void refresh(
const QModelIndex &index = QModelIndex() );
375 QModelIndex findPath(
const QString &path );
379 bool canFetchMore(
const QModelIndex &parent )
const override;
380 void fetchMore(
const QModelIndex &parent )
override;
390 void endInsertItems();
392 void endRemoveItems();
398 void removeRootItems();