File indexing completed on 2024-06-23 05:33:15
0001 #ifndef IMAGECONTROLLER_H 0002 #define IMAGECONTROLLER_H 0003 0004 #include "charactersheet/imagemodel.h" 0005 #include <QObject> 0006 #include <QString> 0007 #include <memory> 0008 0009 class QTableView; 0010 class QAction; 0011 class RolisteamImageProvider; 0012 class ImageController : public QObject 0013 { 0014 Q_OBJECT 0015 Q_PROPERTY(charactersheet::ImageModel* model READ model NOTIFY modelChanged) 0016 Q_PROPERTY(QString uuid READ uuid WRITE setUuid NOTIFY uuidChanged) 0017 public: 0018 ImageController(QObject* parent= nullptr); 0019 0020 void clearData(); 0021 0022 QString uuid() const; 0023 charactersheet::ImageModel* model() const; 0024 QSize backgroundSize() const; 0025 0026 RolisteamImageProvider* provider() const; 0027 0028 public slots: 0029 void addBackgroundImage(int idx, const QPixmap& pix, const QString& filename, const QString& uuid); 0030 void addImage(const QPixmap& pix, const QString& filename); 0031 void removeImage(int idx); 0032 void setUuid(const QString& uuid); 0033 void copyPath(const QModelIndex& index); 0034 void copyUrl(const QModelIndex& index); 0035 void replaceImage(const QModelIndex& index, const QString& filepath); 0036 void reloadImage(const QModelIndex& index); 0037 0038 signals: 0039 void dataChanged(); 0040 void uuidChanged(); 0041 void modelChanged(); 0042 void errorOccurs(QString); 0043 0044 private: 0045 std::unique_ptr<charactersheet::ImageModel> m_model; 0046 QString m_uuid; 0047 }; 0048 0049 #endif