File indexing completed on 2025-01-19 03:53:44

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-07-13
0007  * Description : Model for item versions
0008  *
0009  * SPDX-FileCopyrightText: 2010 by Martin Klapetek <martin dot klapetek at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_ITEM_VERSIONS_MODEL_H
0016 #define DIGIKAM_ITEM_VERSIONS_MODEL_H
0017 
0018 // Qt includes
0019 
0020 #include <QModelIndex>
0021 #include <QPixmap>
0022 
0023 // Local includes
0024 
0025 #include "digikam_export.h"
0026 
0027 namespace Digikam
0028 {
0029 
0030 class DIGIKAM_DATABASE_EXPORT ItemVersionsModel : public QAbstractListModel
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035 
0036     explicit ItemVersionsModel(QObject* const parent = nullptr);
0037     ~ItemVersionsModel()                                                           override;
0038 
0039     Qt::ItemFlags flags(const QModelIndex& index)                            const override;
0040     QVariant      data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
0041     int           rowCount(const QModelIndex& parent = QModelIndex())        const override;
0042 
0043     void setupModelData(QList<QPair<QString, int> >& data);
0044     void clearModelData();
0045 
0046     QString     currentSelectedImage()                                       const;
0047     void        setCurrentSelectedImage(const QString& path);
0048     QModelIndex currentSelectedImageIndex()                                  const;
0049 
0050     bool paintTree()                                                         const;
0051     int  listIndexOf(const QString& item)                                    const;
0052 
0053 public Q_SLOTS:
0054 
0055     void slotAnimationStep();
0056     void setPaintTree(bool paint);
0057 
0058 private:
0059 
0060     class Private;
0061     Private* const d;
0062 };
0063 
0064 } // namespace Digikam
0065 
0066 #endif // DIGIKAM_ITEM_VERSIONS_MODEL_H