From f3a384fe7a02676d2aed68ff9bdb3fa7a2a87165 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mikko=20Kein=C3=A4nen?= Date: Mon, 13 Dec 2010 01:11:33 +0200 Subject: [PATCH] Implemented ExternalExecutableEditView utilising ExternalExecutableModel. Used new view in MainWindow. --- src/emufront.pro | 6 +++-- src/mainwindow.cpp | 21 +++++++++++++++ src/mainwindow.h | 8 ++++++ src/views/externalexecutableeditview.cpp | 42 ++++++++++++++++++++++++++++++ src/views/externalexecutableeditview.h | 39 +++++++++++++++++++++++++++ src/views/filepatheditview.h | 3 ++- 6 files changed, 116 insertions(+), 3 deletions(-) create mode 100644 src/views/externalexecutableeditview.cpp create mode 100644 src/views/externalexecutableeditview.h diff --git a/src/emufront.pro b/src/emufront.pro index 15f1ee3..5be00cb 100644 --- a/src/emufront.pro +++ b/src/emufront.pro @@ -99,7 +99,8 @@ HEADERS += mainwindow.h \ views/filepatheditview.h \ delegates/filesystembrowsedelegate.h \ widgets/filepathselectorwidget.h \ - models/externalexecutablemodel.h + models/externalexecutablemodel.h \ + views/externalexecutableeditview.h SOURCES += main.cpp \ mainwindow.cpp \ db/databasemanager.cpp \ @@ -174,7 +175,8 @@ SOURCES += main.cpp \ views/filepatheditview.cpp \ delegates/filesystembrowsedelegate.cpp \ widgets/filepathselectorwidget.cpp \ - models/externalexecutablemodel.cpp + models/externalexecutablemodel.cpp \ + views/externalexecutableeditview.cpp OTHER_FILES += CONFIG += mobility diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b59ea3b..0d6c0a3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -33,7 +33,9 @@ // TODO: deprecated #include "setupmaindialog.h" #include "setupeditview.h" +// TODO: deprecated #include "executablemaindialog.h" +#include "externalexecutableeditview.h" #include "datfileutil.h" #include "databasemanager.h" #include "dbcreator.h" @@ -77,7 +79,9 @@ MainWindow::MainWindow(bool reset) // TODO: deprecated setupMainDialog = 0; setupMainView = 0; + // TODO: deprecated executableMainDialog = 0; + emulatorEditView = 0; } void MainWindow::connectSignals() @@ -130,6 +134,11 @@ void MainWindow::createActions() configEmulatorAction->setStatusTip(tr("Configure emulators")); connect(configEmulatorAction, SIGNAL(triggered()), this, SLOT(configureEmulators())); + configEmulatorsAction = new QAction(tr("Configure Em&ulators"), this); + configEmulatorsAction->setStatusTip(tr("Add, edit and delete emulator configurations")); + connect(configEmulatorsAction, SIGNAL(triggered()), this, SLOT(configureEmulatorss())); + + configTmpDirAction = new QAction(tr("&Temp dir"), this); configTmpDirAction->setStatusTip(tr("Configure directory for temporary files.")); connect(configTmpDirAction, SIGNAL(triggered()), this, SLOT(configureTmpDir())); @@ -233,6 +242,7 @@ void MainWindow::configureSetupss() } +// TODO: deprecated void MainWindow::configureEmulators() { if (!executableMainDialog) { @@ -243,6 +253,15 @@ void MainWindow::configureEmulators() executableMainDialog->refreshDataModel(); } +void MainWindow::configureEmulatorss() +{ + if (!emulatorEditView) { + emulatorEditView = new ExternalExecutableEditView(this); + connect(emulatorEditView, SIGNAL(finished(int)), this, SLOT(updateData())); + } + activateDialog(emulatorEditView); +} + void MainWindow::configureTmpDir() { /*if (!tmpFolderDialog) { @@ -313,7 +332,9 @@ void MainWindow::createMenus() // TODO: DEPRECATED configMenu->addAction(configMediaImagePathAction); configMenu->addAction(configMediaImagePathsAction); + // TODO: DEPRECATED configMenu->addAction(configEmulatorAction); + configMenu->addAction(configEmulatorsAction); configMenu->addSeparator(); configMenu->addAction(manageDatFilesAction); diff --git a/src/mainwindow.h b/src/mainwindow.h index eb6d2b2..e2a102b 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -36,7 +36,9 @@ class FilePathEditView; // TODO: DEPRECATED class SetupMainDialog; class SetupEditView; +// TODO: DEPRECATED class ExecutableMainDialog; +class ExternalExecutableEditView; //class TmpFolderEditDialog; class QLabel; class DatabaseManager; @@ -69,7 +71,9 @@ private slots: // TODO: DEPRECATED void configureSetups(); void configureSetupss(); + // TODO: DEPRECATED void configureEmulators(); + void configureEmulatorss(); void configureTmpDir(); void resetDb(); void updateData(); @@ -102,7 +106,9 @@ private: // TODO: deprecated SetupMainDialog *setupMainDialog; SetupEditView *setupMainView; + // TODO: deprecated ExecutableMainDialog *executableMainDialog; + ExternalExecutableEditView *emulatorEditView; //TmpFolderEditDialog *tmpFolderDialog; QMenu *configMenu; QMenu *fileMenu; @@ -119,7 +125,9 @@ private: // TODO: deprecated QAction *configSetupAction; QAction *configSetupsAction; + // TODO: deprecated QAction *configEmulatorAction; + QAction *configEmulatorsAction; QAction *exitAction; QAction *resetDbAction; QAction *aboutAction; diff --git a/src/views/externalexecutableeditview.cpp b/src/views/externalexecutableeditview.cpp new file mode 100644 index 0000000..6d1c504 --- /dev/null +++ b/src/views/externalexecutableeditview.cpp @@ -0,0 +1,42 @@ +/* +** 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 . +*/ + +#include "externalexecutableeditview.h" +#include "externalexecutablemodel.h" +#include "setupmodel.h" +#include "comboboxdelegate.h" +#include + +ExternalExecutableEditView::ExternalExecutableEditView(QWidget *parent) : + EmuFrontEditView(parent) +{ + model = new ExternalExecutableModel(this); + objectList->setModel(model); + SetupModel *stupMdl = new SetupModel(this); + ComboBoxDelegate *setupDelegate = new ComboBoxDelegate( + stupMdl, + SetupModel::Setup_Id, + SetupModel::Setup_Name, + this + ); + objectList->setItemDelegateForColumn(ExternalExecutableModel::Executable_SetupId, setupDelegate); + postInit(); +} diff --git a/src/views/externalexecutableeditview.h b/src/views/externalexecutableeditview.h new file mode 100644 index 0000000..a01ce79 --- /dev/null +++ b/src/views/externalexecutableeditview.h @@ -0,0 +1,39 @@ +/* +** 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 . +*/ + +#ifndef EXTERNALEXECUTABLEEDITVIEW_H +#define EXTERNALEXECUTABLEEDITVIEW_H + +#include "emufronteditview.h" + +class ExternalExecutableEditView : public EmuFrontEditView +{ + Q_OBJECT +public: + explicit ExternalExecutableEditView(QWidget *parent = 0); + +signals: + +public slots: + +}; + +#endif // EXTERNALEXECUTABLEEDITVIEW_H diff --git a/src/views/filepatheditview.h b/src/views/filepatheditview.h index 616b3cc..60cd4f9 100644 --- a/src/views/filepatheditview.h +++ b/src/views/filepatheditview.h @@ -17,7 +17,8 @@ ** ** You should have received a copy of the GNU General Public License ** along with EmuFront. If not, see . -*/#ifndef FILEPATHEDITVIEW_H +*/ +#ifndef FILEPATHEDITVIEW_H #define FILEPATHEDITVIEW_H #include "emufronteditview.h" -- 1.7.9.5