Refactoring the project, new folders for view and model classes. Added
authorMikko Keinänen <mikko.keinanen@gmail.com>
Sat, 4 Dec 2010 23:46:34 +0000 (01:46 +0200)
committerMikko Keinänen <mikko.keinanen@gmail.com>
Sat, 4 Dec 2010 23:46:34 +0000 (01:46 +0200)
all the source folders to project file.

65 files changed:
doc/views.dia [new file with mode: 0644]
src/db/databasemanager.h
src/db/dbcreator.cpp
src/db/dbemufrontfileobject.h
src/db/dbexecutable.cpp
src/db/dbfile.h
src/db/dbfilepath.cpp
src/db/dbmediaimage.h
src/db/dbmediaimagecontainer.h
src/db/dbmediatype.h
src/db/dbplatform.h
src/db/dbsetup.h
src/dialogs/dataobjecteditdialog.h
src/dialogs/dbobjectdialog.cpp
src/dialogs/dbobjectdialog.h
src/dialogs/emufrontdialog.h
src/dialogs/emufrontfileobjectdialog.cpp
src/dialogs/emufrontinputdialog.cpp
src/dialogs/executableeditdialog.cpp
src/dialogs/executablemaindialog.cpp
src/dialogs/listdialog.cpp
src/dialogs/mediaimagepathdialog.cpp
src/dialogs/mediaimagepathmaindialog.cpp
src/dialogs/mediaimagepathmaindialog.h
src/dialogs/mediatypedialog.cpp
src/dialogs/mediatypenamedialog.h
src/dialogs/namedialog.h
src/dialogs/platformdialog.cpp
src/dialogs/platformnamedialog.cpp
src/dialogs/platformnamedialog.h
src/dialogs/setupeditdialog.cpp
src/dialogs/setupmaindialog.cpp
src/emufront.pro
src/emulauncher.cpp
src/mainwindow.cpp
src/mainwindow.h
src/models/emufrontfileobjectmodel.cpp [new file with mode: 0644]
src/models/emufrontfileobjectmodel.h [new file with mode: 0644]
src/models/emufrontquerymodel.cpp [new file with mode: 0644]
src/models/emufrontquerymodel.h [new file with mode: 0644]
src/models/mediatypemodel.cpp [new file with mode: 0644]
src/models/mediatypemodel.h [new file with mode: 0644]
src/models/platformmodel.cpp [new file with mode: 0644]
src/models/platformmodel.h [new file with mode: 0644]
src/models/setupmodel.cpp [new file with mode: 0644]
src/models/setupmodel.h [new file with mode: 0644]
src/utils/emuhelper.cpp
src/utils/fileutil.cpp
src/utils/fileutil.h
src/utils/unziphelper.cpp
src/views/emufronteditview.cpp [new file with mode: 0644]
src/views/emufronteditview.h [new file with mode: 0644]
src/views/emufrontfileobjecteditview.cpp [new file with mode: 0644]
src/views/emufrontfileobjecteditview.h [new file with mode: 0644]
src/views/mediatypeeditview.cpp [new file with mode: 0644]
src/views/mediatypeeditview.h [new file with mode: 0644]
src/views/platformeditview.cpp [new file with mode: 0644]
src/views/platformeditview.h [new file with mode: 0644]
src/views/setupeditview.cpp [new file with mode: 0644]
src/views/setupeditview.h [new file with mode: 0644]
src/widgets/efcombobox.cpp
src/widgets/efcombobox.h
src/widgets/effileobjectcombobox.cpp
src/widgets/executablecombobox.cpp
src/widgets/setupcombobox.cpp

diff --git a/doc/views.dia b/doc/views.dia
new file mode 100644 (file)
index 0000000..85254b3
Binary files /dev/null and b/doc/views.dia differ
index e355239..cbaf361 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <QObject>
 #include <QSqlDatabase>
-#include "../exceptions/emufrontexception.h"
+#include "emufrontexception.h"
 
 class QSqlError;
 class QFile;
index b7d6da1..a3cf2b3 100644 (file)
@@ -27,7 +27,7 @@
 #include <QDebug>
 #include <exception>
 #include "dbcreator.h"
-#include "../exceptions/emufrontexception.h"
+#include "emufrontexception.h"
 
 using namespace std;
 
index 43d2ebe..55b34e1 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "dbquerymodelmanager.h"
 #include "dbfile.h"
-#include "../dataobjects/emufrontfileobject.h"
+#include "emufrontfileobject.h"
 
 class DbEmuFrontFileObject : public DbQueryModelManager
 {
index 01f3220..d7bfa15 100644 (file)
@@ -24,7 +24,7 @@
 #include <QSqlRelationalTableModel>
 #include "dbexecutable.h"
 #include "dbsetup.h"
-#include "../dataobjects/executable.h"
+#include "executable.h"
 
 
 DbExecutable::DbExecutable(QObject *parent)
index 24cd60a..ee5ca52 100644 (file)
@@ -21,7 +21,7 @@
 #define DBFILE_H
 
 #include "dbquerymodelmanager.h"
-#include "../dataobjects/emufrontfile.h"
+#include "emufrontfile.h"
 
 class DbFile : public DbQueryModelManager
 {
index b75ef52..e0be688 100644 (file)
@@ -20,7 +20,7 @@
 #include <QSqlRelationalTableModel>
 #include <QSqlRecord>
 #include <QSqlQuery>
-#include "../dataobjects/filepathobject.h"
+#include "filepathobject.h"
 #include "dbfilepath.h"
 #include "dbsetup.h"
 
index 7ecf117..caa09d3 100644 (file)
@@ -21,7 +21,7 @@
 #define DBMEDIAIMAGE_H
 
 #include "dbfile.h"
-#include "../dataobjects/mediaimage.h"
+#include "mediaimage.h"
 #include <QMap>
 
 class DbMediaImage : public DbFile
index c5f6c5c..fcccaa5 100644 (file)
@@ -22,8 +22,8 @@
 
 #include "dbmediaimage.h"
 #include "dbfile.h"
-#include "../dataobjects/mediaimagecontainer.h"
-#include "../dataobjects/filepathobject.h"
+#include "mediaimagecontainer.h"
+#include "filepathobject.h"
 
 class DbMediaImageContainer;
 class DbMediaImage;
index fe4b483..239a120 100644 (file)
@@ -21,7 +21,7 @@
 #define DBMEDIATYPE_H
 
 #include "dbemufrontfileobject.h"
-#include "../dataobjects/mediatype.h"
+#include "mediatype.h"
 
 class DbMediaType : public DbEmuFrontFileObject
 {
index 3c701fa..fa62c7e 100644 (file)
@@ -21,7 +21,7 @@
 #define DBPLATFORM_H
 
 #include "dbemufrontfileobject.h"
-#include "../dataobjects/platform.h"
+#include "platform.h"
 
 class QModelIndex;
 
index c500867..b8a2a67 100644 (file)
@@ -21,7 +21,7 @@
 #define DBSETUP_H
 
 #include "dbquerymodelmanager.h"
-#include "../dataobjects/setup.h"
+#include "setup.h"
 #include "dbplatform.h"
 #include "dbmediatype.h"
 
index cc2f517..95640b5 100644 (file)
@@ -21,7 +21,7 @@
 #define DATAOBJECTEDITDIALOG_H
 
 #include "emufrontdialog.h"
-#include "../dataobjects/emufrontobject.h"
+#include "emufrontobject.h"
 
 class QDialogButtonBox;
 class QComboBox;
index aa57aa1..d8044b8 100644 (file)
@@ -20,7 +20,7 @@
 #include <QtGui>
 #include <QSqlTableModel>
 #include "dbobjectdialog.h"
-#include "../db/databasemanager.h"
+#include "databasemanager.h"
 
 DbObjectDialog::DbObjectDialog(QWidget *parent)
     : EmuFrontDialog(parent)
index a7ae1d6..3ad2718 100644 (file)
@@ -22,8 +22,8 @@
 
 #include "emufrontdialog.h"
 #include "dataobjecteditdialog.h"
-#include "../db/databasemanager.h"
-#include "../dataobjects/emufrontobject.h"
+#include "databasemanager.h"
+#include "emufrontobject.h"
 
 class QPushButton;
 class QModelIndex;
index faa3aaa..2393172 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef EMUFRONTDIALOG_H
 #define EMUFRONTDIALOG_H
 #include <QDialog>
-#include "../exceptions/emufrontexception.h"
+#include "emufrontexception.h"
 
 class QErrorMessage;
 
index fa687d5..5a5b1ae 100644 (file)
@@ -1,6 +1,6 @@
 #include <QtGui>
 #include "emufrontfileobjectdialog.h"
-#include "../db/dbemufrontfileobject.h"
+#include "dbemufrontfileobject.h"
 
 EmuFrontFileObjectDialog::EmuFrontFileObjectDialog(QWidget *parent) :
     DbObjectDialog(parent)
index 8408ffb..e52ceaa 100644 (file)
@@ -1,6 +1,6 @@
 #include "emufrontinputdialog.h"
 #include <QMap>
-#include "../dataobjects/emufrontobject.h"
+#include "emufrontobject.h"
 
 EmuFrontInputDialog::EmuFrontInputDialog(QWidget *parent, Qt::WindowFlags flags)
         : QInputDialog(parent, flags)
index 04d1f3e..5314177 100644 (file)
 
 #include <QtGui>
 #include "executableeditdialog.h"
-#include "../db/dbexecutable.h"
-#include "../db/dbsetup.h"
-#include "../dataobjects/executable.h"
-#include "../dataobjects/setup.h"
-#include "../widgets/setupcombobox.h"
-#include "../exceptions/emufrontexception.h"
+#include "dbexecutable.h"
+#include "dbsetup.h"
+#include "executable.h"
+#include "setup.h"
+#include "setupcombobox.h"
+#include "emufrontexception.h"
 
 ExecutableEditDialog::ExecutableEditDialog(QWidget *parent, EmuFrontObject *obj)
     : DataObjectEditDialog(parent, obj)
index 6fea959..e8c807d 100644 (file)
@@ -20,8 +20,8 @@
 #include <QtGui>
 #include "executablemaindialog.h"
 #include "executableeditdialog.h"
-#include "../db/dbexecutable.h"
-#include "../dataobjects/executable.h"
+#include "dbexecutable.h"
+#include "executable.h"
 
 ExecutableMainDialog::ExecutableMainDialog(QWidget *parent)
     : DbObjectDialog(parent)
index 56fbbdb..6b2ff08 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "listdialog.h"
 #include <QtGui>
-#include "../dataobjects/emufrontobject.h"
+#include "emufrontobject.h"
 
 ListDialog::ListDialog(QWidget *parent)
     : QDialog(parent)
index 82519ca..0f05216 100644 (file)
@@ -21,9 +21,9 @@
 #include <QSqlTableModel>
 #include <QSqlRecord>
 #include "mediaimagepathdialog.h"
-#include "../db/dbsetup.h"
-#include "../dataobjects/filepathobject.h"
-#include "../widgets/setupcombobox.h"
+#include "dbsetup.h"
+#include "filepathobject.h"
+#include "setupcombobox.h"
 
 MediaImagePathDialog::MediaImagePathDialog(QWidget *parent, EmuFrontObject *efObject)
     : BrowseFilePathDialog(parent, efObject, Qt::Horizontal)
index b6bd0d6..4478384 100644 (file)
 
 #include <QtGui>
 
-#include "../dataobjects/filepathobject.h"
-#include "../dataobjects/emufrontfileobject.h"
-#include "../db/dbfilepath.h"
-#include "../utils/fileutil.h"
+#include "filepathobject.h"
+#include "emufrontfileobject.h"
+#include "dbfilepath.h"
+#include "fileutil.h"
 #include "mediaimagepathmaindialog.h"
 #include "mediaimagepathdialog.h"
 
index 4f76c22..7a62968 100644 (file)
@@ -21,7 +21,7 @@
 #define MEDIAIMAGEPATHMAINDIALOG_H
 
 #include "dbobjectdialog.h"
-#include "../db/dbmediaimagecontainer.h"
+#include "dbmediaimagecontainer.h"
 
 class FileUtil;
 class QProgressDialog;
index 4e2d688..bd5efe3 100644 (file)
@@ -21,8 +21,8 @@
 #include <QAbstractItemView>
 #include <QSqlTableModel>
 #include <QTextStream>
-#include "../db/dbmediatype.h"
-#include "../dataobjects/mediatype.h"
+#include "dbmediatype.h"
+#include "mediatype.h"
 #include "mediatypedialog.h"
 #include "mediatypenamedialog.h"
 
index 4398467..9318491 100644 (file)
@@ -21,7 +21,7 @@
 #define MEDIATYPENAMEDIALOG_H
 
 #include "namedialog.h"
-#include "../dataobjects/mediatype.h"
+#include "mediatype.h"
 
 class MediaTypeNameDialog : public NameDialog
 {
index c24cd4f..662edaa 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef NAMEDIALOG_H
 #define NAMEDIALOG_H
 
-#include "../dataobjects/emufrontobject.h"
+#include "emufrontobject.h"
 #include "dataobjecteditdialog.h"
 
 class QLabel;
index 7d8aaf3..a6da6c5 100644 (file)
@@ -18,8 +18,8 @@
 // along with EmuFront.  If not, see <http://www.gnu.org/licenses/>.
 
 #include <QtGui>
-#include "../db/dbplatform.h"
-#include "../dataobjects/platform.h"
+#include "dbplatform.h"
+#include "platform.h"
 #include "platformdialog.h"
 #include "platformnamedialog.h"
 
index a861450..e7d18f7 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <QtGui>
 #include "platformnamedialog.h"
-#include "../db/databasemanager.h"
+#include "databasemanager.h"
 
 PlatformNameDialog::PlatformNameDialog(QWidget *parent, Platform *efObj)
     : NameDialog(parent, efObj)
index 5ce7171..c497c0d 100644 (file)
@@ -21,7 +21,7 @@
 #define PLATFORMNAMEDIALOG_H
 
 #include "namedialog.h"
-#include "../dataobjects/platform.h"
+#include "platform.h"
 
 class PlatformNameDialog : public NameDialog
 {
index 63e5753..ba7068e 100644 (file)
 #include <QSqlTableModel>
 #include <QSqlRecord>
 #include "setupeditdialog.h"
-#include "../widgets/fileextensionwidget.h"
-#include "../widgets/effileobjectcombobox.h"
-#include "../db/dbmediatype.h"
-#include "../db/dbplatform.h"
-#include "../db/dbsetup.h"
+#include "fileextensionwidget.h"
+#include "effileobjectcombobox.h"
+#include "dbmediatype.h"
+#include "dbplatform.h"
+#include "dbsetup.h"
 
 SetupEditDialog::SetupEditDialog(QWidget *parent, EmuFrontObject* obj)
     : DataObjectEditDialog(parent, obj)
index c0c97a9..fe327a1 100644 (file)
@@ -20,7 +20,7 @@
 #include <QtGui>
 #include "setupmaindialog.h"
 #include "setupeditdialog.h"
-#include "../db/dbsetup.h"
+#include "dbsetup.h"
 
 SetupMainDialog::SetupMainDialog(QWidget *parent)
     : DbObjectDialog(parent)
index 5f51636..9fa39a7 100644 (file)
@@ -4,11 +4,23 @@
 TEMPLATE = app
 TARGET = 
 DEPENDPATH += . \
+    exceptions \
+    dataobjects \
     db \
-    dialogs
+    dialogs \
+    models \
+    utils \
+    widgets \
+    views
 INCLUDEPATH += . \
     db \
-    dialogs
+    exceptions \
+    dataobjects \
+    dialogs \
+    models \
+    utils \
+    widgets \
+    views
 QT += sql
 QT += xml
 
@@ -39,8 +51,6 @@ HEADERS += mainwindow.h \
     utils/fileutil.h \
     dataobjects/setup.h \
     db/dbsetup.h \
-    db/dbtablemodelmanager.h \
-    db/dbquerymodelmanager.h \
     dialogs/setupmaindialog.h \
     dialogs/setupeditdialog.h \
     widgets/stringlistwidget.h \
@@ -71,16 +81,16 @@ HEADERS += mainwindow.h \
     db/dbconfig.h \
     utils/datfileutil.h \
     widgets/fileextensionwidget.h \
-    db/platformmodel.h \
-    dialogs/platformmaindialog.h \
-    dialogs/emufrontdatadialog.h \
-    db/emufrontquerymodel.h \
-    db/emufrontfileobjectmodel.h \
-    db/mediatypemodel.h \
-    dialogs/emufrontfileobjectmaindialog.h \
-    dialogs/mediatypemaindialog.h \
-    db/setupmodel.h \
-    dialogs/setupmainview.h
+    models/setupmodel.h \
+    models/platformmodel.h \
+    models/mediatypemodel.h \
+    models/emufrontquerymodel.h \
+    models/emufrontfileobjectmodel.h \
+    views/setupeditview.h \
+    views/platformeditview.h \
+    views/mediatypeeditview.h \
+    views/emufrontfileobjecteditview.h \
+    views/emufronteditview.h
 SOURCES += main.cpp \
     mainwindow.cpp \
     db/databasemanager.cpp \
@@ -139,16 +149,16 @@ SOURCES += main.cpp \
     db/dbconfig.cpp \
     utils/datfileutil.cpp \
     widgets/fileextensionwidget.cpp \
-    db/platformmodel.cpp \
-    dialogs/platformmaindialog.cpp \
-    dialogs/emufrontdatadialog.cpp \
-    db/emufrontquerymodel.cpp \
-    db/emufrontfileobjectmodel.cpp \
-    db/mediatypemodel.cpp \
-    dialogs/emufrontfileobjectmaindialog.cpp \
-    dialogs/mediatypemaindialog.cpp \
-    db/setupmodel.cpp \
-    dialogs/setupmainview.cpp
+    models/setupmodel.cpp \
+    models/platformmodel.cpp \
+    models/mediatypemodel.cpp \
+    models/emufrontquerymodel.cpp \
+    models/emufrontfileobjectmodel.cpp \
+    views/setupeditview.cpp \
+    views/platformeditview.cpp \
+    views/mediatypeeditview.cpp \
+    views/emufrontfileobjecteditview.cpp \
+    views/emufronteditview.cpp
 OTHER_FILES +=  
 
 CONFIG += mobility
index 100fcdb..8e95a53 100644 (file)
 #include <QSqlTableModel>
 #include <QItemSelectionModel>
 #include "emulauncher.h"
-#include "db/dbmediatype.h"
-#include "db/dbplatform.h"
-#include "db/dbexecutable.h"
-#include "db/dbmediaimagecontainer.h"
-#include "widgets/effileobjectcombobox.h"
-#include "widgets/executablecombobox.h"
-#include "dataobjects/executable.h"
-#include "utils/emuhelper.h"
-#include "dialogs/emufrontinputdialog.h"
+#include "dbmediatype.h"
+#include "dbplatform.h"
+#include "dbexecutable.h"
+#include "dbmediaimagecontainer.h"
+#include "effileobjectcombobox.h"
+#include "executablecombobox.h"
+#include "executable.h"
+#include "emuhelper.h"
+#include "emufrontinputdialog.h"
 
 EmuLauncher::EmuLauncher(QErrorMessage *errorMessage, QWidget *parent, QString tmp) :
     QWidget(parent), tmpDirPath(tmp), errorMessage(errorMessage)
index af3a8d0..7021e36 100644 (file)
 #include "mainwindow.h"
 #include "emulauncher.h"
 // TODO: deprecated
-#include "dialogs/platformdialog.h"
-#include "dialogs/platformmaindialog.h"
-#include "dialogs/mediatypedialog.h"
+#include "platformdialog.h"
+#include "platformeditview.h"
+#include "mediatypedialog.h"
 // TODO: deprecated
-#include "dialogs/mediatypemaindialog.h"
-#include "dialogs/mediaimagepathmaindialog.h"
+#include "mediatypeeditview.h"
+#include "mediaimagepathmaindialog.h"
 // TODO: deprecated
-#include "dialogs/setupmaindialog.h"
-#include "dialogs/setupmainview.h"
-#include "dialogs/executablemaindialog.h"
-#include "utils/datfileutil.h"
-#include "db/databasemanager.h"
-#include "db/dbcreator.h"
-#include "db/dbconfig.h"
+#include "setupmaindialog.h"
+#include "setupeditview.h"
+#include "executablemaindialog.h"
+#include "datfileutil.h"
+#include "databasemanager.h"
+#include "dbcreator.h"
+#include "dbconfig.h"
 
 QString MainWindow::aboutStr = trUtf8(
         "<h2>EmuFront</h2>"
@@ -155,7 +155,7 @@ void MainWindow::configurePlatforms()
 void MainWindow::configurePlatformss()
 {
     if (!plfDialog) {
-        plfDialog = new PlatformMainDialog(this);
+        plfDialog = new PlatformEditView(this);
         connect(plfDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
     }
     activateDialog(plfDialog);
@@ -176,7 +176,7 @@ void MainWindow::configureMediaTypess()
 {
     if (!mdtDialog)
     {
-        mdtDialog = new MediaTypeMainDialog(this);
+        mdtDialog = new MediaTypeEditView(this);
         connect(mdtDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
    }
    activateDialog(mdtDialog);
@@ -206,7 +206,7 @@ void MainWindow::configureSetups()
 void MainWindow::configureSetupss()
 {
     if (!setupMainView) {
-        setupMainView = new SetupMainView(this);
+        setupMainView = new SetupEditView(this);
     }
     activateDialog(setupMainView);
 }
index 6e92c67..17addb0 100644 (file)
 class QAction;
 // TODO: DEPRECATED
 class PlatformDialog;
-class PlatformMainDialog;
-class MediaTypeMainDialog;
+class PlatformEditView;
+class MediaTypeEditView;
 // TODO: DEPRECATED
 class MediaTypeDialog;
-class MediaTypeMainDialog;
+class MediaTypeEditView;
 class MediaImagePathMainDialog;
 // TODO: DEPRECATED
 class SetupMainDialog;
-class SetupMainView;
+class SetupEditView;
 class ExecutableMainDialog;
 //class TmpFolderEditDialog;
 class QLabel;
@@ -88,14 +88,14 @@ private:
 
     // TODO: deprecated
     PlatformDialog *platformDialog;
-    PlatformMainDialog *plfDialog;
+    PlatformEditView *plfDialog;
     // TODO: deprecated
     MediaTypeDialog *mediaTypeDialog;
-    MediaTypeMainDialog *mdtDialog;
+    MediaTypeEditView *mdtDialog;
     MediaImagePathMainDialog *mediaImagePathDialog;
     // TODO: deprecated
     SetupMainDialog *setupMainDialog;
-    SetupMainView *setupMainView;
+    SetupEditView *setupMainView;
     ExecutableMainDialog *executableMainDialog;
     //TmpFolderEditDialog *tmpFolderDialog;
        QMenu *configMenu;
diff --git a/src/models/emufrontfileobjectmodel.cpp b/src/models/emufrontfileobjectmodel.cpp
new file mode 100644 (file)
index 0000000..f287ca1
--- /dev/null
@@ -0,0 +1,135 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#include <QtSql>
+#include "emufrontfileobjectmodel.h"
+
+EmuFrontFileObjectModel::EmuFrontFileObjectModel(QObject *parent) :
+    EmuFrontQueryModel(parent)
+{ }
+
+Qt::ItemFlags EmuFrontFileObjectModel::flags(const QModelIndex &index) const
+{
+    Qt::ItemFlags flags = QSqlQueryModel::flags(index);
+    if (index.column() == EmuFrontFileObject_Name) {
+        flags |= Qt::ItemIsEditable;
+    }
+    return flags;
+}
+
+bool EmuFrontFileObjectModel::setData(const QModelIndex &index, const QVariant &value, int /*role*/)
+{
+    if(index.column() != EmuFrontFileObject_Name)
+        return false;
+
+    QModelIndex primaryKeyIndex
+        = QSqlQueryModel::index(index.row(), EmuFrontFileObject_Id);
+
+    int id = data(primaryKeyIndex).toInt();
+    clear();
+
+    bool ok;
+    if (index.column() == EmuFrontFileObject_Name) {
+        ok = setName(id, value.toString());
+    }
+
+    refresh();
+    return ok;
+}
+
+void EmuFrontFileObjectModel::refresh()
+ {
+     setQuery(constructSelect());
+     setHeaderData(EmuFrontFileObject_Id, Qt::Horizontal, tr("ID"));
+     setHeaderData(EmuFrontFileObject_Name, Qt::Horizontal, tr("Name"));
+     setHeaderData(EmuFrontFileObject_FileId, Qt::Horizontal, tr("FileID"));
+     setHeaderData(EmuFrontFileObject_FileName, Qt::Horizontal, tr("File Name"));
+     setHeaderData(EmuFrontFileObject_FileCheckSum, Qt::Horizontal, tr("File Checksum"));
+     setHeaderData(EmuFrontFileObject_FileSize, Qt::Horizontal, tr("File Size"));
+     setHeaderData(EmuFrontFileObject_FileType, Qt::Horizontal, tr("File Type"));
+     setHeaderData(EmuFrontFileObject_FileUpdateTime, Qt::Horizontal, tr("File Updated"));
+ }
+
+QString EmuFrontFileObjectModel::constructSelect(QString where) const
+{
+    return QString("SELECT maintbl.id AS FileObjectId, "
+            "maintbl.name AS Name, "
+            "file.id AS FileId, "
+            "file.name AS FileName, "
+            "file.type AS FileType, "
+            "file.checksum AS FileChecksum, "
+            "file.size AS FileSize, "
+            "file.updatetime AS FileUpdateTime "
+            "FROM %1 AS maintbl "
+            "LEFT OUTER JOIN file ON maintbl.fileid=file.id "
+            "%2 "
+            "ORDER BY Name").arg(tableName).arg(where);
+}
+
+bool EmuFrontFileObjectModel::setName(int id, const QString &name)
+{
+    QSqlQuery query;
+    query.prepare(QString("update %1 set name = :name where id = :id").arg(tableName));
+    query.bindValue(":name", name);
+    query.bindValue(":id", id);
+    return query.exec();
+}
+
+bool EmuFrontFileObjectModel::insertRows(int row, int count, const QModelIndex &parent)
+{
+    if (parent.isValid())
+        return false; // This is a flat model
+    if (rowCount() < row)
+        row = rowCount() + 1;
+    QSqlQuery q;
+    q.prepare(QString("INSERT INTO %1 (id, name, fileid) "
+        " VALUES (NULL, '', NULL) ").arg(tableName));
+    beginInsertRows(QModelIndex(), row, row + count - 1);
+    for (int i = 0; i < count; ++i) {
+        q.exec();
+    }
+    endInsertRows();
+    refresh();
+    return true;
+}
+
+bool EmuFrontFileObjectModel::removeRows(int row, int count, const QModelIndex &parent)
+{
+     if (parent.isValid()) {
+        return false; // This is a flat model
+    }
+    if (rowCount() < row + count - 1)
+        return false;
+
+    QSqlQuery q;
+    q.prepare(QString("DELETE FROM %1 WHERE id=:id").arg(tableName));
+    QModelIndex primaryIndex;
+    int id = -1;
+    beginRemoveRows(QModelIndex(), row, row + count - 1);
+    for(int i = 0; i < count; ++i) {
+        primaryIndex = QSqlQueryModel::index(row + i, EmuFrontFileObject_Id);
+        id = data(primaryIndex).toInt();
+        qDebug() << "Removing data item with id " << id;
+        q.bindValue(":id", id);
+        q.exec();
+    }
+    endRemoveRows();
+    refresh();
+    return true;
+}
diff --git a/src/models/emufrontfileobjectmodel.h b/src/models/emufrontfileobjectmodel.h
new file mode 100644 (file)
index 0000000..5b8aaad
--- /dev/null
@@ -0,0 +1,51 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef EMUFRONTFILEOBJECTMODEL_H
+#define EMUFRONTFILEOBJECTMODEL_H
+
+#include "emufrontquerymodel.h"
+
+class EmuFrontFileObjectModel : public EmuFrontQueryModel
+{
+    Q_OBJECT
+public:
+    EmuFrontFileObjectModel(QObject *parent = 0);
+    virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+    virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
+    virtual bool insertRows(int row, int count, const QModelIndex &parent);
+    virtual bool removeRows(int row, int count, const QModelIndex &parent);
+    enum {
+        EmuFrontFileObject_Id,
+        EmuFrontFileObject_Name,
+        EmuFrontFileObject_FileId,
+        EmuFrontFileObject_FileName,
+        EmuFrontFileObject_FileType,
+        EmuFrontFileObject_FileCheckSum,
+        EmuFrontFileObject_FileSize,
+        EmuFrontFileObject_FileUpdateTime
+    };
+
+protected:
+    virtual void refresh();
+    virtual QString constructSelect(QString where = "") const;
+    virtual bool setName(int id, const QString &name);
+};
+
+#endif // EMUFRONTFILEOBJECTMODEL_H
diff --git a/src/models/emufrontquerymodel.cpp b/src/models/emufrontquerymodel.cpp
new file mode 100644 (file)
index 0000000..9d99e46
--- /dev/null
@@ -0,0 +1,25 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#include "emufrontquerymodel.h"
+
+EmuFrontQueryModel::EmuFrontQueryModel(QObject *parent) :
+    QSqlQueryModel(parent)
+{
+}
diff --git a/src/models/emufrontquerymodel.h b/src/models/emufrontquerymodel.h
new file mode 100644 (file)
index 0000000..5e56c18
--- /dev/null
@@ -0,0 +1,39 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef EMUFRONTQUERYMODEL_H
+#define EMUFRONTQUERYMODEL_H
+
+#include <QSqlQueryModel>
+
+class EmuFrontQueryModel : public QSqlQueryModel
+{
+    Q_OBJECT
+public:
+    EmuFrontQueryModel(QObject *parent = 0);
+
+signals:
+
+public slots:
+
+protected:
+    QString tableName;
+};
+
+#endif // EMUFRONTQUERYMODEL_H
diff --git a/src/models/mediatypemodel.cpp b/src/models/mediatypemodel.cpp
new file mode 100644 (file)
index 0000000..4352879
--- /dev/null
@@ -0,0 +1,27 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#include "mediatypemodel.h"
+
+MediaTypeModel::MediaTypeModel(QObject *parent) :
+    EmuFrontFileObjectModel(parent)
+{
+    tableName = "mediatype";
+    refresh();
+}
diff --git a/src/models/mediatypemodel.h b/src/models/mediatypemodel.h
new file mode 100644 (file)
index 0000000..90ad66e
--- /dev/null
@@ -0,0 +1,32 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef MEDIATYPEMODEL_H
+#define MEDIATYPEMODEL_H
+
+#include "emufrontfileobjectmodel.h"
+
+class MediaTypeModel : public EmuFrontFileObjectModel
+{
+    Q_OBJECT
+public:
+    MediaTypeModel(QObject *parent = 0);
+};
+
+#endif // MEDIATYPEMODEL_H
diff --git a/src/models/platformmodel.cpp b/src/models/platformmodel.cpp
new file mode 100644 (file)
index 0000000..66a2815
--- /dev/null
@@ -0,0 +1,27 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#include "platformmodel.h"
+
+PlatformModel::PlatformModel(QObject *parent) :
+    EmuFrontFileObjectModel(parent)
+{
+    tableName = "platform";
+    refresh();
+}
diff --git a/src/models/platformmodel.h b/src/models/platformmodel.h
new file mode 100644 (file)
index 0000000..eef53ad
--- /dev/null
@@ -0,0 +1,32 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef PLATFORMMODEL_H
+#define PLATFORMMODEL_H
+
+#include "emufrontfileobjectmodel.h"
+
+class PlatformModel : public EmuFrontFileObjectModel
+{
+    Q_OBJECT
+public:
+    PlatformModel(QObject *parent = 0);
+};
+
+#endif // PLATFORMMODEL_H
diff --git a/src/models/setupmodel.cpp b/src/models/setupmodel.cpp
new file mode 100644 (file)
index 0000000..cea5ccc
--- /dev/null
@@ -0,0 +1,51 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#include "setupmodel.h"
+
+SetupModel::SetupModel(QObject *parent) :
+    EmuFrontQueryModel(parent)
+{
+    refresh();
+}
+
+void SetupModel::refresh()
+{
+    setQuery(constructSelect());
+    setHeaderData(Setup_Id, Qt::Horizontal, tr("Id"));
+    setHeaderData(Setup_PlatformId, Qt::Horizontal, tr("Platform id"));
+    setHeaderData(Setup_MediaTypeId, Qt::Horizontal, tr("Media type id"));
+    setHeaderData(Setup_FileTypeExtensions, Qt::Horizontal, tr("File types"));
+    setHeaderData(Setup_Name, Qt::Horizontal, tr("Name"));
+}
+
+QString SetupModel::constructSelect(QString where) const
+{
+    return QString(
+        "SELECT setup.id AS SetupId, "
+        "setup.platformid AS PlatformId, "
+        "setup.mediatypeid AS MediaTypeId, "
+        "setup.filetypeextensions AS SupportedFileTypeExtensions, "
+        "platform.name || ' ' || mediatype.name AS SetupName "
+        "FROM setup "
+        "INNER JOIN platform ON setup.platformid=platform.id "
+        "INNER JOIN mediatype ON setup.mediatypeid=mediatype.id %1 "
+        "ORDER BY SetupName"
+        ).arg(where);
+}
diff --git a/src/models/setupmodel.h b/src/models/setupmodel.h
new file mode 100644 (file)
index 0000000..036a016
--- /dev/null
@@ -0,0 +1,42 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef SETUPMODEL_H
+#define SETUPMODEL_H
+
+#include "emufrontquerymodel.h"
+
+class SetupModel : public EmuFrontQueryModel
+{
+    Q_OBJECT
+public:
+    SetupModel(QObject *parent = 0);
+    enum { Setup_Id = 0,
+           Setup_PlatformId,
+           Setup_MediaTypeId,
+           Setup_FileTypeExtensions,
+           Setup_Name };
+    static const QString FILE_TYPE_EXTENSION_SEPARATOR;
+
+protected:
+    virtual void refresh();
+    virtual QString constructSelect(QString where = "") const;
+};
+
+#endif // SETUPMODEL_H
index 4855e69..75a7288 100644 (file)
@@ -23,9 +23,9 @@
 #include <QMessageBox>
 #include "emuhelper.h"
 #include "unziphelper.h"
-#include "../dataobjects/mediaimagecontainer.h"
-#include "../dataobjects/executable.h"
-#include "../exceptions/emufrontexception.h"
+#include "mediaimagecontainer.h"
+#include "executable.h"
+#include "emufrontexception.h"
 
 EmuHelper::EmuHelper(QObject *parent) :
     ProcessHelper(parent)
index 49ee35b..d779a0c 100644 (file)
 #include <QProgressDialog>
 #include "fileutil.h"
 #include "zlib.h" /* crc32 */
-#include "../exceptions/emufrontexception.h"
-#include "../dataobjects/setup.h"
-#include "../dataobjects/mediaimage.h"
-#include "../dataobjects/mediaimagecontainer.h"
-#include "../dataobjects/mediatype.h"
-#include "../dataobjects/platform.h"
-#include "../db/dbmediaimagecontainer.h"
+#include "emufrontexception.h"
+#include "setup.h"
+#include "mediaimage.h"
+#include "mediaimagecontainer.h"
+#include "mediatype.h"
+#include "platform.h"
+#include "dbmediaimagecontainer.h"
 #include "unziphelper.h"
 
 FileUtil::FileUtil(QObject *parent) : QObject(parent)
index f5c50ee..a51d879 100644 (file)
@@ -21,8 +21,8 @@
 #define FILEUTIL_H
 
 #include <QObject>
-#include "../dataobjects/emufrontfileobject.h"
-#include "../dataobjects/filepathobject.h"
+#include "emufrontfileobject.h"
+#include "filepathobject.h"
 
 #define READ_BUFFER (256*1024)
 
index 0304e5b..d239e72 100644 (file)
@@ -20,9 +20,9 @@
 #include <QFileInfo>
 #include <QDebug>
 #include "unziphelper.h"
-#include "../dataobjects/mediaimage.h"
-#include "../dataobjects/filepathobject.h"
-#include "../exceptions/emufrontexception.h"
+#include "mediaimage.h"
+#include "filepathobject.h"
+#include "emufrontexception.h"
 
 const QString UnzipHelper::UNZIP_COMMAND = "unzip ";
 const QString UnzipHelper::UNZIP_LIST_ARGS = "-lv ";
diff --git a/src/views/emufronteditview.cpp b/src/views/emufronteditview.cpp
new file mode 100644 (file)
index 0000000..d5f1be8
--- /dev/null
@@ -0,0 +1,117 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#include <QtGui>
+#include "emufronteditview.h"
+
+EmuFrontEditView::EmuFrontEditView(QWidget *parent) :
+    EmuFrontDialog(parent)
+{
+    editButton = new QPushButton(tr("&Edit"));
+    editButton->setEnabled(false);
+    addButton = new QPushButton(tr("&Add"));
+    deleteButton = new QPushButton(tr("&Delete"));
+    deleteButton->setEnabled(false);
+    objectList = new QTableView(this);
+    buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Vertical);
+    buttonBox->addButton(editButton, QDialogButtonBox::ActionRole);
+    buttonBox->addButton(addButton, QDialogButtonBox::ActionRole);
+    buttonBox->addButton(deleteButton, QDialogButtonBox::ActionRole);
+    // this be called from the implementing classes:
+    //connectSignals();
+    layout();
+}
+
+void EmuFrontEditView::postInit()
+{
+    connectSignals();
+    setHiddenColumns();
+    hideColumns();
+}
+
+void EmuFrontEditView::layout()
+{
+    QHBoxLayout *mainLayout = new QHBoxLayout;
+    mainLayout->addWidget(objectList);
+    mainLayout->addWidget(buttonBox);
+    setLayout(mainLayout);
+}
+
+void EmuFrontEditView::hideColumns()
+{
+    foreach(int c, hiddenColumns)
+        objectList->hideColumn(c);
+}
+
+void EmuFrontEditView::connectSignals()
+{
+    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(objectList, SIGNAL(clicked(const QModelIndex &)),
+        this, SLOT(listObjectClicked(const QModelIndex &)));
+    connect(editButton, SIGNAL(clicked()), this, SLOT(editButtonClicked()));
+    connect(addButton, SIGNAL(clicked()), this, SLOT(addButtonClicked()));
+    connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteButtonClicked()));
+}
+
+void EmuFrontEditView::editButtonClicked()
+{
+    setButtonsEnabled(false);
+    qDebug() << "Edit button clicked";
+}
+
+void EmuFrontEditView::deleteButtonClicked()
+{
+    setButtonsEnabled(false);
+    if (!objectList->currentIndex().isValid())
+        return;
+    int row = objectList->currentIndex().row();
+    if ( !model->removeRows(row, 1) ) {
+        errorMessage->showMessage(tr("Failed removing selected item."));
+    }
+}
+
+
+void EmuFrontEditView::addButtonClicked()
+{
+    int row = objectList->currentIndex().isValid() ?
+        objectList->currentIndex().row() : 0;
+    model->insertRows(row, 1);
+    QModelIndex ind = model->index(row, 1);
+    if (!ind.isValid()){
+        return;
+    }
+    objectList->setCurrentIndex(ind);
+    objectList->edit(ind);
+}
+
+void EmuFrontEditView::listObjectClicked(const QModelIndex &index)
+{
+    setButtonsEnabled(index.isValid());
+}
+
+void EmuFrontEditView::setButtonsEnabled(bool b)
+{
+    editButton->setEnabled(b);
+    deleteButton->setEnabled(b);
+}
+
+void EmuFrontEditView::setHiddenColumns()
+{
+    // default implementation
+}
diff --git a/src/views/emufronteditview.h b/src/views/emufronteditview.h
new file mode 100644 (file)
index 0000000..a4e73be
--- /dev/null
@@ -0,0 +1,60 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef EMUFRONTDATADIALOG_H
+#define EMUFRONTDATADIALOG_H
+
+#include "emufrontdialog.h"
+#include "emufrontquerymodel.h"
+
+class QDialogButtonBox;
+class QTableView;
+
+class EmuFrontEditView : public EmuFrontDialog
+{
+    Q_OBJECT
+public:
+    EmuFrontEditView(QWidget *parent = 0);
+
+private slots:
+    void editButtonClicked();
+    void addButtonClicked();
+    void deleteButtonClicked();
+    void listObjectClicked(const QModelIndex &);
+
+protected:
+    EmuFrontQueryModel *model;
+    QList<int> hiddenColumns;
+    QDialogButtonBox *buttonBox;
+    QTableView *objectList;
+    void postInit();
+
+private:
+    QPushButton *editButton;
+    QPushButton *addButton;
+    QPushButton *deleteButton;
+    void layout();
+    virtual void setHiddenColumns();
+    void hideColumns();
+    virtual void connectSignals();
+    void setButtonsEnabled(bool);
+
+};
+
+#endif // EMUFRONTDATADIALOG_H
diff --git a/src/views/emufrontfileobjecteditview.cpp b/src/views/emufrontfileobjecteditview.cpp
new file mode 100644 (file)
index 0000000..1836edf
--- /dev/null
@@ -0,0 +1,34 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#include "emufrontfileobjecteditview.h"
+#include "emufrontfileobjectmodel.h"
+
+EmuFrontFileObjectEditView::EmuFrontFileObjectEditView(QWidget *parent) :
+    EmuFrontEditView(parent)
+{
+}
+
+void EmuFrontFileObjectEditView::setHiddenColumns()
+{
+    hiddenColumns << EmuFrontFileObjectModel::EmuFrontFileObject_Id;
+    hiddenColumns << EmuFrontFileObjectModel::EmuFrontFileObject_FileId;
+    hiddenColumns << EmuFrontFileObjectModel::EmuFrontFileObject_FileType;
+    hiddenColumns << EmuFrontFileObjectModel::EmuFrontFileObject_FileCheckSum;
+}
diff --git a/src/views/emufrontfileobjecteditview.h b/src/views/emufrontfileobjecteditview.h
new file mode 100644 (file)
index 0000000..53abf41
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef EMUFRONTFILEOBJECTMAINDIALOG_H
+#define EMUFRONTFILEOBJECTMAINDIALOG_H
+
+#include "emufronteditview.h"
+
+class EmuFrontFileObjectEditView : public EmuFrontEditView
+{
+    Q_OBJECT
+public:
+    EmuFrontFileObjectEditView(QWidget *parent = 0);
+
+private:
+    virtual void setHiddenColumns();
+};
+
+#endif // EMUFRONTFILEOBJECTMAINDIALOG_H
diff --git a/src/views/mediatypeeditview.cpp b/src/views/mediatypeeditview.cpp
new file mode 100644 (file)
index 0000000..bab4b2d
--- /dev/null
@@ -0,0 +1,30 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#include <QtGui>
+#include "mediatypeeditview.h"
+#include "mediatypemodel.h"
+
+MediaTypeEditView::MediaTypeEditView(QWidget *parent) :
+    EmuFrontFileObjectEditView(parent)
+{
+    model = new MediaTypeModel(this);
+    objectList->setModel(model);
+    postInit();
+}
diff --git a/src/views/mediatypeeditview.h b/src/views/mediatypeeditview.h
new file mode 100644 (file)
index 0000000..43a21be
--- /dev/null
@@ -0,0 +1,32 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef MEDIATYPEMAINDIALOG_H
+#define MEDIATYPEMAINDIALOG_H
+
+#include "emufrontfileobjecteditview.h"
+
+class MediaTypeEditView : public EmuFrontFileObjectEditView
+{
+    Q_OBJECT
+public:
+    MediaTypeEditView(QWidget *parent = 0);
+};
+
+#endif // MEDIATYPEMAINDIALOG_H
diff --git a/src/views/platformeditview.cpp b/src/views/platformeditview.cpp
new file mode 100644 (file)
index 0000000..e92bc8a
--- /dev/null
@@ -0,0 +1,32 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#include <QtGui>
+#include "platformeditview.h"
+#include "platformmodel.h"
+
+PlatformEditView::PlatformEditView(QWidget *parent) :
+    EmuFrontFileObjectEditView(parent)
+{
+    model = new PlatformModel(this);
+    objectList->setModel(model);
+    postInit();
+}
+
+
diff --git a/src/views/platformeditview.h b/src/views/platformeditview.h
new file mode 100644 (file)
index 0000000..7982bd0
--- /dev/null
@@ -0,0 +1,32 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef PLATFORMMAINDIALOG_H
+#define PLATFORMMAINDIALOG_H
+
+#include "emufrontfileobjecteditview.h"
+
+class PlatformEditView : public EmuFrontFileObjectEditView
+{
+    Q_OBJECT
+public:
+    PlatformEditView(QWidget *parent = 0);
+  };
+
+#endif // PLATFORMMAINDIALOG_H
diff --git a/src/views/setupeditview.cpp b/src/views/setupeditview.cpp
new file mode 100644 (file)
index 0000000..dbf7e91
--- /dev/null
@@ -0,0 +1,30 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#include <QtGui>
+#include "setupeditview.h"
+#include "setupmodel.h"
+
+SetupEditView::SetupEditView(QWidget *parent) :
+    EmuFrontEditView(parent)
+{
+    model = new SetupModel(this);
+    objectList->setModel(model);
+    postInit();
+}
diff --git a/src/views/setupeditview.h b/src/views/setupeditview.h
new file mode 100644 (file)
index 0000000..a153207
--- /dev/null
@@ -0,0 +1,37 @@
+// 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 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
+// 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 EmuFront.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef SETUPMAINVIEW_H
+#define SETUPMAINVIEW_H
+
+#include "emufronteditview.h"
+
+class SetupEditView : public EmuFrontEditView
+{
+    Q_OBJECT
+public:
+    SetupEditView(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // SETUPMAINVIEW_H
index 4a27ccc..07cda9f 100644 (file)
@@ -18,8 +18,8 @@
 // along with EmuFront.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "efcombobox.h"
-#include "../exceptions/emufrontexception.h"
-#include "../dataobjects/emufrontobject.h"
+#include "emufrontexception.h"
+#include "emufrontobject.h"
 #include <QSqlQueryModel>
 #include <QSqlRecord>
 #include <QDebug>
index 5542d96..89681bd 100644 (file)
@@ -21,7 +21,7 @@
 #define EFCOMBOBOX_H
 
 #include <QComboBox>
-#include "../db/databasemanager.h"
+#include "databasemanager.h"
 
 class EFComboBox : public QComboBox
 {
index 9c4251d..7265ed6 100644 (file)
@@ -18,7 +18,7 @@
 // along with EmuFront.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "effileobjectcombobox.h"
-#include "../db/dbemufrontfileobject.h"
+#include "dbemufrontfileobject.h"
 
 EFFileObjectComboBox::EFFileObjectComboBox(DatabaseManager *dbMan, QWidget *parent)
     : EFComboBox(dbMan, parent)
index 6081b5a..5177a63 100644 (file)
@@ -18,7 +18,7 @@
 // along with EmuFront.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "executablecombobox.h"
-#include "../db/dbexecutable.h"
+#include "dbexecutable.h"
 
 ExecutableComboBox::ExecutableComboBox(DatabaseManager *dbMan, QWidget *parent)
     : EFComboBox(dbMan, parent)
index 2b53465..1630568 100644 (file)
@@ -18,7 +18,7 @@
 // along with EmuFront.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "setupcombobox.h"
-#include "../db/dbsetup.h"
+#include "dbsetup.h"
 
 SetupComboBox::SetupComboBox(DatabaseManager *dbMan, QWidget *parent)
     : EFComboBox(dbMan, parent)