Populating the platform selector.
authorMikko Keinänen <mikko.keinanen@gmail.com>
Thu, 30 Sep 2010 15:42:24 +0000 (18:42 +0300)
committerMikko Keinänen <mikko.keinanen@gmail.com>
Thu, 30 Sep 2010 15:42:24 +0000 (18:42 +0300)
src/emulauncher.cpp
src/emulauncher.h

index 24afb36..815e9e0 100644 (file)
 // along with EmuFront.  If not, see <http://www.gnu.org/licenses/>.
 
 #include <QtGui>
+#include <QSqlTableModel>
 #include "emulauncher.h"
+#include "db/dbmediatype.h"
+#include "db/dbplatform.h"
 
 EmuLauncher::EmuLauncher(QWidget *parent) :
     QWidget(parent)
 {
+    dbPlatform = 0;
+    dbMediaType = 0;
     initWidgets();
     layout();
     //connectSignals();
@@ -35,7 +40,7 @@ void EmuLauncher::initWidgets()
     platformSelectBox = new QComboBox;
     selectButton = new QPushButton(tr("&Update"));
     //populateMediaTypeSelectBox();
-    //populatePlatformSelectBox();
+    populatePlatformSelectBox();
 }
 
 void EmuLauncher::layout()
@@ -55,12 +60,21 @@ void EmuLauncher::connectSignals()
 
 void EmuLauncher::populateMediaTypeSelectBox()
 {
-}
+    }
 
 void EmuLauncher::populatePlatformSelectBox()
 {
+    if (!dbPlatform)
+
+        dbPlatform = new DbPlatform(this);
+    QSqlQueryModel *model = dbPlatform->getDataModel();
+    if (!model)
+        return;
+    platformSelectBox->setModel(model);
+    platformSelectBox->setModelColumn(DbPlatform::EmuFrontFileObject_Name);
 }
 
+
 void EmuLauncher::updateMediaImageContainers()
 {
 }
index b51f711..4e1d635 100644 (file)
@@ -25,6 +25,8 @@
 class QTableView;
 class QComboBox;
 class QPushButton;
+class DbMediaType;
+class DbPlatform;
 
 class EmuLauncher : public QWidget
 {
@@ -42,6 +44,8 @@ private:
     QComboBox *platformSelectBox;
     QComboBox *mediaTypeSelectBox;
     QPushButton *selectButton;
+    DbPlatform *dbPlatform;
+    DbMediaType *dbMediaType;
     void initWidgets();
     void layout();
     void connectSignals();