Initial implementation for set up main dialog (warning: not functional
authorMikko Keinänen <mikko.keinanen@gmail.com>
Mon, 7 Jun 2010 21:48:05 +0000 (00:48 +0300)
committerMikko Keinänen <mikko.keinanen@gmail.com>
Mon, 7 Jun 2010 21:48:05 +0000 (00:48 +0300)
yet)

src/dialogs/setupmaindialog.cpp [new file with mode: 0644]
src/dialogs/setupmaindialog.h [new file with mode: 0644]
src/emufront.pro
src/mainwindow.cpp
src/mainwindow.h

diff --git a/src/dialogs/setupmaindialog.cpp b/src/dialogs/setupmaindialog.cpp
new file mode 100644 (file)
index 0000000..3bc0b76
--- /dev/null
@@ -0,0 +1,52 @@
+// 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 as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Foobar 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
+
+#include <QtGui>
+#include "setupmaindialog.h"
+#include "../db/dbsetup.h"
+
+SetupMainDialog::SetupMainDialog(QWidget *parent)
+    : DbObjectDialog(parent)
+{
+    setWindowTitle(tr("Setups"));
+    //nameDialog = new SetupEditor(this, dynamic_cast<Setup*>(dbObject));
+    dbManager = new DbSetup(this);
+    initDataTable();
+    connectSignals();
+}
+
+SetupMainDialog::~SetupMainDialog()
+{
+    deleteCurrentObject();
+}
+
+void SetupMainDialog::deleteCurrentObject()
+{
+   delete dynamic_cast<Setup*>(dbObject);
+   dbObject = 0;
+}
+
+EmuFrontObject* SetupMainDialog::createObject()
+{
+    return new Setup;
+}
+
+/*void SetupMainDialog::connectSignals()
+{
+}*/
diff --git a/src/dialogs/setupmaindialog.h b/src/dialogs/setupmaindialog.h
new file mode 100644 (file)
index 0000000..733cef5
--- /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 as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Foobar 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef SETUPMAINDIALOG_H
+#define SETUPMAINDIALOG_H
+
+#include "dbobjectdialog.h"
+
+class SetupMainDialog : public DbObjectDialog
+{
+    Q_OBJECT
+
+public:
+    SetupMainDialog(QWidget *parent);
+    ~SetupMainDialog();
+
+protected:
+    virtual void deleteCurrentObject();
+    virtual EmuFrontObject* createObject();
+    //virtual void connectSignals();
+
+};
+
+#endif // SETUPMAINDIALOG_H
index 8169cd1..a634a46 100644 (file)
@@ -39,7 +39,8 @@ HEADERS += mainwindow.h \
     dataobjects/setup.h \
     db/dbsetup.h \
     db/dbtablemodelmanager.h \
-    db/dbquerymodelmanager.h
+    db/dbquerymodelmanager.h \
+    dialogs/setupmaindialog.h
 SOURCES += main.cpp \
     mainwindow.cpp \
     db/databasemanager.cpp \
@@ -68,6 +69,7 @@ SOURCES += main.cpp \
     dataobjects/setup.cpp \
     db/dbsetup.cpp \
     db/dbtablemodelmanager.cpp \
-    db/dbquerymodelmanager.cpp
+    db/dbquerymodelmanager.cpp \
+    dialogs/setupmaindialog.cpp
 
 OTHER_FILES +=
index 5605e25..8dd333f 100644 (file)
@@ -22,6 +22,7 @@
 #include "dialogs/platformdialog.h"
 #include "dialogs/mediatypedialog.h"
 #include "dialogs/mediaimagepathmaindialog.h"
+#include "dialogs/setupmaindialog.h"
 #include "db/databasemanager.h"
 
 MainWindow::MainWindow()
@@ -52,6 +53,10 @@ void MainWindow::createActions()
     connect(configMediaImagePathAction, SIGNAL(triggered()),
         this, SLOT(configureMediaImagePaths()));
 
+    configSetupAction = new QAction(tr("S&etups"), this);
+    configSetupAction->setStatusTip(tr("Configure set ups"));
+    connect(configSetupAction, SIGNAL(triggered()), this, SLOT(configureSetups()));
+
     exitAction = new QAction(tr("&Exit"), this);
     exitAction->setShortcut(tr("Ctrl+Q"));
     exitAction->setStatusTip(tr("Exit EmuFront"));
@@ -85,6 +90,15 @@ void MainWindow::configureMediaImagePaths()
     activateDialog(mediaImagePathDialog);
 }
 
+void MainWindow::configureSetups()
+{
+    if (!setupMainDialog)
+    {
+        setupMainDialog = new SetupMainDialog(this);
+    }
+    activateDialog(setupMainDialog);
+}
+
 void MainWindow::activateDialog(EmuFrontDialog* dia) const
 {
     dia->show();
@@ -92,7 +106,6 @@ void MainWindow::activateDialog(EmuFrontDialog* dia) const
     dia->activateWindow();
 }
 
-
 void MainWindow::createMenus()
 {
     fileMenu = menuBar()->addMenu(tr("&File"));
@@ -102,6 +115,7 @@ void MainWindow::createMenus()
     configMenu->addAction(configPlatformAction);
     configMenu->addAction(configMediaTypeAction);
     configMenu->addAction(configMediaImagePathAction);
+    configMenu->addAction(configSetupAction);
 }
 
 void MainWindow::createStatusBar()
index f9cfca0..2ff7c37 100644 (file)
@@ -26,6 +26,7 @@ class QAction;
 class PlatformDialog;
 class MediaTypeDialog;
 class MediaImagePathMainDialog;
+class SetupMainDialog;
 class QLabel;
 class DatabaseManager;
 class EmuFrontDialog;
@@ -45,6 +46,7 @@ private slots:
        void configurePlatforms();
     void configureMediaTypes();
     void configureMediaImagePaths();
+    void configureSetups();
 
 private:
        void createActions();
@@ -57,11 +59,13 @@ private:
        PlatformDialog *platformDialog;
     MediaTypeDialog *mediaTypeDialog;
     MediaImagePathMainDialog *mediaImagePathDialog;
+    SetupMainDialog *setupMainDialog;
        QMenu *configMenu;
        QMenu *fileMenu;
     QAction *configPlatformAction;
     QAction *configMediaTypeAction;
     QAction *configMediaImagePathAction;
+    QAction *configSetupAction;
     QAction *exitAction;
        QLabel *messageLabel;
     DatabaseManager *dbManager;