Refresh model after update on data (TODO: maybe a common model
[emufront] / src / models / mediaimagecontainermodel.h
index cda6504..6aa80e3 100644 (file)
 #ifndef MEDIAIMAGECONTAINERMODEL_H
 #define MEDIAIMAGECONTAINERMODEL_H
 
-#include "emufrontquerymodel.h"
+#include "filemodel.h"
 
-class MediaImageContainerModel : public EmuFrontQueryModel
+class MediaImage;
+class MediaImageContainer;
+class FilePathObject;
+
+class MediaImageContainerModel : public FileModel
 {
     Q_OBJECT
 public:
     MediaImageContainerModel(QObject *parent = 0);
     void filterBySetup(int setupId);
+    void storeContainers(QList<MediaImageContainer*>, FilePathObject*);
+    bool removeFromFilePath(int filePathId) const;
     enum {
         MIC_FileId,
         MIC_FileName,
@@ -43,13 +49,18 @@ public:
         MIC_MediaTypeId,
         MIC_MediaTypeName
     };
+    virtual void refresh();
 
 protected:
-    virtual void refresh();
     virtual QString constructSelect(QString where = "") const;
     // Implemented for EmuFrontQueryModel:
     virtual EmuFrontObject* recordToDataObject(const QSqlRecord* );
     virtual QString constructFilterById(int id) const;
+private:
+    int storeMediaImageContainer(EmuFrontObject *efo);
+    void linkMediaImagesWithContainer(int, QList<EmuFrontObject*>);
+    bool linkMediaImageContainerToPath(const MediaImageContainer*) const;
+    bool linkMediaImageToMediaImageContainer(const MediaImage*, int micId) const;
 };
 
 #endif // MEDIAIMAGECONTAINERMODEL_H