return false;
}
+QSqlQueryModel* DbExecutable::getData()
+{
+ QSqlQueryModel *model = new QSqlQueryModel;
+ QString select = constructSelect();
+ // TODO ...
+ model->setQuery(select);
+ return model;
+}
+
Executable_Executable,
Executable_Options,
Executable_TypeId,
- Executable_SetupId
+ Executable_SetupId,
+ Executable_SetupName
};
protected:
virtual EmuFrontObject* recordToDataObject(const QSqlRecord*);
virtual QString constructSelect(QString whereClause = "") const;
virtual bool deleteDataObject(int id) const;
private:
+ virtual QSqlQueryModel* getData();
DbSetup *dbSetup;
};
--- /dev/null
+// 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.
+//
+// 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 <http://www.gnu.org/licenses/>.
+
+#include <QtGui>
+#include "executableeditdialog.h"
+#include "../db/dbexecutable.h"
+#include "../db/dbsetup.h"
+#include "../dataobjects/executable.h"
+#include "../dataobjects/setup.h"
+#include "../widgets/setupcombobox.h"
+#include "../exceptions/emufrontexception.h"
+
+ExecutableEditDialog::ExecutableEditDialog(QWidget *parent, EmuFrontObject *obj)
+ : DataObjectEditDialog(parent, obj)
+{
+ dbExecutable = 0;
+ dbSetup = new DbSetup(this);
+ initWidgets();
+ connectSignals();
+ layout();
+}
+
+void ExecutableEditDialog::initWidgets()
+{
+ setupComBox = new SetupComboBox(dbSetup, this);
+ nameEdit = new QLineEdit;
+ nameEdit->setToolTip(tr("Set an individual short "
+ "description for this emulator configuration."));
+ execEdit = new QLineEdit;
+ execEdit->setToolTip(tr("Emulator executable in $PATH "
+ "or absolute path to emulator executable."));
+ optEdit = new QLineEdit;
+ optEdit->setToolTip(tr("Command line parameters for the "
+ "emulator executable including $1 as file 1 to be "
+ "assigned to emulator, $2 as file 2, etc."));
+}
+
+void ExecutableEditDialog::layout()
+{
+ QLabel *nameLabel = new QLabel(tr("&Description"));
+ nameLabel->setBuddy(nameEdit);
+ QLabel *execLabel = new QLabel(tr("&Executable"));
+ execLabel->setBuddy(execEdit);
+ QLabel *optLabel = new QLabel(tr("&Parameters"));
+ optLabel->setBuddy(optEdit);
+ QLabel *setupLabel = new QLabel(tr("&Setup"));
+ setupLabel->setBuddy(setupComBox);
+ QGridLayout *gridLayout = new QGridLayout;
+ gridLayout->addWidget(nameLabel, 0, 0);
+ gridLayout->addWidget(nameEdit, 0, 1);
+ gridLayout->addWidget(execLabel, 1, 0);
+ gridLayout->addWidget(execEdit, 1, 1);
+ gridLayout->addWidget(optLabel, 2, 0);
+ gridLayout->addWidget(optEdit, 2, 1);
+ gridLayout->addWidget(setupLabel, 3, 0);
+ gridLayout->addWidget(setupComBox, 3, 1);
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addLayout(gridLayout);
+ mainLayout->addWidget(buttonBox);
+ setLayout(mainLayout);
+ setWindowTitle(tr("Edit emulator configuration"));
+}
+
+void ExecutableEditDialog::acceptChanges()
+{
+ Executable *ex = dynamic_cast<Executable*>(efObject);
+ try {
+ Setup *su = getSelectedSetup();
+ if (!su) {
+ throw new EmuFrontException(tr("Setup not selected"));
+ }
+ QString name = nameEdit->text().trimmed();
+ if (name.isEmpty()){
+ throw new EmuFrontException(tr("Name is not set"));
+ }
+ QString exec = execEdit->text().trimmed();
+ if (exec.isEmpty()){
+ throw new EmuFrontException(tr("Executable is not set"));
+ }
+ QString opts = optEdit->text().trimmed();
+ if (opts.isEmpty()) {
+ throw new EmuFrontException(tr("Options not set"));
+ }
+ Setup *supTmp = ex->getSetup();
+ if (supTmp != su) {
+ delete supTmp;
+ ex->setSetup(su);
+ }
+ ex->setName(name);
+ ex->setExecutable(exec);
+ ex->setOptions(opts);
+ emit dataObjectUpdated();
+ efObject = 0;
+ close();
+ } catch(EmuFrontException x) {
+ QMessageBox::information(this,
+ tr("Updating emulator"),
+ x.what(), QMessageBox::Ok);
+ return;
+ }
+}
+
+void ExecutableEditDialog::setDataObject(EmuFrontObject *ob)
+{
+ if (!ob) return;
+ efObject = ob;
+ Executable *ex = dynamic_cast<Executable*>(ob);
+ if (ex->getSetup()) setSelectedSetup(ex->getSetup());
+ nameEdit->setText(ex->getName());
+ execEdit->setText(ex->getExecutable());
+ optEdit->setText(ex->getOptions());
+}
+
+void ExecutableEditDialog::setSelectedSetup(const Setup *su)
+{
+ setupComBox->setSelected(su);
+}
+
+Setup* ExecutableEditDialog::getSelectedSetup() const
+{
+ EmuFrontObject *o = setupComBox->getSelected();
+ if (!o) return 0;
+ Setup *ex = dynamic_cast<Setup*>(o);
+ return ex;
+}
+
+void ExecutableEditDialog::updateData()
+{
+ setupComBox->updateDataModel();
+}
--- /dev/null
+// 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.
+//
+// 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 <http://www.gnu.org/licenses/>.
+
+#ifndef EXECUTABLEEDITDIALOG_H
+#define EXECUTABLEEDITDIALOG_H
+
+#include "dataobjecteditdialog.h"
+
+class DbExecutable;
+class DbSetup;
+class Setup;
+class SetupComboBox;
+class QLineEdit;
+
+class ExecutableEditDialog : public DataObjectEditDialog
+{
+ Q_OBJECT
+public:
+ ExecutableEditDialog(QWidget *parent, EmuFrontObject*);
+ virtual void setDataObject(EmuFrontObject *);
+ virtual void updateData();
+
+protected slots:
+ virtual void acceptChanges();
+
+private:
+ DbExecutable *dbExecutable;
+ DbSetup *dbSetup;
+ SetupComboBox *setupComBox;
+ void initWidgets();
+ void layout();
+ void setSelectedSetup(const Setup*);
+ Setup* getSelectedSetup() const;
+ QLineEdit *nameEdit;
+ QLineEdit *execEdit;
+ QLineEdit *optEdit;
+
+};
+
+#endif // EXECUTABLEEDITDIALOG_H
--- /dev/null
+// 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.
+//
+// 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 <http://www.gnu.org/licenses/>.
+
+#include <QtGui>
+#include "executablemaindialog.h"
+#include "executableeditdialog.h"
+#include "../db/dbexecutable.h"
+#include "../dataobjects/executable.h"
+
+ExecutableMainDialog::ExecutableMainDialog(QWidget *parent)
+ : DbObjectDialog(parent)
+{
+ setWindowTitle(tr("Emulators"));
+ dbManager = new DbExecutable(this);
+ initDataTable();
+ initEditDialog();
+ objectList->hideColumn(DbExecutable::Executable_Id);
+ objectList->hideColumn(DbExecutable::Executable_TypeId);
+ objectList->hideColumn(DbExecutable::Executable_SetupId);
+ connectSignals();
+}
+
+ExecutableMainDialog::~ExecutableMainDialog()
+{
+ deleteCurrentObject();
+}
+
+void ExecutableMainDialog::initEditDialog()
+{
+ nameDialog = new ExecutableEditDialog(
+ this, dynamic_cast<Executable*>(dbObject));
+}
+
+void ExecutableMainDialog::deleteCurrentObject()
+{
+ delete dynamic_cast<Executable*>(dbObject);
+ dbObject = 0;
+}
+
+EmuFrontObject* ExecutableMainDialog::createObject()
+{
+ return new Executable;
+}
--- /dev/null
+// 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.
+//
+// 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 <http://www.gnu.org/licenses/>.
+
+#ifndef EXECUTABLEMAINDIALOG_H
+#define EXECUTABLEMAINDIALOG_H
+
+#include "dbobjectdialog.h"
+
+class ExecutableMainDialog : public DbObjectDialog
+{
+ Q_OBJECT
+
+public:
+ ExecutableMainDialog(QWidget *parent);
+ ~ExecutableMainDialog();
+
+protected:
+ virtual void deleteCurrentObject();
+ virtual EmuFrontObject* createObject();
+ virtual void initEditDialog();
+
+};
+
+#endif // EXECUTABLEMAINDIALOG_H
Platform *plf = getSelectedPlatform();
if (!plf)
{
- QMessageBox::information(this, tr("Platform"), tr("Platform not selected"), QMessageBox::Ok);
+ QMessageBox::information(this, tr("Platform"),
+ tr("Platform not selected"), QMessageBox::Ok);
return;
}
qDebug() << "Platform selected " << plf->getName();
void initWidgets();
void layout();
- void populateMediaTypeComBox();
- void populatePlatformComBox();
+ //void populateMediaTypeComBox();
+ //void populatePlatformComBox();
void setSelectedMediaType(const MediaType*);
void setSelectedPlatform(const Platform*);
MediaType* getSelectedMediaType() const;
widgets/effileobjectcombobox.h \
widgets/setupcombobox.h \
dataobjects/executable.h \
- db/dbexecutable.h
+ db/dbexecutable.h \
+ dialogs/executablemaindialog.h \
+ dialogs/executableeditdialog.h
SOURCES += main.cpp \
mainwindow.cpp \
db/databasemanager.cpp \
widgets/effileobjectcombobox.cpp \
widgets/setupcombobox.cpp \
dataobjects/executable.cpp \
- db/dbexecutable.cpp
+ db/dbexecutable.cpp \
+ dialogs/executablemaindialog.cpp \
+ dialogs/executableeditdialog.cpp
OTHER_FILES +=
#include "dialogs/mediatypedialog.h"
#include "dialogs/mediaimagepathmaindialog.h"
#include "dialogs/setupmaindialog.h"
+#include "dialogs/executablemaindialog.h"
#include "db/databasemanager.h"
MainWindow::MainWindow()
mediaTypeDialog = 0;
mediaImagePathDialog = 0;
setupMainDialog = 0;
+ executableMainDialog = 0;
}
void MainWindow::createActions()
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"));
setupMainDialog->refreshDataModel();
}
+void MainWindow::configureEmulators()
+{
+ if (!executableMainDialog) {
+ executableMainDialog = new ExecutableMainDialog(this);
+ }
+ activateDialog(executableMainDialog);
+ executableMainDialog->refreshDataModel();
+}
+
void MainWindow::activateDialog(EmuFrontDialog* dia) const
{
dia->show();
configMenu->addAction(configMediaTypeAction);
configMenu->addAction(configMediaImagePathAction);
configMenu->addAction(configSetupAction);
+ configMenu->addAction(configEmulatorAction);
}
void MainWindow::createStatusBar()
class MediaTypeDialog;
class MediaImagePathMainDialog;
class SetupMainDialog;
+class ExecutableMainDialog;
class QLabel;
class DatabaseManager;
class EmuFrontDialog;
void configureMediaTypes();
void configureMediaImagePaths();
void configureSetups();
+ void configureEmulators();
private:
void createActions();
MediaTypeDialog *mediaTypeDialog;
MediaImagePathMainDialog *mediaImagePathDialog;
SetupMainDialog *setupMainDialog;
+ ExecutableMainDialog *executableMainDialog;
QMenu *configMenu;
QMenu *fileMenu;
QAction *configPlatformAction;
QAction *configMediaTypeAction;
QAction *configMediaImagePathAction;
QAction *configSetupAction;
+ QAction *configEmulatorAction;
QAction *exitAction;
QLabel *messageLabel;
DatabaseManager *dbManager;
<h1>Welcome to EmuFront!</h1>
<p>EmuFront is an universal (multi-system) emulator front-end implemented in
- QT, C++ and SQLite. The main target are Maemo and MeeGo
+ QT, C++ and SQLite. The main targets are Maemo and MeeGo
platforms.</p>
<p>EmuFront is Open Source Software licenced under GPL version 2.</p>