EternalExecutableModel is shared between views.
authorMikko Keinänen <mikko.keinanen@gmail.com>
Fri, 17 Dec 2010 21:26:54 +0000 (23:26 +0200)
committerMikko Keinänen <mikko.keinanen@gmail.com>
Fri, 17 Dec 2010 21:26:54 +0000 (23:26 +0200)
src/emulauncher.cpp
src/emulauncher.h
src/mainwindow.cpp
src/mainwindow.h
src/views/externalexecutableeditview.cpp
src/views/externalexecutableeditview.h

index 1529b71..077b539 100644 (file)
@@ -27,7 +27,6 @@
 #include "setup.h"
 #include "setupmodel.h"
 #include "externalexecutablemodel.h"
-//#include "dbmediaimagecontainer.h"
 #include "mediaimagecontainer.h"
 #include "mediaimagecontainermodel.h"
 #include "effileobjectcombobox.h"
@@ -36,8 +35,9 @@
 #include "emuhelper.h"
 #include "emufrontinputdialog.h"
 
-EmuLauncher::EmuLauncher(QErrorMessage *errorMessage, SetupModel *supModel, QWidget *parent, QString tmp) :
-    QWidget(parent), supModel(supModel), tmpDirPath(tmp), errorMessage(errorMessage)
+EmuLauncher::EmuLauncher(QErrorMessage *errorMessage, SetupModel *supModel, ExternalExecutableModel
+               *emuModel, QWidget *parent, QString tmp) :
+    QWidget(parent), supModel(supModel), emuModel(emuModel), tmpDirPath(tmp), errorMessage(errorMessage)
 {
     emuHelper = new EmuHelper(this);
     initWidgets();
@@ -60,8 +60,6 @@ void EmuLauncher::updateData()
     qDebug() << "EmuLauncher::updateData";
     micModel->refresh();
     emuModel->refresh();
-    supModel->refresh();
-    //setupSelectBox->update();
 }
 
 void EmuLauncher::initWidgets()
@@ -80,7 +78,7 @@ void EmuLauncher::initWidgets()
     setupSelectBox->setModel(supModel);
     setupSelectBox->setModelColumn(SetupModel::Setup_Name);
 
-    emuModel = new ExternalExecutableModel(this);
+    //emuModel = new ExternalExecutableModel(this);
     execSelectBox = new QComboBox(this);
     execSelectBox->setModel(emuModel);
     execSelectBox->setModelColumn(ExternalExecutableModel::Executable_Name);
index 1c6c081..6e0bf11 100644 (file)
@@ -29,7 +29,6 @@ class QTableView;
 class QPushButton;
 class QComboBox;
 class QErrorMessage;
-//class DbMediaImageContainer;
 class Executable;
 class MediaImageContainer;
 class EmuHelper;
@@ -41,7 +40,9 @@ class EmuLauncher : public QWidget
 {
 Q_OBJECT
 public:
-    EmuLauncher(QErrorMessage *, SetupModel *supModel, QWidget *parent = 0, QString tmp = ".");
+    EmuLauncher(QErrorMessage *, SetupModel *supModel, 
+                       ExternalExecutableModel *emuModel, 
+                       QWidget *parent = 0, QString tmp = ".");
     ~EmuLauncher();
     void updateData();
     void setTmpDirPath(QString);
@@ -60,7 +61,6 @@ private:
     QComboBox *execSelectBox;
     QPushButton *selectButton;
     QPushButton *launchButton;
-    //DbMediaImageContainer *dbMic;
     EmuHelper *emuHelper;
     void initWidgets();
     void layout();
index c06633d..2259cf2 100644 (file)
@@ -18,6 +18,7 @@
 ** 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 "mainwindow.h"
 #include "emulauncher.h"
@@ -35,6 +36,7 @@
 // TODO: deprecated
 //#include "executablemaindialog.h"
 #include "externalexecutableeditview.h"
+#include "externalexecutablemodel.h"
 #include "datfileutil.h"
 #include "databasemanager.h"
 #include "dbcreator.h"
@@ -62,7 +64,8 @@ MainWindow::MainWindow(bool reset)
         tmpDirFilePath = QDir::homePath();
     qDebug() << "Temporary dir is " << tmpDirFilePath;
     supModel = new SetupModel(this);
-    launcher = new EmuLauncher(errorMessage, supModel, this, tmpDirFilePath);
+       emuModel = new ExternalExecutableModel(this);
+    launcher = new EmuLauncher(errorMessage, supModel, emuModel, this, tmpDirFilePath);
     setCentralWidget(launcher);
     createActions();
     createMenus();
@@ -259,8 +262,8 @@ void MainWindow::configureSetupss()
 void MainWindow::configureEmulatorss()
 {
     if (!emulatorEditView) {
-        emulatorEditView = new ExternalExecutableEditView(this);
-        connect(emulatorEditView, SIGNAL(finished(int)), this, SLOT(updateData()));
+        emulatorEditView = new ExternalExecutableEditView(emuModel, this);
+        //connect(emulatorEditView, SIGNAL(finished(int)), this, SLOT(updateData()));
     }
     activateDialog(emulatorEditView);
 }
index 3a56a9b..d417693 100644 (file)
@@ -1,5 +1,4 @@
-/*
-** EmuFront
+/* ** EmuFront
 ** Copyright 2010 Mikko Keinänen
 **
 ** This file is part of EmuFront.
@@ -17,7 +16,9 @@
 **
 ** You should have received a copy of the GNU General Public License
 ** along with EmuFront.  If not, see <http://www.gnu.org/licenses/>.
-*/#ifndef MAINWINDOW_H
+*/
+
+#ifndef MAINWINDOW_H
 #define MAINWINDOW_H
 
 #include <QMainWindow>
@@ -47,6 +48,7 @@ class EmuLauncher;
 class DatFileUtil;
 class QErrorMessage;
 class SetupModel;
+class ExternalExecutableModel;
 
 class MainWindow : public QMainWindow
 {
@@ -140,6 +142,7 @@ private:
     QString tmpDirFilePath;
     QErrorMessage *errorMessage;
     SetupModel *supModel;
+       ExternalExecutableModel *emuModel;
 };
 
 #endif
index 6d1c504..559de59 100644 (file)
 #include "comboboxdelegate.h"
 #include <QtGui>
 
-ExternalExecutableEditView::ExternalExecutableEditView(QWidget *parent) :
+ExternalExecutableEditView::ExternalExecutableEditView(ExternalExecutableModel *emuModel, QWidget *parent) :
     EmuFrontEditView(parent)
 {
-    model = new ExternalExecutableModel(this);
+    model = emuModel; // new ExternalExecutableModel(this);
     objectList->setModel(model);
     SetupModel *stupMdl = new SetupModel(this);
     ComboBoxDelegate *setupDelegate = new ComboBoxDelegate(
index a01ce79..b332b4a 100644 (file)
 
 #include "emufronteditview.h"
 
+class ExternalExecutableModel;
 class ExternalExecutableEditView : public EmuFrontEditView
 {
     Q_OBJECT
 public:
-    explicit ExternalExecutableEditView(QWidget *parent = 0);
-
-signals:
-
-public slots:
-
+    ExternalExecutableEditView(ExternalExecutableModel *emuModel, QWidget *parent = 0);
 };
 
 #endif // EXTERNALEXECUTABLEEDITVIEW_H