Q_OBJECT
public:
EmuFrontFileObjectModel(QObject *parent = 0);
- Qt::ItemFlags flags(const QModelIndex &index) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role);
- bool insertRows(int row, int count, const QModelIndex &parent);
- bool removeRows(int row, int count, const QModelIndex &parent);
+ virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+ virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
+ virtual bool insertRows(int row, int count, const QModelIndex &parent);
+ virtual bool removeRows(int row, int count, const QModelIndex &parent);
enum {
EmuFrontFileObject_Id,
EmuFrontFileObject_Name,
};
protected:
- void refresh();
- QString constructSelect(QString where = "") const;
- bool setName(int id, const QString &name);
+ virtual void refresh();
+ virtual QString constructSelect(QString where = "") const;
+ virtual bool setName(int id, const QString &name);
};
#endif // EMUFRONTFILEOBJECTMODEL_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 version 2 as published by
+// the Free Software Foundation and appearing in the file gpl.txt included in the
+// packaging of this file.
+//
+// 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 "setupmodel.h"
+
+SetupModel::SetupModel(QObject *parent) :
+ EmuFrontQueryModel(parent)
+{
+ refresh();
+}
+
+void SetupModel::refresh()
+{
+ setQuery(constructSelect());
+ setHeaderData(Setup_Id, Qt::Horizontal, tr("Id"));
+ setHeaderData(Setup_PlatformId, Qt::Horizontal, tr("Platform id"));
+ setHeaderData(Setup_MediaTypeId, Qt::Horizontal, tr("Media type id"));
+ setHeaderData(Setup_FileTypeExtensions, Qt::Horizontal, tr("File types"));
+ setHeaderData(Setup_Name, Qt::Horizontal, tr("Name"));
+}
+
+QString SetupModel::constructSelect(QString where) const
+{
+ return QString(
+ "SELECT setup.id AS SetupId, "
+ "setup.platformid AS PlatformId, "
+ "setup.mediatypeid AS MediaTypeId, "
+ "setup.filetypeextensions AS SupportedFileTypeExtensions, "
+ "platform.name || ' ' || mediatype.name AS SetupName "
+ "FROM setup "
+ "INNER JOIN platform ON setup.platformid=platform.id "
+ "INNER JOIN mediatype ON setup.mediatypeid=mediatype.id %1 "
+ "ORDER BY SetupName"
+ ).arg(where);
+}
--- /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 version 2 as published by
+// the Free Software Foundation and appearing in the file gpl.txt included in the
+// packaging of this file.
+//
+// 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 SETUPMODEL_H
+#define SETUPMODEL_H
+
+#include "emufrontquerymodel.h"
+
+class SetupModel : public EmuFrontQueryModel
+{
+ Q_OBJECT
+public:
+ SetupModel(QObject *parent = 0);
+ enum { Setup_Id = 0,
+ Setup_PlatformId,
+ Setup_MediaTypeId,
+ Setup_FileTypeExtensions,
+ Setup_Name };
+ static const QString FILE_TYPE_EXTENSION_SEPARATOR;
+
+protected:
+ virtual void refresh();
+ virtual QString constructSelect(QString where = "") const;
+};
+
+#endif // SETUPMODEL_H
editButton->setEnabled(b);
deleteButton->setEnabled(b);
}
+
+void EmuFrontDataDialog::setHiddenColumns()
+{
+ // default implementation
+}
QPushButton *addButton;
QPushButton *deleteButton;
void layout();
- virtual void setHiddenColumns() = 0;
+ virtual void setHiddenColumns();
void hideColumns();
virtual void connectSignals();
void setButtonsEnabled(bool);
--- /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 version 2 as published by
+// the Free Software Foundation and appearing in the file gpl.txt included in the
+// packaging of this file.
+//
+// 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 "setupmainview.h"
+#include "db/setupmodel.h"
+
+SetupMainView::SetupMainView(QWidget *parent) :
+ EmuFrontDataDialog(parent)
+{
+ model = new SetupModel(this);
+ objectList->setModel(model);
+ postInit();
+}
--- /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 version 2 as published by
+// the Free Software Foundation and appearing in the file gpl.txt included in the
+// packaging of this file.
+//
+// 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 SETUPMAINVIEW_H
+#define SETUPMAINVIEW_H
+
+#include "emufrontdatadialog.h"
+
+class SetupMainView : public EmuFrontDataDialog
+{
+ Q_OBJECT
+public:
+ SetupMainView(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // SETUPMAINVIEW_H
db/emufrontfileobjectmodel.h \
db/mediatypemodel.h \
dialogs/emufrontfileobjectmaindialog.h \
- dialogs/mediatypemaindialog.h
+ dialogs/mediatypemaindialog.h \
+ db/setupmodel.h \
+ dialogs/setupmainview.h
SOURCES += main.cpp \
mainwindow.cpp \
db/databasemanager.cpp \
db/emufrontfileobjectmodel.cpp \
db/mediatypemodel.cpp \
dialogs/emufrontfileobjectmaindialog.cpp \
- dialogs/mediatypemaindialog.cpp
+ dialogs/mediatypemaindialog.cpp \
+ db/setupmodel.cpp \
+ dialogs/setupmainview.cpp
OTHER_FILES +=
CONFIG += mobility
// TODO: deprecated
#include "dialogs/mediatypemaindialog.h"
#include "dialogs/mediaimagepathmaindialog.h"
+// TODO: deprecated
#include "dialogs/setupmaindialog.h"
+#include "dialogs/setupmainview.h"
#include "dialogs/executablemaindialog.h"
#include "utils/datfileutil.h"
#include "db/databasemanager.h"
mediaTypeDialog = 0;
mdtDialog = 0;
mediaImagePathDialog = 0;
+ // TODO: deprecated
setupMainDialog = 0;
+ setupMainView = 0;
executableMainDialog = 0;
}
connect(configMediaImagePathAction, SIGNAL(triggered()),
this, SLOT(configureMediaImagePaths()));
+ // 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()));
activateDialog(mediaImagePathDialog);
}
+// 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 SetupMainView(this);
+ }
+ activateDialog(setupMainView);
+}
+
+
void MainWindow::configureEmulators()
{
if (!executableMainDialog) {
// TODO: deprecated
configMenu->addAction(configMediaTypeAction);
configMenu->addAction(configMediaTypesAction);
+ // TODO: deprecated
configMenu->addAction(configSetupAction);
+ configMenu->addAction(configSetupsAction);
configMenu->addAction(configMediaImagePathAction);
configMenu->addAction(configEmulatorAction);
configMenu->addSeparator();
class MediaTypeDialog;
class MediaTypeMainDialog;
class MediaImagePathMainDialog;
+// TODO: DEPRECATED
class SetupMainDialog;
+class SetupMainView;
class ExecutableMainDialog;
//class TmpFolderEditDialog;
class QLabel;
void configureMediaTypes();
void configureMediaTypess();
void configureMediaImagePaths();
+ // TODO: DEPRECATED
void configureSetups();
+ void configureSetupss();
void configureEmulators();
void configureTmpDir();
void resetDb();
MediaTypeDialog *mediaTypeDialog;
MediaTypeMainDialog *mdtDialog;
MediaImagePathMainDialog *mediaImagePathDialog;
+ // TODO: deprecated
SetupMainDialog *setupMainDialog;
+ SetupMainView *setupMainView;
ExecutableMainDialog *executableMainDialog;
//TmpFolderEditDialog *tmpFolderDialog;
QMenu *configMenu;
QAction *configMediaTypeAction;
QAction *configMediaTypesAction;
QAction *configMediaImagePathAction;
+ // TODO: deprecated
QAction *configSetupAction;
+ QAction *configSetupsAction;
QAction *configEmulatorAction;
QAction *exitAction;
QAction *resetDbAction;