2 // Copyright 2010 Mikko Keinänen
4 // This file is part of EmuFront.
7 // EmuFront is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
12 // Foobar is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21 #include <QSqlTableModel>
22 #include "../db/dbplatform.h"
23 #include "../db/dbmediatype.h"
24 #include "mediaimagepathdialog.h"
26 MediaImagePathDialog::MediaImagePathDialog(QWidget *parent, EmuFrontObject *efObject)
27 : DataObjectEditDialog(parent, efObject)
30 populateMediaTypeComBox();
31 populatePlatformComBox();
36 MediaImagePathDialog::~MediaImagePathDialog()
38 delete mediaTypeComBox;
42 void MediaImagePathDialog::connectSignals()
46 void MediaImagePathDialog::initWidgets()
48 // these widgets will be automatically parented using layout components
49 buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal);
50 filePathLabel = new QLabel;
51 filePathButton = new QPushButton(tr("&Browse filepath"));
52 mediaTypeComBox = new QComboBox;
53 platformComBox = new QComboBox;
56 void MediaImagePathDialog::populateMediaTypeComBox()
58 dbMediaType = new DbMediaType(this);
59 mediaTypeComBox->setModel(dbMediaType->getDataModel());
60 mediaTypeComBox->setModelColumn(DbMediaType::MediaType_Name);
63 void MediaImagePathDialog::populatePlatformComBox()
67 void MediaImagePathDialog::layout()
69 QLabel *platformLabel = new QLabel(tr("&Platform"));
70 platformLabel->setBuddy(platformComBox);
71 QLabel *mediaTypeLabel = new QLabel(tr("Media&Type"));
72 mediaTypeLabel->setBuddy(mediaTypeComBox);
74 QGridLayout *gridLayout = new QGridLayout;
75 gridLayout->addWidget(platformLabel, 0, 0);
76 gridLayout->addWidget(platformComBox, 0, 1);
77 gridLayout->addWidget(mediaTypeLabel, 1, 0);
78 gridLayout->addWidget(mediaTypeComBox, 1, 1);
79 gridLayout->addWidget(filePathButton, 2, 0);
80 gridLayout->addWidget(filePathLabel, 2, 1);
81 gridLayout->addWidget(buttonBox, 3, 0, 1, 2);
82 setLayout(gridLayout);
84 setWindowTitle(tr("Set media image paths"));
87 void MediaImagePathDialog::setDataObject(EmuFrontObject *)
91 void MediaImagePathDialog::acceptChanges()
95 void MediaImagePathDialog::rejectChanges()