26 #ifndef DIGIKAM_ABSTRACT_ALBUM_MODEL_H
27 #define DIGIKAM_ABSTRACT_ALBUM_MODEL_H
31 #include <QAbstractItemModel>
46 class AlbumModelDragDropHandler;
76 AlbumTitleRole = Qt::UserRole,
78 AlbumTypeRole = Qt::UserRole + 1,
80 AlbumPointerRole = Qt::UserRole + 2,
82 AlbumIdRole = Qt::UserRole + 3,
84 AlbumGlobalIdRole = Qt::UserRole + 4,
86 AlbumSortRole = Qt::UserRole + 5
97 Album*
const rootAlbum,
98 RootAlbumBehavior rootBehavior = IncludeRootAlbum,
99 QObject*
const parent =
nullptr);
115 Album* albumForIndex(
const QModelIndex& index)
const;
121 QModelIndex indexForAlbum(
Album* album)
const;
127 static Album* retrieveAlbum(
const QModelIndex& index);
129 Album* rootAlbum()
const;
134 QModelIndex rootAlbumIndex()
const;
139 RootAlbumBehavior rootAlbumBehavior()
const;
149 bool isFaceTagModel()
const;
151 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
152 QVariant headerData(
int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
153 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
154 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
155 Qt::ItemFlags flags(
const QModelIndex& index)
const override;
156 bool hasChildren(
const QModelIndex& parent = QModelIndex())
const override;
157 QModelIndex index(
int row,
int column,
const QModelIndex& parent = QModelIndex())
const override;
158 QModelIndex parent(
const QModelIndex& index)
const override;
160 Qt::DropActions supportedDropActions()
const override;
161 QStringList mimeTypes()
const override;
162 bool dropMimeData(
const QMimeData* data,
Qt::DropAction action,
int row,
int column,
const QModelIndex& parent)
override;
163 QMimeData* mimeData(
const QModelIndexList& indexes)
const override;
180 void setEnableDrag(
bool enable);
181 void setEnableDrop(
bool enable);
182 void setFaceTagModel(
bool enable);
189 virtual QVariant albumData(
Album* a,
int role)
const;
192 virtual QVariant decorationRoleData(
Album* a)
const;
195 virtual QVariant fontRoleData(
Album* a)
const;
198 virtual QVariant sortRoleData(
Album* a)
const;
201 virtual QString columnHeader()
const;
204 virtual Qt::ItemFlags itemFlags(
Album* album)
const;
210 virtual bool filterAlbum(
Album* album)
const;
220 void slotAlbumAboutToBeAdded(
Album* album,
Album* parent,
Album* prev);
221 void slotAlbumAdded(
Album*);
222 void slotAlbumAboutToBeDeleted(
Album* album);
223 void slotAlbumHasBeenDeleted(quintptr);
224 void slotAlbumsCleared();
225 void slotAlbumIconChanged(
Album* album);
226 void slotAlbumRenamed(
Album* album);
244 Album*
const rootAlbum,
246 QObject*
const parent =
nullptr);
250 QString columnHeader()
const override;
251 void setColumnHeader(
const QString& header);
254 void setupThumbnailLoading();
255 void emitDataChangedForChildren(
Album* album);
259 void slotGotThumbnailFromIcon(
Album* album,
const QPixmap& thumbnail);
260 void slotThumbnailLost(
Album* album);
261 void slotReloadThumbnails();
279 Album*
const rootAlbum,
281 QObject*
const parent =
nullptr);
284 bool showCount()
const;
291 virtual int albumCount(
Album* album)
const;
303 void setShowCount(
bool show);
310 void setCountMap(
const QMap<int, int>& idCountMap);
317 void excludeChildrenCount(
const QModelIndex& index);
323 void includeChildrenCount(
const QModelIndex& index);
328 void setCount(
Album* album,
int count);
334 virtual QString albumName(
Album* a)
const;
337 QVariant albumData(
Album* a,
int role)
const override;
338 void albumCleared(
Album* album)
override;
339 void allAlbumsCleared()
override;
343 void slotAlbumMoved(
Album* album);
347 void updateCount(
Album* album);
369 Album*
const rootAlbum,
371 QObject*
const parent =
nullptr);
375 void setCheckable(
bool isCheckable);
376 bool isCheckable()
const;
382 void setRootCheckable(
bool rootIsCheckable);
383 bool rootIsCheckable()
const;
391 void setTristate(
bool isTristate);
392 bool isTristate()
const;
400 void setAddExcludeTristate(
bool b);
401 bool isAddExcludeTristate()
const;
404 bool isChecked(
Album* album)
const;
407 Qt::CheckState checkState(
Album* album)
const;
418 void setChecked(
Album* album,
bool isChecked);
421 void setCheckState(
Album* album, Qt::CheckState state);
424 void toggleChecked(
Album* album);
427 void resetAllCheckedAlbums();
430 void resetCheckedAlbums(
const QModelIndex& parent = QModelIndex());
433 void resetCheckedParentAlbums(
const QModelIndex& child);
436 void checkAllAlbums(
const QModelIndex& parent = QModelIndex());
439 void checkAllParentAlbums(
const QModelIndex& child);
442 void invertCheckedAlbums(
const QModelIndex& parent = QModelIndex());
445 void setCheckStateForChildren(
Album* album, Qt::CheckState state);
448 void setCheckStateForParents(
Album* album, Qt::CheckState state);
463 void prepareAddExcludeDecoration(
Album* a, QPixmap& icon)
const;
465 QVariant albumData(
Album* a,
int role)
const override;
466 Qt::ItemFlags flags(
const QModelIndex& index)
const override;
467 bool setData(
const QModelIndex& index,
const QVariant&
value,
int role = Qt::EditRole)
override;
469 void albumCleared(
Album* album)
override;
470 void allAlbumsCleared()
override;
474 void setDataForParents(
const QModelIndex& child,
const QVariant&
value,
int role = Qt::EditRole);
475 void setDataForChildren(
const QModelIndex& parent,
const QVariant&
value,
int role = Qt::EditRole);
Definition: abstractalbummodel.h:49
virtual void albumCleared(Album *)
Notification when an entry is removed.
Definition: abstractalbummodel.h:213
RootAlbumBehavior
Definition: abstractalbummodel.h:60
@ IncludeRootAlbum
Definition: abstractalbummodel.h:65
void rootAlbumAvailable()
AlbumDataRole
Definition: abstractalbummodel.h:74
virtual void allAlbumsCleared()
Notification when all entries are removed.
Definition: abstractalbummodel.h:216
Definition: abstractalbummodel.h:358
void checkStateChanged(Album *album, Qt::CheckState checkState)
Definition: abstractalbummodel.h:271
virtual Album * albumForId(int id) const =0
need to implement in subclass
Definition: abstractalbummodel.h:237
QString m_columnHeader
Definition: abstractalbummodel.h:265
Definition: albummodeldragdrophandler.h:39
Abstract base class for all album types.
Definition: album.h:67
Type
Definition: album.h:71
qulonglong value
Definition: itemviewutilities.cpp:592
@ Orientation
Definition: coredbfields.h:86
@ Album
Definition: coredbfields.h:58
Definition: datefolderview.cpp:43
DropAction
Definition: itemdragdrop.cpp:60