PlatformModel and MediaTypeModel instances are shared from MainWindow.
authorMikko Keinänen <mikko.keinanen@gmail.com>
Sun, 19 Dec 2010 22:51:38 +0000 (00:51 +0200)
committerMikko Keinänen <mikko.keinanen@gmail.com>
Sun, 19 Dec 2010 22:51:38 +0000 (00:51 +0200)
doc/tests.txt
src/mainwindow.cpp
src/mainwindow.h
src/views/mediatypeeditview.cpp
src/views/mediatypeeditview.h
src/views/platformeditview.cpp
src/views/platformeditview.h
src/views/setupeditview.cpp
src/views/setupeditview.h

index 93af1c3..cbee2ca 100644 (file)
@@ -1,5 +1,5 @@
 1. Start EmuFront
------------------
+=================
 - if database already exists move/remove it:
 
        $ mv ~/emufront.db.sqlite ~/emufront.db.sqlite.bak
        > empty area for filtered media image containers is shown
 
 2. Set temporary directory
---------------------------
+==========================
 - Select 'Config->Temp dir'
 > A file selector is opened, only folders can be selected
 - Select a folder
 > A messagebox is shown telling that the Temporary directory has been updated to selected folder.
 
 3. Platform
------------
+===========
 
 3.1 Open platform editor
 ------------------------
@@ -200,7 +200,41 @@ Add a four platforms according to instructions in part 3.2
 > Platform was removed from the table view
 
 4. Media Types
---------------
+==============
+
+5. Setups
+=========
+
+Delete all the platforms and media types first.
+
+5.1 Open setup editor
+---------------------
+- Select 'Config->Configure setups'
+> New view is opened with a title describing about setting setups 
+       > 'Add' and 'OK' buttons active
+       > 'Edit' and 'Delete' buttons disabled
+
+5.2 Add setup
+-------------
+
+5.2.1 Add setup with no platforms and media types configured
+------------------------------------------------------------
+- Click Add button
+> 
+
+5.2.2 Add setup with no platforms configured
+--------------------------------------------
+
+5.2.3 Add setup with no media types configured
+----------------------------------------------
+
+5.2.3 Add setup with a single media type and a single platform configured
+-------------------------------------------------------------------------
+
+5.2.3 Add setup with multiple media types and platforms configured
+------------------------------------------------------------------
+
+
 
 
 
index 7f530ac..dda730e 100644 (file)
@@ -42,6 +42,8 @@
 #include "dbcreator.h"
 #include "dbconfig.h"
 #include "setupmodel.h"
+#include "platformmodel.h"
+#include "mediatypemodel.h"
 
 QString MainWindow::aboutStr = trUtf8(
         "<h2>EmuFront</h2>"
@@ -64,6 +66,8 @@ MainWindow::MainWindow(bool reset)
         tmpDirFilePath = QDir::homePath();
     qDebug() << "Temporary dir is " << tmpDirFilePath;
     supModel = new SetupModel(this);
+    plfModel = new PlatformModel(this);
+    mdtModel = new MediaTypeModel(this);
        emuModel = new ExternalExecutableModel(this);
     launcher = new EmuLauncher(errorMessage, supModel, emuModel, this, tmpDirFilePath);
     setCentralWidget(launcher);
@@ -179,7 +183,7 @@ void MainWindow::createActions()
 void MainWindow::configurePlatformss()
 {
     if (!plfDialog) {
-        plfDialog = new PlatformEditView(this);
+        plfDialog = new PlatformEditView(plfModel, this);
         connect(plfDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
     }
     activateDialog(plfDialog);
@@ -200,7 +204,7 @@ void MainWindow::configureMediaTypess()
 {
     if (!mdtDialog)
     {
-        mdtDialog = new MediaTypeEditView(this);
+        mdtDialog = new MediaTypeEditView(mdtModel, this);
         connect(mdtDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
    }
    activateDialog(mdtDialog);
@@ -239,10 +243,8 @@ void MainWindow::configureMediaImagePathss()
 
 void MainWindow::configureSetupss()
 {
-    //TODO: maybe a common setup model in MainWindow, so the data would be in sync without refresh with updateData!
     if (!setupMainView) {
-        setupMainView = new SetupEditView(supModel, this);
-        //connect(setupMainView, SIGNAL(finished(int)), this, SLOT(updateData()));
+        setupMainView = new SetupEditView(plfModel, mdtModel, supModel, this);
     }
     activateDialog(setupMainView);
 }
index d417693..2b6ff4a 100644 (file)
@@ -49,6 +49,8 @@ class DatFileUtil;
 class QErrorMessage;
 class SetupModel;
 class ExternalExecutableModel;
+class PlatformModel;
+class MediaTypeModel;
 
 class MainWindow : public QMainWindow
 {
@@ -142,7 +144,9 @@ private:
     QString tmpDirFilePath;
     QErrorMessage *errorMessage;
     SetupModel *supModel;
-       ExternalExecutableModel *emuModel;
+    ExternalExecutableModel *emuModel;
+    PlatformModel *plfModel;
+    MediaTypeModel *mdtModel;
 };
 
 #endif
index 39dc81f..5e4aa7d 100644 (file)
 #include "mediatypeeditview.h"
 #include "mediatypemodel.h"
 
-MediaTypeEditView::MediaTypeEditView(QWidget *parent) :
+MediaTypeEditView::MediaTypeEditView(MediaTypeModel *mdtModel, QWidget *parent) :
     EmuFrontFileObjectEditView(parent)
 {
     setWindowTitle(tr("Set media types"));
-    model = new MediaTypeModel(this);
+    model = mdtModel;
     objectList->setModel(model);
     postInit();
 }
index abdcc7d..03daffd 100644 (file)
 
 #include "emufrontfileobjecteditview.h"
 
+class MediaTypeModel;
+
 class MediaTypeEditView : public EmuFrontFileObjectEditView
 {
     Q_OBJECT
 public:
-    MediaTypeEditView(QWidget *parent = 0);
+    MediaTypeEditView(MediaTypeModel *mdtModel, QWidget *parent = 0);
 };
 
 #endif // MEDIATYPEMAINDIALOG_H
index efc4fbb..73acc81 100644 (file)
 ** 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) :
+PlatformEditView::PlatformEditView(PlatformModel *plfModel, QWidget *parent) :
     EmuFrontFileObjectEditView(parent)
 {
     setWindowTitle(tr("Set emulated platforms"));
-    model = new PlatformModel(this);
+    model = plfModel;
     objectList->setModel(model);
     postInit();
 }
index 6636206..6c25d8b 100644 (file)
 **
 ** 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
+*/
+
+#ifndef PLATFORMMAINDIALOG_H
 #define PLATFORMMAINDIALOG_H
 
 #include "emufrontfileobjecteditview.h"
 
+class PlatformModel;
+
 class PlatformEditView : public EmuFrontFileObjectEditView
 {
     Q_OBJECT
 public:
-    PlatformEditView(QWidget *parent = 0);
+    PlatformEditView(PlatformModel *plfModel, QWidget *parent = 0);
   };
 
 #endif // PLATFORMMAINDIALOG_H
index 900ee22..fc461ab 100644 (file)
 #include "mediatypemodel.h"
 #include <QSqlTableModel>
 
-SetupEditView::SetupEditView(SetupModel *supModel, QWidget *parent) :
-    EmuFrontEditView(parent)//, model(supModel)
+SetupEditView::SetupEditView(PlatformModel *plfModel, MediaTypeModel *mdtModel, SetupModel *supModel, QWidget *parent) :
+    EmuFrontEditView(parent), plfModel(plfModel), mdtModel(mdtModel)
 {
     setWindowTitle(tr("Setups"));
     model = supModel;
-    //model = new SetupModel(this);
     objectList->setModel(model);
-    PlatformModel *plfModel = new PlatformModel(this);
     ComboBoxDelegate *platformDelegate = new ComboBoxDelegate(
             plfModel,
             PlatformModel::EmuFrontFileObject_Id,
@@ -42,7 +40,6 @@ SetupEditView::SetupEditView(SetupModel *supModel, QWidget *parent) :
             this
         );
     objectList->setItemDelegateForColumn(SetupModel::Setup_PlatformId, platformDelegate);
-    MediaTypeModel *mdtModel = new MediaTypeModel(this);
     ComboBoxDelegate *mediatypeDelegate = new ComboBoxDelegate(
             mdtModel,
             MediaTypeModel::EmuFrontFileObject_Id,
index 7bbac29..b12d128 100644 (file)
 
 #include "emufronteditview.h"
 
+class PlatformModel;
+class MediaTypeModel;
 class SetupModel;
 
 class SetupEditView : public EmuFrontEditView
 {
     Q_OBJECT
 public:
-    SetupEditView(SetupModel *supModel, QWidget *parent = 0);
+    SetupEditView(PlatformModel *plfModel, MediaTypeModel *mdtModel, SetupModel *supModel, QWidget *parent = 0);
 
 signals:
 
 public slots:
 
 private:
-
+    PlatformModel *plfModel;
+    MediaTypeModel *mdtModel;
 };
 
 #endif // SETUPMAINVIEW_H