Added a sibling model and view to platform: mediatype.
authorMikko Keinnen <mikko.keinanen@gmail.com>
Wed, 1 Dec 2010 22:02:37 +0000 (00:02 +0200)
committerMikko Keinänen <mikko.keinanen@gmail.com>
Wed, 1 Dec 2010 22:02:37 +0000 (00:02 +0200)
src/db/mediatypemodel.cpp [new file with mode: 0644]
src/db/mediatypemodel.h [new file with mode: 0644]
src/dialogs/emufrontfileobjectmaindialog.cpp [new file with mode: 0644]
src/dialogs/emufrontfileobjectmaindialog.h [new file with mode: 0644]
src/dialogs/mediatypemaindialog.cpp [new file with mode: 0644]
src/dialogs/mediatypemaindialog.h [new file with mode: 0644]
src/dialogs/platformmaindialog.cpp
src/dialogs/platformmaindialog.h
src/emufront.pro
src/mainwindow.cpp
src/mainwindow.h

diff --git a/src/db/mediatypemodel.cpp b/src/db/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/db/mediatypemodel.h b/src/db/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/dialogs/emufrontfileobjectmaindialog.cpp b/src/dialogs/emufrontfileobjectmaindialog.cpp
new file mode 100644 (file)
index 0000000..6f4a4a8
--- /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 "emufrontfileobjectmaindialog.h"
+#include "db/emufrontfileobjectmodel.h"
+
+EmuFrontFileObjectMainDialog::EmuFrontFileObjectMainDialog(QWidget *parent) :
+    EmuFrontDataDialog(parent)
+{
+}
+
+void EmuFrontFileObjectMainDialog::setHiddenColumns()
+{
+    hiddenColumns << EmuFrontFileObjectModel::EmuFrontFileObject_Id;
+    hiddenColumns << EmuFrontFileObjectModel::EmuFrontFileObject_FileId;
+    hiddenColumns << EmuFrontFileObjectModel::EmuFrontFileObject_FileType;
+    hiddenColumns << EmuFrontFileObjectModel::EmuFrontFileObject_FileCheckSum;
+}
diff --git a/src/dialogs/emufrontfileobjectmaindialog.h b/src/dialogs/emufrontfileobjectmaindialog.h
new file mode 100644 (file)
index 0000000..53bdbb1
--- /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 "emufrontdatadialog.h"
+
+class EmuFrontFileObjectMainDialog : public EmuFrontDataDialog
+{
+    Q_OBJECT
+public:
+    EmuFrontFileObjectMainDialog(QWidget *parent = 0);
+
+private:
+    virtual void setHiddenColumns();
+};
+
+#endif // EMUFRONTFILEOBJECTMAINDIALOG_H
diff --git a/src/dialogs/mediatypemaindialog.cpp b/src/dialogs/mediatypemaindialog.cpp
new file mode 100644 (file)
index 0000000..031ad06
--- /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 "mediatypemaindialog.h"
+#include "db/mediatypemodel.h"
+
+MediaTypeMainDialog::MediaTypeMainDialog(QWidget *parent) :
+    EmuFrontFileObjectMainDialog(parent)
+{
+    model = new MediaTypeModel(this);
+    objectList->setModel(model);
+    postInit();
+}
diff --git a/src/dialogs/mediatypemaindialog.h b/src/dialogs/mediatypemaindialog.h
new file mode 100644 (file)
index 0000000..ca8d4d2
--- /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 "emufrontfileobjectmaindialog.h"
+
+class MediaTypeMainDialog : public EmuFrontFileObjectMainDialog
+{
+    Q_OBJECT
+public:
+    MediaTypeMainDialog(QWidget *parent = 0);
+};
+
+#endif // MEDIATYPEMAINDIALOG_H
index e4951bc..05127c7 100644 (file)
 #include "db/platformmodel.h"
 
 PlatformMainDialog::PlatformMainDialog(QWidget *parent) :
-    EmuFrontDataDialog(parent)
+    EmuFrontFileObjectMainDialog(parent)
 {
     model = new PlatformModel(this);
     objectList->setModel(model);
     postInit();
 }
 
-void PlatformMainDialog::setHiddenColumns()
-{
-    hiddenColumns << PlatformModel::EmuFrontFileObject_Id;
-    hiddenColumns << PlatformModel::EmuFrontFileObject_FileId;
-    hiddenColumns << PlatformModel::EmuFrontFileObject_FileType;
-    hiddenColumns << PlatformModel::EmuFrontFileObject_FileCheckSum;
-}
+
index 61eef7d..7e0229c 100644 (file)
 #ifndef PLATFORMMAINDIALOG_H
 #define PLATFORMMAINDIALOG_H
 
-#include "emufrontdatadialog.h"
+#include "emufrontfileobjectmaindialog.h"
 
-
-class PlatformMainDialog : public EmuFrontDataDialog
+class PlatformMainDialog : public EmuFrontFileObjectMainDialog
 {
     Q_OBJECT
 public:
     PlatformMainDialog(QWidget *parent = 0);
-private:
-    virtual void setHiddenColumns();
-
   };
 
 #endif // PLATFORMMAINDIALOG_H
index 36f2c9e..e12e98a 100644 (file)
@@ -75,7 +75,10 @@ HEADERS += mainwindow.h \
     dialogs/platformmaindialog.h \
     dialogs/emufrontdatadialog.h \
     db/emufrontquerymodel.h \
-    db/emufrontfileobjectmodel.h
+    db/emufrontfileobjectmodel.h \
+    db/mediatypemodel.h \
+    dialogs/emufrontfileobjectmaindialog.h \
+    dialogs/mediatypemaindialog.h
 SOURCES += main.cpp \
     mainwindow.cpp \
     db/databasemanager.cpp \
@@ -138,7 +141,10 @@ SOURCES += main.cpp \
     dialogs/platformmaindialog.cpp \
     dialogs/emufrontdatadialog.cpp \
     db/emufrontquerymodel.cpp \
-    db/emufrontfileobjectmodel.cpp
+    db/emufrontfileobjectmodel.cpp \
+    db/mediatypemodel.cpp \
+    dialogs/emufrontfileobjectmaindialog.cpp \
+    dialogs/mediatypemaindialog.cpp
 OTHER_FILES +=  
 
 CONFIG += mobility
index eecab39..858aede 100644 (file)
 #include <QtGui>
 #include "mainwindow.h"
 #include "emulauncher.h"
+// TODO: deprecated
 #include "dialogs/platformdialog.h"
 #include "dialogs/platformmaindialog.h"
 #include "dialogs/mediatypedialog.h"
+// TODO: deprecated
+#include "dialogs/mediatypemaindialog.h"
 #include "dialogs/mediaimagepathmaindialog.h"
 #include "dialogs/setupmaindialog.h"
 #include "dialogs/executablemaindialog.h"
@@ -57,8 +60,12 @@ MainWindow::MainWindow(bool reset)
     createMenus();
     createStatusBar();
     readSettings();
+    // TODO: deprecated
     platformDialog = 0;
+    plfDialog = 0;
+    // TODO: deprecated
     mediaTypeDialog = 0;
+    mdtDialog = 0;
     mediaImagePathDialog = 0;
     setupMainDialog = 0;
     executableMainDialog = 0;
@@ -70,6 +77,7 @@ void MainWindow::connectSignals()
 
 void MainWindow::createActions()
 {
+    // TODO: deprecated
     configPlatformAction = new QAction(tr("&Platforms"), this);
     configPlatformAction->setStatusTip(tr("Configure platforms"));
     connect(configPlatformAction, SIGNAL(triggered()),
@@ -80,10 +88,15 @@ void MainWindow::createActions()
     connect(configPlatformsAction, SIGNAL(triggered()),
         this, SLOT(configurePlatformss()));
 
+    // TODO: deprecated
     configMediaTypeAction = new QAction(tr("&Media Types"), this);
     configMediaTypeAction->setStatusTip(tr("Configure media types"));
     connect(configMediaTypeAction, SIGNAL(triggered()), this, SLOT(configureMediaTypes()));
 
+    configMediaTypesAction = new QAction(tr("&Set Media Types"), this);
+    configMediaTypeAction->setStatusTip(tr("Add, edit and delete media types"));
+    connect(configMediaTypesAction, SIGNAL(triggered()), this, SLOT(configureMediaTypess()));
+
     configMediaImagePathAction = new QAction(tr("Media &Image Paths"), this);
     configMediaImagePathAction->setStatusTip(tr("Configure media image file paths."));
     connect(configMediaImagePathAction, SIGNAL(triggered()),
@@ -119,6 +132,7 @@ void MainWindow::createActions()
     connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
 }
 
+// TODO: deprecated
 void MainWindow::configurePlatforms()
 {
    if (!platformDialog)
@@ -131,11 +145,14 @@ void MainWindow::configurePlatforms()
 
 void MainWindow::configurePlatformss()
 {
-    plfDialog = new PlatformMainDialog(this);
-    connect(plfDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
+    if (!plfDialog) {
+        plfDialog = new PlatformMainDialog(this);
+        connect(plfDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
+    }
     activateDialog(plfDialog);
 }
 
+// TODO: deprecated
 void MainWindow::configureMediaTypes()
 {
     if (!mediaTypeDialog)
@@ -146,6 +163,17 @@ void MainWindow::configureMediaTypes()
    activateDialog(mediaTypeDialog);
 }
 
+void MainWindow::configureMediaTypess()
+{
+    if (!mdtDialog)
+    {
+        mdtDialog = new MediaTypeMainDialog(this);
+        connect(mdtDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
+   }
+   activateDialog(mdtDialog);
+}
+
+
 void MainWindow::configureMediaImagePaths()
 {
     if (!mediaImagePathDialog)
@@ -234,9 +262,12 @@ void MainWindow::createMenus()
     configMenu = menuBar()->addMenu(tr("&Config"));
     configMenu->addAction(configTmpDirAction);
     configMenu->addSeparator();
+    // TODO: deprecated
     configMenu->addAction(configPlatformAction);
     configMenu->addAction(configPlatformsAction);
+    // TODO: deprecated
     configMenu->addAction(configMediaTypeAction);
+    configMenu->addAction(configMediaTypesAction);
     configMenu->addAction(configSetupAction);
     configMenu->addAction(configMediaImagePathAction);
     configMenu->addAction(configEmulatorAction);
index 10f2d94..0c824c5 100644 (file)
 #include <QMainWindow>
 
 class QAction;
+// TODO: DEPRECATED
 class PlatformDialog;
 class PlatformMainDialog;
+class MediaTypeMainDialog;
+// TODO: DEPRECATED
 class MediaTypeDialog;
+class MediaTypeMainDialog;
 class MediaImagePathMainDialog;
 class SetupMainDialog;
 class ExecutableMainDialog;
@@ -49,9 +53,12 @@ protected:
        void closeEvent(QCloseEvent *event);
 
 private slots:
+    // TODO: DEPRECATED
     void configurePlatforms();
     void configurePlatformss();
+    // TODO: DEPRECATED
     void configureMediaTypes();
+    void configureMediaTypess();
     void configureMediaImagePaths();
     void configureSetups();
     void configureEmulators();
@@ -74,9 +81,13 @@ private:
     void activateDialog(EmuFrontDialog*) const;
     bool testDB(bool reset);
     void createDB() const;
+
+    // TODO: deprecated
     PlatformDialog *platformDialog;
     PlatformMainDialog *plfDialog;
+    // TODO: deprecated
     MediaTypeDialog *mediaTypeDialog;
+    MediaTypeMainDialog *mdtDialog;
     MediaImagePathMainDialog *mediaImagePathDialog;
     SetupMainDialog *setupMainDialog;
     ExecutableMainDialog *executableMainDialog;
@@ -84,9 +95,12 @@ private:
        QMenu *configMenu;
     QMenu *fileMenu;
     QMenu *helpMenu;
+    // TODO: deprecated
     QAction *configPlatformAction;
     QAction *configPlatformsAction;
+    // TODO: deprecated
     QAction *configMediaTypeAction;
+    QAction *configMediaTypesAction;
     QAction *configMediaImagePathAction;
     QAction *configSetupAction;
     QAction *configEmulatorAction;