#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 "utils/datfileutil.h"
-#include "db/databasemanager.h"
-#include "db/dbcreator.h"
-#include "db/dbconfig.h"
+// TODO: deprecated
+#include "platformdialog.h"
+#include "platformeditview.h"
+#include "mediatypedialog.h"
+// TODO: deprecated
+#include "mediatypeeditview.h"
+// TODO: DEPRECATED
+#include "mediaimagepathmaindialog.h"
+#include "filepatheditview.h"
+// TODO: deprecated
+#include "setupmaindialog.h"
+#include "setupeditview.h"
+#include "executablemaindialog.h"
+#include "datfileutil.h"
+#include "databasemanager.h"
+#include "dbcreator.h"
+#include "dbconfig.h"
QString MainWindow::aboutStr = trUtf8(
"<h2>EmuFront</h2>"
MainWindow::MainWindow(bool reset)
{
if (!testDB(reset)) close();
+ errorMessage = new QErrorMessage(this);
setWindowTitle("EmuFront");
tmpDirFilePath = DbConfig::getTmpDir();
if (tmpDirFilePath.isEmpty())
tmpDirFilePath = QDir::homePath();
qDebug() << "Temporary dir is " << tmpDirFilePath;
- launcher = new EmuLauncher(this, tmpDirFilePath);
+ launcher = new EmuLauncher(errorMessage, this, tmpDirFilePath);
setCentralWidget(launcher);
createActions();
createMenus();
createStatusBar();
readSettings();
+ // TODO: deprecated
platformDialog = 0;
+ plfDialog = 0;
+ // TODO: deprecated
mediaTypeDialog = 0;
+ mdtDialog = 0;
+ // TODO: DEPRECATED
mediaImagePathDialog = 0;
+ mediaImagePathView = 0;
+ // TODO: deprecated
setupMainDialog = 0;
+ setupMainView = 0;
executableMainDialog = 0;
}
void MainWindow::createActions()
{
+ // TODO: deprecated
configPlatformAction = new QAction(tr("&Platforms"), this);
configPlatformAction->setStatusTip(tr("Configure platforms"));
connect(configPlatformAction, SIGNAL(triggered()),
- this, SLOT(configurePlatforms()));
+ this, SLOT(configurePlatforms()));
+ configPlatformsAction = new QAction(tr("&Set Platforms"), this);
+ configPlatformsAction->setStatusTip(tr("Add, edit and delete platforms"));
+ connect(configPlatformsAction, SIGNAL(triggered()),
+ this, SLOT(configurePlatformss()));
+
+ // TODO: deprecated
configMediaTypeAction = new QAction(tr("&Media Types"), this);
configMediaTypeAction->setStatusTip(tr("Configure media types"));
connect(configMediaTypeAction, SIGNAL(triggered()), this, SLOT(configureMediaTypes()));
+ configMediaTypesAction = new QAction(tr("&Set Media Types"), this);
+ 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"));
connect(configSetupAction, SIGNAL(triggered()), this, SLOT(configureSetups()));
+ configSetupsAction = new QAction(tr("Configure S&etups"), this);
+ configSetupsAction->setStatusTip(tr("Add, edit and delete setups"));
+ connect(configSetupsAction, SIGNAL(triggered()), this, SLOT(configureSetupss()));
+
configEmulatorAction = new QAction(tr("Em&ulators"), this);
configEmulatorAction->setStatusTip(tr("Configure emulators"));
connect(configEmulatorAction, SIGNAL(triggered()), this, SLOT(configureEmulators()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
}
+// TODO: deprecated
void MainWindow::configurePlatforms()
{
if (!platformDialog)
activateDialog(platformDialog);
}
+void MainWindow::configurePlatformss()
+{
+ if (!plfDialog) {
+ plfDialog = new PlatformEditView(this);
+ connect(plfDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
+ }
+ activateDialog(plfDialog);
+}
+
+// TODO: deprecated
void MainWindow::configureMediaTypes()
{
if (!mediaTypeDialog)
activateDialog(mediaTypeDialog);
}
+void MainWindow::configureMediaTypess()
+{
+ if (!mdtDialog)
+ {
+ mdtDialog = new MediaTypeEditView(this);
+ connect(mdtDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
+ }
+ activateDialog(mdtDialog);
+}
+
+
+// TODO: DEPRECATED
void MainWindow::configureMediaImagePaths()
{
if (!mediaImagePathDialog)
activateDialog(mediaImagePathDialog);
}
+void MainWindow::configureMediaImagePathss()
+{
+ if (!mediaImagePathView)
+ {
+ mediaImagePathView = new FilePathEditView(this);
+ }
+ activateDialog(mediaImagePathView);
+}
+
+// TODO: deprecated
void MainWindow::configureSetups()
{
if (!setupMainDialog)
{
- qDebug() << "MainWindow: Creating a setup main dialog.";
setupMainDialog = new SetupMainDialog(this);
}
activateDialog(setupMainDialog);
setupMainDialog->refreshDataModel();
}
+void MainWindow::configureSetupss()
+{
+ if (!setupMainView) {
+ setupMainView = new SetupEditView(this);
+ }
+ activateDialog(setupMainView);
+}
+
+
void MainWindow::configureEmulators()
{
if (!executableMainDialog) {
createDB();
}
catch (EmuFrontException e) {
- qDebug() << e.what();
- QMessageBox::critical(this, "Exception", e.what());
+ errorMessage->showMessage(e.what());
}
}
configMenu = menuBar()->addMenu(tr("&Config"));
configMenu->addAction(configTmpDirAction);
configMenu->addSeparator();
+ // TODO: deprecated
configMenu->addAction(configPlatformAction);
+ configMenu->addAction(configPlatformsAction);
+ // TODO: deprecated
configMenu->addAction(configMediaTypeAction);
+ configMenu->addAction(configMediaTypesAction);
+ // TODO: deprecated
configMenu->addAction(configSetupAction);
+ configMenu->addAction(configSetupsAction);
+ // TODO: DEPRECATED
configMenu->addAction(configMediaImagePathAction);
+ configMenu->addAction(configMediaImagePathsAction);
configMenu->addAction(configEmulatorAction);
configMenu->addSeparator();
configMenu->addAction(manageDatFilesAction);
void MainWindow::about()
{
- QMessageBox::about(this, aboutTitle, aboutStr );
+ QMessageBox::about(this, aboutTitle, aboutStr);
}
bool MainWindow::testDB(bool reset)
}
catch (EmuFrontException e) {
qDebug() << e.what();
- QMessageBox::critical(this, "Exception", e.what());
+ errorMessage->showMessage(e.what());
return false;
}
}
-/* Throws EmuFrontException */
void MainWindow::createDB() const
{
try
catch (QString str) {
QString msg(tr("Exception while trying to create"
" EmuFront database: %s").arg(str));
- throw EmuFrontException(msg);
+ errorMessage->showMessage(msg);
}
}