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 version 2 as published by
9 // the Free Software Foundation and appearing in the file gpl.txt included in the
10 // packaging of this file.
12 // EmuFront 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 EmuFront. If not, see <http://www.gnu.org/licenses/>.
21 #include "mediaimagecontainer.h"
23 MediaImageContainer::MediaImageContainer()
24 : EmuFrontFile(EmuFrontFile::FileType_MediaImageContainer)
26 lstMediaImage = QList<MediaImage*>();
30 MediaImageContainer::MediaImageContainer(int id, QString name,
31 QString checksum, int size, QList<MediaImage *>images, FilePathObject *fpo)
32 : EmuFrontFile(id, name, checksum, size, EmuFrontFile::FileType_MediaImageContainer),
33 lstMediaImage(images), filePath(fpo)
36 MediaImageContainer::MediaImageContainer(QString name, QString checksum,
37 int size, QList<MediaImage *>images, FilePathObject *fpo)
38 : EmuFrontFile(-1, name, checksum, size, EmuFrontFile::FileType_MediaImageContainer),
39 lstMediaImage(images), filePath(fpo)
42 MediaImageContainer::~MediaImageContainer()
44 qDeleteAll(lstMediaImage);
48 MediaImageContainer::MediaImageContainer(MediaImageContainer &mic)
51 lstMediaImage = QList<MediaImage*>();
52 foreach(MediaImage *mi, mic.lstMediaImage)
53 lstMediaImage.append(new MediaImage(*mi));
54 filePath = new FilePathObject(*(mic.filePath));
57 MediaImageContainer& MediaImageContainer::operator =(MediaImageContainer &mic)
59 if (this == &mic) return *this;
63 checkSum = mic.checkSum;
65 qDeleteAll(lstMediaImage);
66 foreach(MediaImage *mi, mic.lstMediaImage)
67 lstMediaImage.append(new MediaImage(*mi));
68 filePath = new FilePathObject(*(mic.filePath));
72 void MediaImageContainer::setMediaImages(QList<MediaImage *> list)
74 qDeleteAll(lstMediaImage);
78 QList<MediaImage *> MediaImageContainer::getMediaImages() const
79 { return lstMediaImage; }
81 void MediaImageContainer::addMediaImage(MediaImage *mi)
82 { lstMediaImage.append(mi); }
84 void MediaImageContainer::clearMediaImages()
86 qDeleteAll(lstMediaImage);
87 lstMediaImage.clear();
90 FilePathObject* MediaImageContainer::getFilePath() const
93 void MediaImageContainer::setFilePath(FilePathObject *fp)