Initial implementation for FilePathEditView (using FilePathModel).
authorMikko Keinänen <mikko.keinanen@gmail.com>
Thu, 9 Dec 2010 21:21:24 +0000 (23:21 +0200)
committerMikko Keinänen <mikko.keinanen@gmail.com>
Thu, 9 Dec 2010 21:21:24 +0000 (23:21 +0200)
src/emufront.pro
src/mainwindow.cpp
src/mainwindow.h
src/models/filepathmodel.cpp
src/views/filepatheditview.cpp [new file with mode: 0644]
src/views/filepatheditview.h [new file with mode: 0644]

index 05e129d..aef4bef 100644 (file)
@@ -95,7 +95,8 @@ HEADERS += mainwindow.h \
     views/emufronteditview.h \
     delegates/comboboxdelegate.h \
     delegates/stringlistdelegate.h \
-    models/filepathmodel.h
+    models/filepathmodel.h \
+    views/filepatheditview.h
 SOURCES += main.cpp \
     mainwindow.cpp \
     db/databasemanager.cpp \
@@ -166,7 +167,8 @@ SOURCES += main.cpp \
     views/emufronteditview.cpp \
     delegates/comboboxdelegate.cpp \
     delegates/stringlistdelegate.cpp \
-    models/filepathmodel.cpp
+    models/filepathmodel.cpp \
+    views/filepatheditview.cpp
 OTHER_FILES +=  
 
 CONFIG += mobility
index 7021e36..b3b9717 100644 (file)
@@ -26,7 +26,9 @@
 #include "mediatypedialog.h"
 // TODO: deprecated
 #include "mediatypeeditview.h"
+// TODO: DEPRECATED
 #include "mediaimagepathmaindialog.h"
+#include "filepatheditview.h"
 // TODO: deprecated
 #include "setupmaindialog.h"
 #include "setupeditview.h"
@@ -68,7 +70,9 @@ MainWindow::MainWindow(bool reset)
     // TODO: deprecated
     mediaTypeDialog = 0;
     mdtDialog = 0;
+    // TODO: DEPRECATED
     mediaImagePathDialog = 0;
+    mediaImagePathView = 0;
     // TODO: deprecated
     setupMainDialog = 0;
     setupMainView = 0;
@@ -101,11 +105,17 @@ void MainWindow::createActions()
     configMediaTypeAction->setStatusTip(tr("Add, edit and delete media types"));
     connect(configMediaTypesAction, SIGNAL(triggered()), this, SLOT(configureMediaTypess()));
 
+    // TODO: DEPRECATED
     configMediaImagePathAction = new QAction(tr("Media &Image Paths"), this);
     configMediaImagePathAction->setStatusTip(tr("Configure media image file paths."));
     connect(configMediaImagePathAction, SIGNAL(triggered()),
         this, SLOT(configureMediaImagePaths()));
 
+    configMediaImagePathsAction = new QAction(tr("Set media &image paths"), this);
+    configMediaImagePathsAction->setStatusTip(tr("Add, edit and delete media image file paths."));
+    connect(configMediaImagePathsAction, SIGNAL(triggered()),
+        this, SLOT(configureMediaImagePathss()));
+
     // TODO: deprecated
     configSetupAction = new QAction(tr("S&etups"), this);
     configSetupAction->setStatusTip(tr("Configure set ups"));
@@ -183,6 +193,7 @@ void MainWindow::configureMediaTypess()
 }
 
 
+// TODO: DEPRECATED
 void MainWindow::configureMediaImagePaths()
 {
     if (!mediaImagePathDialog)
@@ -192,6 +203,15 @@ void MainWindow::configureMediaImagePaths()
     activateDialog(mediaImagePathDialog);
 }
 
+void MainWindow::configureMediaImagePathss()
+{
+    if (!mediaImagePathView)
+    {
+        mediaImagePathView = new FilePathEditView(this);
+    }
+    activateDialog(mediaImagePathView);
+}
+
 // TODO: deprecated
 void MainWindow::configureSetups()
 {
@@ -289,7 +309,9 @@ void MainWindow::createMenus()
     // TODO: deprecated
     configMenu->addAction(configSetupAction);
     configMenu->addAction(configSetupsAction);
+    // TODO: DEPRECATED
     configMenu->addAction(configMediaImagePathAction);
+    configMenu->addAction(configMediaImagePathsAction);
     configMenu->addAction(configEmulatorAction);
     configMenu->addSeparator();
     configMenu->addAction(manageDatFilesAction);
index 17addb0..9d92d95 100644 (file)
@@ -30,7 +30,9 @@ class MediaTypeEditView;
 // TODO: DEPRECATED
 class MediaTypeDialog;
 class MediaTypeEditView;
+// TODO: DEPRECATED
 class MediaImagePathMainDialog;
+class FilePathEditView;
 // TODO: DEPRECATED
 class SetupMainDialog;
 class SetupEditView;
@@ -61,7 +63,9 @@ private slots:
     // TODO: DEPRECATED
     void configureMediaTypes();
     void configureMediaTypess();
+    // TODO: DEPRECATED
     void configureMediaImagePaths();
+    void configureMediaImagePathss();
     // TODO: DEPRECATED
     void configureSetups();
     void configureSetupss();
@@ -92,7 +96,9 @@ private:
     // TODO: deprecated
     MediaTypeDialog *mediaTypeDialog;
     MediaTypeEditView *mdtDialog;
+    // TODO: DEPRECATED
     MediaImagePathMainDialog *mediaImagePathDialog;
+    FilePathEditView *mediaImagePathView;
     // TODO: deprecated
     SetupMainDialog *setupMainDialog;
     SetupEditView *setupMainView;
@@ -107,7 +113,9 @@ private:
     // TODO: deprecated
     QAction *configMediaTypeAction;
     QAction *configMediaTypesAction;
+    // TODO: DEPRECATED
     QAction *configMediaImagePathAction;
+    QAction *configMediaImagePathsAction;
     // TODO: deprecated
     QAction *configSetupAction;
     QAction *configSetupsAction;
index 5e3fae0..b863047 100644 (file)
@@ -28,8 +28,12 @@ FilePathModel::FilePathModel(QObject *parent) :
 
 void FilePathModel::refresh()
 {
-
-    // TODO
+    setQuery(constructSelect());
+    setHeaderData(FilePath_Id, Qt::Horizontal, tr("Id"));
+    setHeaderData(FilePath_Name, Qt::Horizontal, tr("Name"));
+    setHeaderData(FilePath_LastScanned, Qt::Horizontal, tr("Last scanned"));
+    setHeaderData(FilePath_SetupId, Qt::Horizontal, tr("Set up id"));
+    setHeaderData(FilePath_SetupName, Qt::Horizontal, tr("Set up"));
 }
 
 QString FilePathModel::constructSelect(QString where) const
diff --git a/src/views/filepatheditview.cpp b/src/views/filepatheditview.cpp
new file mode 100644 (file)
index 0000000..fe41d47
--- /dev/null
@@ -0,0 +1,40 @@
+// 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 "filepatheditview.h"
+#include "filepathmodel.h"
+#include "setupmodel.h"
+#include "comboboxdelegate.h"
+#include <QtGui>
+
+FilePathEditView::FilePathEditView(QWidget *parent) :
+    EmuFrontEditView(parent)
+{
+    model = new FilePathModel(this);
+    objectList->setModel(model);
+    /*SetupModel *stupMdl = new SetupModel(this);
+    ComboBoxDelegate *setupDelegate = new ComboBoxDelegate(
+        stupMdl,
+        SetupModel::Setup_Id,
+        SetupModel::Setup_Name,
+        this
+    );
+    objectList->setItemDelegateForColumn(FilePathModel::FilePath_SetupId, setupDelegate);*/
+    postInit();
+}
diff --git a/src/views/filepatheditview.h b/src/views/filepatheditview.h
new file mode 100644 (file)
index 0000000..273768a
--- /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 FILEPATHEDITVIEW_H
+#define FILEPATHEDITVIEW_H
+
+#include "emufronteditview.h"
+
+class FilePathEditView : public EmuFrontEditView
+{
+    Q_OBJECT
+public:
+    FilePathEditView(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // FILEPATHEDITVIEW_H