** You should have received a copy of the GNU General Public License
** along with EmuFront. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include <QDir>
#include <QDebug>
#include <QProcess>
#include "mediaimagecontainer.h"
#include "mediatype.h"
#include "platform.h"
-#include "dbmediaimagecontainer.h"
+#include "mediaimagecontainermodel.h"
#include "unziphelper.h"
FileUtil::FileUtil(QObject *parent) : QObject(parent)
}
/* Throws EmuFrontException */
-int FileUtil::scanFilePath(FilePathObject *fp,
- QStringList filters, DbMediaImageContainer *dbMic,
- QProgressDialog *progressDialog)
+int FileUtil::scanFilePath(FilePathObject *fp, QStringList filters, QProgressDialog *progressDialog)
{
if (!fp->getSetup()){
throw EmuFrontException(tr("Setup not available with %1.").arg(fp->getName()));
.arg(fp->getSetup()->getName()));
}
+ MediaImageContainerModel micModel;
+
+ // Remove old instances scanned from this file path
+ micModel.removeFromFilePath(fp->getId());
+
int count = 0;
/*qDebug() << QString("We have a platform %1, media type %2")
.arg(fp->getSetup()->getPlatform()->getName())
if (containers.count() >= MIC_BUFFER_SIZE) {
//qDebug() << "We have " << containers.count() << " containers .. storing to db.";
showDbUpdating(progressDialog);
- dbMic->storeContainers(containers, fp);
+ micModel.storeContainers(containers, fp);
hideDbUpdating(progressDialog);
qDeleteAll(containers);
containers.clear();
//qDebug() << "Storing the rest " << containers.count() << " containers.";
//emit dbUpdateInProgress();
showDbUpdating(progressDialog);
- dbMic->storeContainers(containers, fp);
+ micModel.storeContainers(containers, fp);
hideDbUpdating(progressDialog);
//emit dbUpdateFinished();
qDeleteAll(containers);