MediaImagePathDialog.
}
// TODO: remove this after implementing all the combo boxes using EFComboBox
-void DataObjectEditDialog::setSelected(QComboBox *cbox, const EmuFrontObject *ob, int idIndex)
+/*void DataObjectEditDialog::setSelected(QComboBox *cbox, const EmuFrontObject *ob, int idIndex)
{
if (!ob) return;
QSqlQueryModel *model = dynamic_cast<QSqlQueryModel*>(cbox->model());
break;
}
}
-}
+}*/
void DataObjectEditDialog::rejectChanges()
{
#include "mediaimagepathdialog.h"
#include "../db/dbsetup.h"
#include "../dataobjects/filepathobject.h"
+#include "../widgets/setupcombobox.h"
MediaImagePathDialog::MediaImagePathDialog(QWidget *parent, EmuFrontObject *efObject)
: DataObjectEditDialog(parent, efObject, Qt::Horizontal)
initWidgets();
dbPlatform = 0;
dbMediaType = 0;
+ dbSetup = 0;
connectSignals();
layout();
}
// these widgets will be automatically parented using layout components
filePathLabel = new QLabel;
filePathButton = new QPushButton(tr("&Browse filepath"));
- setupComBox = new QComboBox;
- populateSetupComBox();
+ dbSetup = new DbSetup(this);
+ setupComBox = new SetupComboBox(dbSetup, this); //QComboBox;
+ //populateSetupComBox();
}
-void MediaImagePathDialog::populateSetupComBox()
+/*void MediaImagePathDialog::populateSetupComBox()
{
dbSetup = new DbSetup(this);
setupComBox->setModel(dbSetup->getDataModel());
setupComBox->setModelColumn(DbSetup::Setup_Name);
-}
+}*/
void MediaImagePathDialog::layout()
{
void MediaImagePathDialog::setSelectedSetup(const Setup *sup)
{
- setSelected(setupComBox, sup, DbSetup::Setup_Id);
+
+ setupComBox->setSelected(sup);
+ // setSelected(setupComBox, sup, DbSetup::Setup_Id);
}
Setup* MediaImagePathDialog::getSelectedSetup()
{
- if (!dbPlatform) dbPlatform = new DbPlatform(this);
+ EmuFrontObject *ob = setupComBox->getSelected();
+ if (!ob) return 0;
+ return dynamic_cast<Setup*>(ob);
+ /*if (!dbPlatform) dbPlatform => new DbPlatform(this);
if (!dbMediaType) dbMediaType = new DbMediaType(this);
Setup *sup = 0;
int index = setupComBox->currentIndex();
exts.split(DbSetup::FILE_TYPE_EXTENSION_SEPARATOR));
}
else errorMessage->showMessage("Record missing");
- return sup;
+ return sup;*/
}
void MediaImagePathDialog::acceptChanges()
#include "dataobjecteditdialog.h"
class QDialogButtonBox;
-class QComboBox;
class QLabel;
class QPushButton;
class QSqlTableModel;
class Setup;
class DbMediaType;
class DbPlatform;
+class SetupComboBox;
class MediaImagePathDialog : public DataObjectEditDialog
{
void browseFilePath();
private:
- QComboBox *setupComBox;
+ SetupComboBox *setupComBox;
QLabel *filePathLabel;
QPushButton *filePathButton;
DbSetup *dbSetup;
utils/OSDaB-Zip/unzip_p.h \
emulauncher.h \
widgets/efcombobox.h \
- widgets/effileobjectcombobox.h
+ widgets/effileobjectcombobox.h \
+ widgets/setupcombobox.h
SOURCES += main.cpp \
mainwindow.cpp \
db/databasemanager.cpp \
db/dbmediaimage.cpp \
emulauncher.cpp \
widgets/efcombobox.cpp \
- widgets/effileobjectcombobox.cpp
+ widgets/effileobjectcombobox.cpp \
+ widgets/setupcombobox.cpp
OTHER_FILES +=
--- /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 "setupcombobox.h"
+#include "../db/dbsetup.h"
+
+SetupComboBox::SetupComboBox(DatabaseManager *dbMan, QWidget *parent)
+ : EFComboBox(dbMan, parent)
+{
+ dataModelIndex_name = DbSetup::Setup_Name;
+ dataModelIndex_id = DbSetup::Setup_Id;
+ setModelColumn(dataModelIndex_name);
+
+}
+
--- /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 SETUPCOMBOBOX_H
+#define SETUPCOMBOBOX_H
+
+#include "efcombobox.h"
+
+class SetupComboBox : public EFComboBox
+{
+public:
+ SetupComboBox(DatabaseManager *dbMan, QWidget *parent);
+};
+
+#endif // SETUPCOMBOBOX_H