#include "mainwindow.h"
#include "emulauncher.h"
#include "dialogs/platformdialog.h"
+#include "dialogs/platformmaindialog.h"
#include "dialogs/mediatypedialog.h"
#include "dialogs/mediaimagepathmaindialog.h"
#include "dialogs/setupmaindialog.h"
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();
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()));
configMediaTypeAction = new QAction(tr("&Media Types"), this);
configMediaTypeAction->setStatusTip(tr("Configure media types"));
activateDialog(platformDialog);
}
+void MainWindow::configurePlatformss()
+{
+ plfDialog = new PlatformMainDialog(this);
+ connect(plfDialog, SIGNAL(finished(int)), this, SLOT(updateData()));
+ activateDialog(plfDialog);
+}
+
void MainWindow::configureMediaTypes()
{
if (!mediaTypeDialog)
createDB();
}
catch (EmuFrontException e) {
- qDebug() << e.what();
- QMessageBox::critical(this, "Exception", e.what());
+ errorMessage->showMessage(e.what());
}
}
configMenu->addAction(configTmpDirAction);
configMenu->addSeparator();
configMenu->addAction(configPlatformAction);
+ configMenu->addAction(configPlatformsAction);
configMenu->addAction(configMediaTypeAction);
configMenu->addAction(configSetupAction);
configMenu->addAction(configMediaImagePathAction);
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);
}
}