SilentEye 0.4.1
|
00001 // This file is part of SilentEye. 00002 // 00003 // SilentEye is free software: you can redistribute it and/or modify 00004 // it under the terms of the GNU General Public License as published by 00005 // the Free Software Foundation, either version 3 of the License, or 00006 // (at your option) any later version. 00007 // 00008 // SilentEye is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License 00014 // along with SilentEye. If not, see <http://www.gnu.org/licenses/>. 00015 00016 #ifndef MEDIA_H_ 00017 #define MEDIA_H_ 00018 00019 #include <QPointer> 00020 #include <QString> 00021 #include <QDir> 00022 #include "encodeddata.h" 00023 00024 namespace SilentEyeFramework { 00025 00027 class Media : public QObject 00028 { 00029 public: 00030 enum Type{ IMAGE, AUDIO, VIDEO, UNKNOW }; 00031 00032 protected: 00034 Type m_type; 00036 QPointer<EncodedData> m_data; 00038 QString m_filePath; 00040 QString m_shortName; 00042 bool m_isLoaded; 00043 00044 public: 00045 Media(); 00046 ~Media(); 00047 Media(const QString& filepath); 00048 Media(const Media& img); 00049 Media(Media* img); 00050 00051 Type type() const; 00052 00053 QPointer<EncodedData> encodedData() const; 00054 void setEncodedData(QPointer<EncodedData> data); 00055 00056 QString filePath() const; 00057 QString baseName() const; 00058 QString shortName() const; 00059 void setShortName(const QString shortName); 00060 00061 bool isDataLoaded() const; 00062 00063 virtual quint32 capacity() const; 00064 00065 virtual bool loadData(); 00066 virtual bool saveToDir(QString& outputDirPath); 00067 00068 protected: 00069 QString fileName(QString filePath); 00070 void computeNewFileName(QString extension); 00071 }; 00072 00073 } 00074 00075 #endif