3 ** Copyright 2010 Mikko Keinänen
5 ** This file is part of EmuFront.
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.
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.
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/>.
22 #include "setupeditview.h"
23 #include "setupmodel.h"
24 #include "comboboxdelegate.h"
25 #include "stringlistdelegate.h"
26 #include "platformmodel.h"
27 #include "mediatypemodel.h"
28 #include <QSqlTableModel>
30 SetupEditView::SetupEditView(PlatformModel *plfModel, MediaTypeModel *mdtModel, SetupModel *supModel, QWidget *parent) :
31 EmuFrontEditView(parent), plfModel(plfModel), mdtModel(mdtModel)
33 setWindowTitle(tr("Setups"));
35 objectList->setModel(model);
36 ComboBoxDelegate *platformDelegate = new ComboBoxDelegate(
38 PlatformModel::EmuFrontFileObject_Id,
39 PlatformModel::EmuFrontFileObject_Name,
42 objectList->setItemDelegateForColumn(SetupModel::Setup_PlatformId, platformDelegate);
43 ComboBoxDelegate *mediatypeDelegate = new ComboBoxDelegate(
45 MediaTypeModel::EmuFrontFileObject_Id,
46 MediaTypeModel::EmuFrontFileObject_Name,
49 objectList->setItemDelegateForColumn(SetupModel::Setup_MediaTypeId, mediatypeDelegate);
51 StringListDelegate *fileTypeDelegate = new StringListDelegate(SetupModel::FILE_TYPE_EXTENSION_SEPARATOR, this);
52 objectList->setItemDelegateForColumn(SetupModel::Setup_FileTypeExtensions, fileTypeDelegate);
53 //objectList->setColumnWidth(SetupModel::Setup_FileTypeExtensions, StringListDelegate::WIDTH);
54 objectList->resizeColumnToContents(SetupModel::Setup_FileTypeExtensions);
58 void SetupEditView::setHiddenColumns()
60 hiddenColumns << SetupModel::Setup_Id;
61 hiddenColumns << SetupModel::Setup_Name;