//
//
// 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.
+// 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.
//
-// Foobar is distributed in the hope that it will be useful,
+// 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+// along with EmuFront. If not, see <http://www.gnu.org/licenses/>.
#include <QtGui>
#include "mainwindow.h"
+#include "emulauncher.h"
#include "dialogs/platformdialog.h"
#include "dialogs/mediatypedialog.h"
+#include "dialogs/mediaimagepathmaindialog.h"
+#include "dialogs/setupmaindialog.h"
+#include "dialogs/executablemaindialog.h"
#include "db/databasemanager.h"
MainWindow::MainWindow()
{
setWindowTitle("EmuFront");
+ launcher = new EmuLauncher(this);
+ setCentralWidget(launcher);
createActions();
createMenus();
createStatusBar();
readSettings();
platformDialog = 0;
mediaTypeDialog = 0;
+ mediaImagePathDialog = 0;
+ setupMainDialog = 0;
+ executableMainDialog = 0;
+ connectSignals();
+}
+
+void MainWindow::connectSignals()
+{
}
void MainWindow::createActions()
configMediaTypeAction->setStatusTip(tr("Configure media types"));
connect(configMediaTypeAction, SIGNAL(triggered()), this, SLOT(configureMediaTypes()));
+ configMediaImagePathAction = new QAction(tr("Media &Image Paths"), this);
+ configMediaImagePathAction->setStatusTip(tr("Configure media image file paths."));
+ 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()));
+
+ configEmulatorAction = new QAction(tr("Em&ulators"), this);
+ configEmulatorAction->setStatusTip(tr("Configure emulators"));
+ connect(configEmulatorAction, SIGNAL(triggered()), this, SLOT(configureEmulators()));
+
exitAction = new QAction(tr("&Exit"), this);
exitAction->setShortcut(tr("Ctrl+Q"));
exitAction->setStatusTip(tr("Exit EmuFront"));
if (!platformDialog)
{
platformDialog = new PlatformDialog(this);
- }
- platformDialog->show();
- platformDialog->raise();
- platformDialog->activateWindow();
+ connect(platformDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
+ }
+ activateDialog(platformDialog);
}
void MainWindow::configureMediaTypes()
if (!mediaTypeDialog)
{
mediaTypeDialog = new MediaTypeDialog(this);
+ connect(mediaTypeDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
}
- mediaTypeDialog->show();
- mediaTypeDialog->raise();
- mediaTypeDialog->activateWindow();
+ activateDialog(mediaTypeDialog);
+}
+
+void MainWindow::configureMediaImagePaths()
+{
+ if (!mediaImagePathDialog)
+ {
+ mediaImagePathDialog = new MediaImagePathMainDialog(this);
+ }
+ activateDialog(mediaImagePathDialog);
+}
+
+void MainWindow::configureSetups()
+{
+ if (!setupMainDialog)
+ {
+ qDebug() << "MainWindow: Creating a setup main dialog.";
+ setupMainDialog = new SetupMainDialog(this);
+ }
+ activateDialog(setupMainDialog);
+ setupMainDialog->refreshDataModel();
+}
+
+void MainWindow::configureEmulators()
+{
+ if (!executableMainDialog) {
+ executableMainDialog = new ExecutableMainDialog(this);
+ connect(executableMainDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
+ }
+ activateDialog(executableMainDialog);
+ executableMainDialog->refreshDataModel();
+}
+
+void MainWindow::activateDialog(EmuFrontDialog* dia) const
+{
+ dia->show();
+ dia->raise();
+ dia->activateWindow();
}
void MainWindow::createMenus()
configMenu = menuBar()->addMenu(tr("&Config"));
configMenu->addAction(configPlatformAction);
configMenu->addAction(configMediaTypeAction);
+ configMenu->addAction(configMediaImagePathAction);
+ configMenu->addAction(configSetupAction);
+ configMenu->addAction(configEmulatorAction);
}
void MainWindow::createStatusBar()
{
return true;
}
+
+void MainWindow::updateData()
+{
+ qDebug() << "MainWindow::updateData()";
+ launcher->updateData();
+}