| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #ifndef PICTUREMODEL_H
- #define PICTUREMODEL_H
- #include <QAbstractListModel>
- #include "Picture.h"
- #include "gallery-core_global.h"
- class Album;
- class DatabaseManager;
- class AlbumModel;
- class GALLERYCORE_EXPORT PictureModel : public QAbstractListModel {
- Q_OBJECT
- public:
- enum PictureRole {
- FilePathRole = Qt::UserRole + 1,
- };
- explicit PictureModel(const AlbumModel& albumModel, QObject* parent = 0);
- QModelIndex addPicture(const Picture& picture);
- // QAbstractItemModel interface
- int rowCount(const QModelIndex& parent) const override;
- QVariant data(const QModelIndex& index, int role) const override;
- bool removeRows(int row, int count, const QModelIndex& parent) override;
- void setAlbumId(int albumId);
- void clearAlbum();
- public slots:
- void deletePcituresForAlbum();
- private:
- void loadPictures(int albumId);
- bool isIndexValid(const QModelIndex& index) const;
- private:
- DatabaseManager& mDb;
- int mAlbumId;
- std::unique_ptr<std::vector<std::unique_ptr<Picture>>> mPictures;
- };
- #endif // PICTUREMODEL_H
|