--- /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.
+//
+// Foobar 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+
+#include <QSqlTableModel>
+#include "dbmediaimagepath.h"
+#include "../dataobjects/filepathobject.h"
+
+DbMediaImagePath::DbMediaImagePath(QObject *parent) : DatabaseManager(parent)
+{
+}
+
+QSqlTableModel* DbMediaImagePath::getDataModel()
+{
+ return sqlTableModel;
+}
+
+EmuFrontObject* DbMediaImagePath::getDataObjectFromModel(QModelIndex *index)
+{
+ return new FilePathObject;
+}
+
+bool DbMediaImagePath::updateDataObjectToModel(const EmuFrontObject *ob)
+{
+ return false;
+}
+
+bool DbMediaImagePath::insertDataObjectToModel(const EmuFrontObject *ob)
+{
+ return false;
+}
+
+int DbMediaImagePath::countDataObjectRefs(int id) const
+{
+ return 0;
+}
+
+// WARNING: this will delete also all the databindings to selected media image path
+bool DbMediaImagePath::deleteDataObjectFromModel(QModelIndex *index)
+{
+ return false;
+}
+
+QSqlTableModel* DbMediaImagePath::getData()
+{
+ QSqlTableModel *model = new QSqlTableModel(this);
+ return model;
+}
--- /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.
+//
+// Foobar 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef DBMEDIAIMAGEPATH_H
+#define DBMEDIAIMAGEPATH_H
+
+#include "databasemanager.h"
+
+class DbMediaImagePath : public DatabaseManager
+{
+public:
+ DbMediaImagePath(QObject *);
+ virtual QSqlTableModel* getDataModel();
+ virtual EmuFrontObject* getDataObjectFromModel(QModelIndex*);
+ virtual bool updateDataObjectToModel(const EmuFrontObject*);
+ bool insertDataObjectToModel(const EmuFrontObject*);
+ bool deleteDataObjectFromModel(QModelIndex*);
+ int countDataObjectRefs(int) const;
+
+private:
+ virtual QSqlTableModel* getData();
+
+};
+
+#endif // DBMEDIAIMAGEPATH_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.
+//
+// Foobar 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+
+#include "dataobjecteditdialog.h"
+
+DataObjectEditDialog::DataObjectEditDialog(QWidget *parent, EmuFrontObject *ob)
+ : EmuFrontDialog(parent), efObject(ob)
+{
+}
--- /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.
+//
+// Foobar 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef DATAOBJECTEDITDIALOG_H
+#define DATAOBJECTEDITDIALOG_H
+
+#include "emufrontdialog.h"
+#include "../dataobjects/emufrontobject.h"
+
+class DataObjectEditDialog : public EmuFrontDialog
+{
+ Q_OBJECT
+public:
+ DataObjectEditDialog(QWidget *parent, EmuFrontObject *ob);
+ virtual void setDataObject(EmuFrontObject *) = 0;
+protected:
+ EmuFrontObject *efObject;
+};
+
+#endif // DATAOBJECTEDITDIALOG_H
#define DBOBJECTDIALOG_H
#include "emufrontdialog.h"
-#include "namedialog.h"
+#include "dataobjecteditdialog.h"
#include "../db/databasemanager.h"
#include "../dataobjects/emufrontobject.h"
void activateNameDialog();
void initDataTable();
bool confirmDelete(QString name, int numRefs);
- NameDialog *nameDialog;
+ DataObjectEditDialog *nameDialog;
DatabaseManager *dbManager;
QTableView *objectList;
EmuFrontObject *dbObject;
--- /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.
+//
+// Foobar 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+
+#include <QtGui>
+#include <QSqlTableModel>
+#include "../db/dbplatform.h"
+#include "../db/dbmediatype.h"
+#include "mediaimagepathdialog.h"
+
+MediaImagePathDialog::MediaImagePathDialog(QWidget *parent, EmuFrontObject *efObject)
+ : DataObjectEditDialog(parent, efObject)
+{
+ initWidgets();
+ populateMediaTypeComBox();
+ populatePlatformComBox();
+ layout();
+ connectSignals();
+}
+
+void MediaImagePathDialog::connectSignals()
+{
+}
+
+void MediaImagePathDialog::initWidgets()
+{
+ // these widgets will be automatically parented using layout components
+ buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal);
+ filePathLabel = new QLabel;
+ filePathButton = new QPushButton(tr("&Browse filepath"));
+ mediaTypeComBox = new QComboBox;
+ platformComBox = new QComboBox;
+}
+
+void MediaImagePathDialog::populateMediaTypeComBox()
+{
+}
+
+void MediaImagePathDialog::populatePlatformComBox()
+{
+}
+
+void MediaImagePathDialog::layout()
+{
+ QLabel *platformLabel = new QLabel(tr("&Platform"));
+ platformLabel->setBuddy(platformComBox);
+ QLabel *mediaTypeLabel = new QLabel(tr("Media&Type"));
+ mediaTypeLabel->setBuddy(mediaTypeComBox);
+
+ QGridLayout *gridLayout = new QGridLayout;
+ gridLayout->addWidget(platformLabel, 0, 0);
+ gridLayout->addWidget(platformComBox, 0, 1);
+ gridLayout->addWidget(mediaTypeLabel, 1, 0);
+ gridLayout->addWidget(mediaTypeComBox, 1, 1);
+ gridLayout->addWidget(filePathButton, 2, 0);
+ gridLayout->addWidget(filePathLabel, 2, 1);
+ gridLayout->addWidget(buttonBox, 3, 0, 1, 2);
+ setLayout(gridLayout);
+
+ setWindowTitle(tr("Set media image paths"));
+}
+
+void MediaImagePathDialog::setDataObject(EmuFrontObject *)
+{
+}
--- /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.
+//
+// Foobar 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef MEDIAIMAGEPATHDIALOG_H
+#define MEDIAIMAGEPATHDIALOG_H
+
+#include "dataobjecteditdialog.h"
+
+class QDialogButtonBox;
+class QComboBox;
+class QLabel;
+class QPushButton;
+
+class MediaImagePathDialog : public DataObjectEditDialog
+{
+ Q_OBJECT
+
+public:
+ MediaImagePathDialog(QWidget *parent, EmuFrontObject*);
+ virtual void setDataObject(EmuFrontObject *);
+
+private:
+ QDialogButtonBox *buttonBox;
+ QComboBox *mediaTypeComBox;
+ QComboBox *platformComBox;
+ QLabel *filePathLabel;
+ QPushButton *filePathButton;
+
+ void initWidgets();
+ void layout();
+ void connectSignals();
+ void populateMediaTypeComBox();
+ void populatePlatformComBox();
+};
+
+#endif // MEDIAIMAGEPATHDIALOG_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.
+//
+// Foobar 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+
+#include <QtGui>
+
+#include "mediaimagepathmaindialog.h"
+#include "mediaimagepathdialog.h"
+#include "../dataobjects/filepathobject.h"
+#include "../db/dbmediaimagepath.h"
+
+
+MediaImagePathMainDialog::MediaImagePathMainDialog(QWidget *parent)
+ : DbObjectDialog(parent)
+{
+ setWindowTitle(tr("Set media image paths"));
+ nameDialog = new MediaImagePathDialog(this, dynamic_cast<FilePathObject*>(dbObject));
+ dbManager = new DbMediaImagePath(this);
+ initDataTable();
+ connectSignals();
+}
+
+void MediaImagePathMainDialog::connectSignals()
+{
+}
+
+MediaImagePathMainDialog::~MediaImagePathMainDialog()
+{
+ delete dynamic_cast<FilePathObject*>(dbObject);
+}
+
+int MediaImagePathMainDialog::deleteObject()
+{
+ return 0;
+}
+
+void MediaImagePathMainDialog::addObject()
+{
+
+}
+
+void MediaImagePathMainDialog::editObject()
+{
+
+}
+
+void MediaImagePathMainDialog::deleteCurrentObject()
+{
+
+}
+
+void MediaImagePathMainDialog::updateDb(const EmuFrontObject *) const
+{
+
+}
+
+void MediaImagePathMainDialog::insertDb(const EmuFrontObject *) const
+{
+
+}
+
+bool MediaImagePathMainDialog::deleteItem()
+{
+ return false;
+}
+
--- /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.
+//
+// Foobar 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef MEDIAIMAGEPATHMAINDIALOG_H
+#define MEDIAIMAGEPATHMAINDIALOG_H
+
+#include "dbobjectdialog.h"
+
+class MediaImagePathMainDialog : public DbObjectDialog
+{
+ Q_OBJECT
+
+public:
+ MediaImagePathMainDialog(QWidget *parent);
+ ~MediaImagePathMainDialog();
+
+protected:
+ virtual int deleteObject();
+ virtual void deleteCurrentObject();
+ virtual void addObject();
+ virtual void editObject();
+ virtual bool deleteItem();
+ virtual void updateDb(const EmuFrontObject*) const;
+ virtual void insertDb(const EmuFrontObject*) const;
+
+private:
+ void connectSignals();
+};
+
+#endif // MEDIAIMAGEPATHMAINDIALOG_H
#include "namedialog.h"
NameDialog::NameDialog(QWidget *parent, EmuFrontObject *efObj)
- : EmuFrontDialog(parent), efObject(efObj)
+ : DataObjectEditDialog(parent, efObj)
{
nameLabel = new QLabel(tr("&Name: "));
nameEdit = new QLineEdit;
#define NAMEDIALOG_H
#include "../dataobjects/emufrontobject.h"
-#include "emufrontdialog.h"
+#include "dataobjecteditdialog.h"
class QLabel;
class QLineEdit;
class QPushButton;
class QDialogButtonBox;
-class NameDialog : public EmuFrontDialog
+class NameDialog : public DataObjectEditDialog
{
Q_OBJECT
QLabel *nameLabel;
QLineEdit *nameEdit;
QDialogButtonBox *buttonBox;
- EmuFrontObject *efObject;
private:
void connectSignals();
dataobjects/mediatype.h \
db/dbmediatype.h \
dialogs/mediatypenamedialog.h \
- dataobjects/filepathobject.h
+ dataobjects/filepathobject.h \
+ dialogs/mediaimagepathdialog.h \
+ dialogs/mediaimagepathmaindialog.h \
+ dialogs/dataobjecteditdialog.h \
+ db/dbmediaimagepath.h
SOURCES += main.cpp \
mainwindow.cpp \
db/databasemanager.cpp \
dataobjects/mediatype.cpp \
db/dbmediatype.cpp \
dialogs/mediatypenamedialog.cpp \
- dataobjects/filepathobject.cpp
+ dataobjects/filepathobject.cpp \
+ dialogs/mediaimagepathdialog.cpp \
+ dialogs/mediaimagepathmaindialog.cpp \
+ dialogs/dataobjecteditdialog.cpp \
+ db/dbmediaimagepath.cpp