Modified the license text comment type.
[emufront] / src / dialogs / platformnamedialog.cpp
1 /*
2 ** EmuFront
3 ** Copyright 2010 Mikko Keinänen
4 **
5 ** This file is part of EmuFront.
6 **
7 **
8 ** EmuFront is free software: you can redistribute it and/or modify
9 ** it under the terms of the GNU General Public License version 2 as published by
10 ** the Free Software Foundation and appearing in the file gpl.txt included in the
11 ** packaging of this file.
12 **
13 ** EmuFront is distributed in the hope that it will be useful,
14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 ** GNU General Public License for more details.
17 **
18 ** You should have received a copy of the GNU General Public License
19 ** along with EmuFront.  If not, see <http://www.gnu.org/licenses/>.
20 */
21 #include <QtGui>
22 #include "platformnamedialog.h"
23 #include "databasemanager.h"
24
25 PlatformNameDialog::PlatformNameDialog(QWidget *parent, Platform *efObj)
26     : NameDialog(parent, efObj)
27 {
28     setWindowTitle(tr("Set platform name"));
29 }
30
31 PlatformNameDialog::~PlatformNameDialog()
32 {
33     // no need to delete efObject here, the calling widget will take care of it
34     // delete dynamic_cast<Platform*>(efObject);
35 }
36
37 void PlatformNameDialog::setDataObject(QString name)
38 {
39     efObject->setName(name);
40     (dynamic_cast<Platform*>(efObject))->setFile(0);
41 }
42
43 void PlatformNameDialog::setDataObject(EmuFrontObject *ob)
44 {
45     nameEdit->hide();
46     if (!ob) return;
47     efObject = dynamic_cast<Platform*>(ob);
48     nameEdit->setText(efObject->getName());
49     nameEdit->setFocus(Qt::TabFocusReason);
50     nameEdit->show();
51 }
52
53 /*void PlatformNameDialog::keyPressEvent(QKeyEvent *event)
54 {
55     nameEdit->setText( nameEdit->text().append(event->text()) );
56     QDialog::keyPressEvent(event);
57 }*/
58