+/*
+** EmuFront
+** Copyright 2010 Mikko Keinänen
+**
+** This file is part of EmuFront.
+**
+**
+** EmuFront is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License version 2 as published by
+** the Free Software Foundation and appearing in the file gpl.txt included in the
+** packaging of this file.
+**
+** EmuFront is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with EmuFront. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <QDebug>
#include "filepathobject.h"
+#include "setup.h"
-FilePathObject::FilePathObject() : EmuFrontFileObject(), platform(0), mediaType(0)
-{
-}
+FilePathObject::FilePathObject(int type)
+ : EmuFrontObject(), type(type), setup(0)
+{ }
-FilePathObject::FilePathObject(int id, QString name, QString filename, int filetype)
- : EmuFrontFileObject(id, name, filename, filetype), platform(0), mediaType(0)
- {}
+FilePathObject::FilePathObject(int id, QString name, int filetype)
+ : EmuFrontObject(id, name), type(filetype), setup(0) {}
- FilePathObject::FilePathObject(int id, QString name, QString filename,
- int filetype, Platform *plf, MediaType *med)
- : EmuFrontFileObject(id, name, filename, filetype), platform(plf), mediaType(med)
- {}
+ FilePathObject::FilePathObject(int id, QString name, int filetype, Setup *setup)
+ : EmuFrontObject(id, name), type(filetype), setup(setup) {}
FilePathObject::~FilePathObject()
{
- if (platform) delete platform;
- if (mediaType) delete mediaType;
+ if (setup) delete setup;
}
FilePathObject::FilePathObject(const FilePathObject &fpobj)
- : EmuFrontFileObject(fpobj.id, fpobj.name, fpobj.filename, fpobj.filetype)
+ : EmuFrontObject(fpobj), type(fpobj.type)
{
- // Note: no need to deep copy members of type QString
- // QString uses Implicit Data Sharing (http://doc.trolltech.com/4.0/shclass.html)
- Platform *p = fpobj.platform;
- platform = new Platform(p->getId(), p->getName(), p->getFilename());
- MediaType *mt = fpobj.mediaType;
- mediaType = new MediaType(mt->getId(), mt->getName(), mt->getFilename());
+ Setup *s = fpobj.setup;
+ setup = new Setup(*s);
}
FilePathObject& FilePathObject::operator =(const FilePathObject &fpobj)
if (this == &fpobj) return *this;
id = fpobj.id;
name = fpobj.name;
- filename = fpobj.filename;
- filetype = fpobj.filetype;
- if (platform) delete platform;
- Platform *p = fpobj.platform;
- platform = new Platform(p->getId(), p->getName(), p->getFilename());
- if (mediaType) delete mediaType;
- MediaType *mt = fpobj.mediaType;
- mediaType = new MediaType(mt->getId(), mt->getName(), mt->getFilename());
+ type = fpobj.type;
+ if (setup) delete setup;
+ Setup *sup = fpobj.setup;
+ setup = new Setup(*sup);
return (*this);
}
+
+Setup* FilePathObject::getSetup() const
+{ return setup; }
+void FilePathObject::setSetup(Setup *sup)
+{ setup = sup; }
+
+int FilePathObject::getType() const
+{ return type; }
+void FilePathObject::setType(int t)
+{ type = t; }