//
//
// EmuFront is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
+// it under the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation and appearing in the file gpl.txt included in the
+// packaging of this file.
//
// EmuFront is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "dbfilepath.h"
#include "dbsetup.h"
+
DbFilePath::DbFilePath(QObject *parent) : DbQueryModelManager(parent)
{
+ tableName = DbFilePath::DB_TABLE_NAME_FILEPATH;
dbSetup = new DbSetup(this);
}
return id;
}
-int DbFilePath::countDataObjectRefs(int id) const
-{
- return 0;
-}
-
// WARNING: this will delete also all the databindings to selected media image path
bool DbFilePath::deleteDataObjectFromModel(QModelIndex *index)
{
QString DbFilePath::constructSelect(QString where) const
{
- /*QString where = whereClause.isEmpty()
- ? "" : QString("WHERE ").append(whereClause);*/
-
return QString("SELECT filepath.id AS FilePathId, "
"filepath.name AS Name, "
"filepath.lastscanned AS LastScanned, "
QSqlQueryModel* DbFilePath::getData()
{
- QSqlQueryModel *model = new QSqlQueryModel;
+ QSqlQueryModel *model = new QSqlQueryModel(this);
model->setQuery(constructSelect());
model->setHeaderData(FilePath_Id, Qt::Horizontal, tr("Id"));
model->setHeaderData(FilePath_Name, Qt::Horizontal, tr("Name"));
model->setHeaderData(FilePath_SetupName, Qt::Horizontal, tr("Set up"));
return model;
}
+
+QString DbFilePath::getCountRefsSelect(int id) const
+{
+ /* filepath is referenced from mediaimagecontainer */
+ return QString("SELECT count(*) FROM filepath"
+ "INNER JOIN mediaimagecontainer "
+ "ON filepath.id=mediaimagecontainer.filepathid"
+ "WHERE filepath.id=%1").arg(id);
+}