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; }
118 const QString &name,
const QString &path );
124 virtual int leafCount()
const;
128 virtual void refresh();
131 virtual QVector<QgsCptCityDataItem *> createChildren();
134 virtual void populate();
153 virtual QList<QAction *>
actions() {
return QList<QAction *>(); }
159 virtual bool handleDrop(
const QMimeData * , Qt::DropAction ) {
return false; }
171 QVector<QgsCptCityDataItem *>
children()
const {
return mChildren; }
172 virtual QIcon
icon() {
return mIcon; }
173 virtual QIcon
icon( QSize size ) { Q_UNUSED( size ) ;
return icon(); }
174 QString
name()
const {
return mName; }
175 QString
path()
const {
return mPath; }
176 QString
info()
const {
return mInfo; }
179 void setIcon(
const QIcon &icon ) { mIcon = icon; }
202 void endInsertItems();
204 void endRemoveItems();
216 const QString &name,
const QString &path,
217 const QString &variantName = QString(),
218 bool initialize =
false );
220 const QString &name,
const QString &path,
221 const QStringList &variantList,
222 bool initialize =
false );
231 QIcon
icon()
override;
232 QIcon
icon( QSize size )
override;
252 const QString &name,
const QString &path );
257 QVector<QgsCptCityDataItem *> childrenRamps(
bool recursive );
272 const QString &name,
const QString &path );
279 const QString &name,
const QString &path );
282 QMap< QString, QStringList > rampsMap();
283 QStringList dirEntries()
const;
317 const QVector<QgsCptCityDataItem *> &items );
348 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
349 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
350 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
351 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
352 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
353 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
357 QModelIndex parent(
const QModelIndex &index )
const override;
370 bool hasChildren(
const QModelIndex &parent = QModelIndex() )
const override;
376 void refresh(
const QString &path );
379 void refresh(
const QModelIndex &index = QModelIndex() );
382 QModelIndex findPath(
const QString &path );
386 bool canFetchMore(
const QModelIndex &parent )
const override;
387 void fetchMore(
const QModelIndex &parent )
override;
397 void endInsertItems();
399 void endRemoveItems();
405 void removeRootItems();
QStringList selectionsList() const
virtual QList< QAction * > actions()
An "All ramps item", which contains all items in a flat hierarchy.
QVector< QgsCptCityDataItem * > mItems
static QgsCptCityArchive * defaultArchive()
QgsCptCityColorRamp mRamp
Item that represents a layer that can be opened with one of the providers.
QMap< QString, QStringList > mRampsMap
static QMap< QString, QMap< QString, QString > > sCopyingInfoMap
virtual QVector< QgsCptCityDataItem * > createChildren()
QVector< QgsCptCityDataItem * > children() const
void setIcon(const QIcon &icon)
const QgsCptCityColorRamp & ramp() const
virtual bool handleDrop(const QMimeData *, Qt::DropAction)
virtual bool equal(const QgsCptCityDataItem *other)
QVector< QgsCptCityDataItem *> rootItems() const
virtual bool acceptDrop()
A directory: contains subdirectories and color ramps.
int leafCount() const override
void setToolTip(const QString &msg)
Base class for all items in the model.
A Collection: logical collection of subcollections and color ramps.
QString shortInfo() const
QString archiveName() const
#define DEFAULT_CPTCITY_ARCHIVE
QVector< QgsCptCityDataItem * > mSelectionItems
QStringList mSelectionsList
void addChild(QgsCptCityDataItem *item)
void setParent(QgsCptCityDataItem *parent)
static QMap< QString, QgsCptCityArchive *> sArchiveRegistry
virtual QWidget * paramWidget()
virtual QIcon icon(QSize size)
void setBaseDir(const QString &dirName)
A selection: contains subdirectories and color ramps.
QgsCptCityDataItem * parent() const
QVector< QgsCptCityDataItem *> mRootItems
QVector< QgsCptCityDataItem * > mRootItems
QVector< QgsCptCityDataItem *> selectionItems() const
QVector< QgsCptCityDataItem * > mChildren
static QString sDefaultArchiveName