Initial MediaImagePathDialog implementation
[emufront] / src / dialogs / mediaimagepathdialog.cpp
1 // EmuFront
2 // Copyright 2010 Mikko Keinänen
3 //
4 // This file is part of EmuFront.
5 //
6 //
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.
11 //
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.
16 //
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/>.
19
20 #include <QtGui>
21 #include <QSqlTableModel>
22 #include "../db/dbplatform.h"
23 #include "../db/dbmediatype.h"
24 #include "mediaimagepathdialog.h"
25
26 MediaImagePathDialog::MediaImagePathDialog(QWidget *parent, EmuFrontObject *efObject)
27     : DataObjectEditDialog(parent, efObject)
28 {
29     initWidgets();
30     populateMediaTypeComBox();
31     populatePlatformComBox();
32     layout();
33     connectSignals();
34 }
35
36 MediaImagePathDialog::~MediaImagePathDialog()
37 {
38     delete mediaTypeComBox;
39     delete platformModel;
40 }
41
42 void MediaImagePathDialog::connectSignals()
43 {
44 }
45
46 void MediaImagePathDialog::initWidgets()
47 {
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;
54 }
55
56 void MediaImagePathDialog::populateMediaTypeComBox()
57 {
58     dbMediaType = new DbMediaType(this);
59     mediaTypeComBox->setModel(dbMediaType->getDataModel());
60     mediaTypeComBox->setModelColumn(DbMediaType::MediaType_Name);
61 }
62
63 void MediaImagePathDialog::populatePlatformComBox()
64 {
65 }
66
67 void MediaImagePathDialog::layout()
68 {
69    QLabel *platformLabel = new QLabel(tr("&Platform"));
70    platformLabel->setBuddy(platformComBox);
71    QLabel *mediaTypeLabel = new QLabel(tr("Media&Type"));
72    mediaTypeLabel->setBuddy(mediaTypeComBox);
73
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);
83
84    setWindowTitle(tr("Set media image paths"));
85 }
86
87 void MediaImagePathDialog::setDataObject(EmuFrontObject *)
88 {
89 }
90
91 void MediaImagePathDialog::acceptChanges()
92 {
93 }
94
95 void MediaImagePathDialog::rejectChanges()
96 {
97     // we don't
98     efObject = 0;
99 }