// along with EmuFront. If not, see <http://www.gnu.org/licenses/>.
#include <QtGui>
+#include <QProcess>
#include <QSqlTableModel>
#include "utils/OSDaB-Zip/unzip.h"
#include "emulauncher.h"
dbMediaType = new DbMediaType(this);
dbExec = new DbExecutable(this);
dbMic = 0;
+ proc = 0;
initWidgets();
layout();
connectSignals();
}
+EmuLauncher::~EmuLauncher()
+{
+ if (proc) {
+ proc->kill(); // TODO: do this in a more sophisticated way
+ delete proc;
+ }
+}
+
void EmuLauncher::updateData()
{
platformSelectBox->updateDataModel();
}
}
-void EmuLauncher::launch(const Executable * ex, const MediaImageContainer * mic) const
+void EmuLauncher::launch(const Executable * ex, const MediaImageContainer * mic)
{
// extract the media image container to tmp folder
// (TODO: tmp folder configuration)
// or if emulator command options has a place for more than one
// media image assign the media images in the list order
// to emulator command line.
+ QString cmdWithParams;
+ cmdWithParams.append(ex->getExecutable());
+ // TODO: tmp will be set dynamically
+ // TODO: command parameters and assigning multiple media images
+ cmdWithParams.append(" -cartcrt \"/tmp/").append(mic->getMediaImages().first()->getName()).append("\"");
+ qDebug() << "Command with params " << cmdWithParams;
+ if (!proc) proc = new QProcess(this); // This has to be done in the heap
+ proc->start(cmdWithParams, QIODevice::ReadOnly);
}
class ExecutableComboBox;
class Executable;
class MediaImageContainer;
+class QProcess;
class EmuLauncher : public QWidget
{
Q_OBJECT
public:
explicit EmuLauncher(QWidget *parent = 0);
+ ~EmuLauncher();
void updateData();
signals:
DbMediaType *dbMediaType;
DbMediaImageContainer *dbMic;
DbExecutable *dbExec;
+ QProcess *proc;
void initWidgets();
void layout();
void connectSignals();
void populatePlatformSelectBox();
void populateMediaTypeSelectBox();
- void launch(const Executable*, const MediaImageContainer*) const;
+ void launch(const Executable*, const MediaImageContainer*);
};
#endif // EMULAUNCHER_H