--- /dev/null
+// EmuFront
+// Copyright 2010 Mikko Keinänen
+//
+// This file is part of EmuFront.
+//
+//
+// 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.
+//
+// Foobar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+
+#include <QSqlTableModel>
+#include "dbfilepath.h"
+#include "../dataobjects/filepathobject.h"
+
+DbFilePath::DbFilePath(QObject *parent) : DatabaseManager(parent)
+{
+}
+QSqlTableModel* DbFilePath::getDataModel()
+{
+ return sqlTableModel;
+}
+
+EmuFrontObject* DbFilePath::getDataObjectFromModel(QModelIndex *index)
+{
+ return new FilePathObject;
+}
+
+bool DbFilePath::updateDataObjectToModel(const EmuFrontObject *ob)
+{
+ return false;
+}
+
+bool DbFilePath::insertDataObjectToModel(const EmuFrontObject *ob)
+{
+ return false;
+}
+
+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)
+{
+ return false;
+}
+
+QSqlTableModel* DbFilePath::getData()
+{
+ QSqlTableModel *model = new QSqlTableModel(this);
+ return model;
+}
--- /dev/null
+// EmuFront
+// Copyright 2010 Mikko Keinänen
+//
+// This file is part of EmuFront.
+//
+//
+// 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.
+//
+// Foobar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef DBFILEPATH_H
+#define DBFILEPATH_H
+
+#include "databasemanager.h"
+
+class DbFilePath : public DatabaseManager
+{
+public:
+ DbFilePath(QObject *);
+ virtual QSqlTableModel* getDataModel();
+ virtual EmuFrontObject* getDataObjectFromModel(QModelIndex*);
+ virtual bool updateDataObjectToModel(const EmuFrontObject*);
+ bool insertDataObjectToModel(const EmuFrontObject*);
+ bool deleteDataObjectFromModel(QModelIndex*);
+ int countDataObjectRefs(int) const;
+
+private:
+ virtual QSqlTableModel* getData();
+ enum { FilePath_Id = 0,
+ FilePath_Name = 1,
+ FilePath_FileTypeId = 3,
+ FilePath_PlatformId = 4,
+ FilePath_MediaTypeId = 5,
+ FilePath_LastScanned = 6 };
+ static const QString DB_TABLE_NAME_FILEPATH;
+};
+
+#endif // DBFILEPATH_H
#include <QSqlTableModel>
#include <QDebug>
#include "dbmediatype.h"
+#include "../dataobjects/mediatype.h"
const QString DbMediaType::DB_TABLE_NAME_MEDIATYPE = QString("mediatype");
#define DBMEDIATYPE_H
#include "databasemanager.h"
-#include "../dataobjects/mediatype.h"
-
-class QModelIndex;
class DbMediaType : public DatabaseManager
{
#include "mediaimagepathmaindialog.h"
#include "mediaimagepathdialog.h"
#include "../dataobjects/filepathobject.h"
-#include "../db/dbmediaimagepath.h"
+#include "../db/dbfilepath.h"
MediaImagePathMainDialog::MediaImagePathMainDialog(QWidget *parent)
{
setWindowTitle(tr("Set media image paths"));
nameDialog = new MediaImagePathDialog(this, dynamic_cast<FilePathObject*>(dbObject));
- dbManager = new DbMediaImagePath(this);
+ dbManager = new DbFilePath(this);
initDataTable();
// do not move to parent class:
connectSignals();
dialogs/mediaimagepathdialog.h \
dialogs/mediaimagepathmaindialog.h \
dialogs/dataobjecteditdialog.h \
- db/dbmediaimagepath.h
+ db/dbfilepath.h
SOURCES += main.cpp \
mainwindow.cpp \
db/databasemanager.cpp \
dialogs/mediaimagepathdialog.cpp \
dialogs/mediaimagepathmaindialog.cpp \
dialogs/dataobjecteditdialog.cpp \
- db/dbmediaimagepath.cpp
+ db/dbfilepath.cpp
void MainWindow::configureMediaImagePaths()
{
- /*if (!mediaImagePathDialog)
+ if (!mediaImagePathDialog)
{
mediaImagePathDialog = new MediaImagePathMainDialog(this);
}
activateDialog(mediaImagePathDialog);
- */
}
void MainWindow::activateDialog(EmuFrontDialog* dia) const