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/>.
20 #ifndef DBOBJECTDIALOG_H
21 #define DBOBJECTDIALOG_H
23 #include "emufrontdialog.h"
24 #include "dataobjecteditdialog.h"
25 #include "../db/databasemanager.h"
26 #include "../dataobjects/emufrontobject.h"
30 class QDialogButtonBox;
33 class DbObjectDialog : public EmuFrontDialog
38 DbObjectDialog(QWidget *parent = 0);
42 void editButtonClicked();
43 void addButtonClicked();
44 void deleteButtonClicked();
45 void listObjectClicked(const QModelIndex &);
47 void updateList() const;
51 // implementation specific, deletes current data object from memory
52 virtual void deleteCurrentObject();
53 virtual void addObject() =0;
54 virtual bool deleteItem() = 0;
55 virtual void insertDb(const EmuFrontObject*) const = 0;
56 void updateDb(const EmuFrontObject*) const;
58 void connectSignals();
59 void activateNameDialog();
61 bool confirmDelete(QString name, int numRefs);
62 DataObjectEditDialog *nameDialog;
63 DatabaseManager *dbManager;
64 QTableView *objectList;
65 EmuFrontObject *dbObject;
68 void setButtonsEnabled(bool);
70 void disableSelection();
71 QDialogButtonBox *buttonBox;
72 QPushButton *editButton;
73 QPushButton *addButton;
74 QPushButton *deleteButton;