Updated CueImportDialog and CueSheetModel as well as the CueSheet helper classes...
[LameXP.git] / src / Model_AudioFile.h
blobdf22401d5f5ebc2c232e6ab8f26c66521a4cc20f
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
22 #pragma once
24 #include <QObject>
25 #include <QString>
27 #include "Model_Artwork.h"
29 ///////////////////////////////////////////////////////////////////////////////
30 // Audio File - Meta Info
31 ///////////////////////////////////////////////////////////////////////////////
33 class AudioFileModel_MetaInfo : public QObject
35 Q_OBJECT
37 public:
38 //Constructors & Destructor
39 AudioFileModel_MetaInfo(void);
40 AudioFileModel_MetaInfo(const AudioFileModel_MetaInfo &model);
41 AudioFileModel_MetaInfo &operator=(const AudioFileModel_MetaInfo &model);
42 ~AudioFileModel_MetaInfo(void);
44 //Getter
45 inline const QString &title(void) const { return m_titel; }
46 inline const QString &artist(void) const { return m_artist; }
47 inline const QString &album(void) const { return m_album; }
48 inline const QString &genre(void) const { return m_genre; }
49 inline const QString &comment(void) const { return m_comment; }
50 inline const QString &cover(void) const { return m_cover.filePath(); }
51 inline unsigned int year(void) const { return m_year; }
52 inline unsigned int position(void) const { return m_position; }
54 //Setter
55 inline void setTitle(const QString &titel) { m_titel = titel.trimmed(); }
56 inline void setArtist(const QString &artist) { m_artist = artist.trimmed(); }
57 inline void setAlbum(const QString &album) { m_album = album.trimmed(); }
58 inline void setGenre(const QString &genre) { m_genre = genre.trimmed(); }
59 inline void setComment(const QString &comment) { m_comment = comment.trimmed(); }
60 inline void setCover(const QString &path, const bool isOwner) { m_cover.setFilePath(path, isOwner); }
61 inline void setYear(const unsigned int year) { m_year = year; }
62 inline void setPosition(const unsigned int position) { m_position = position; }
64 //Reset
65 void reset(void);
67 //Update
68 void update(const AudioFileModel_MetaInfo &model, const bool replace);
70 //Debug
71 void print(void) const;
73 private:
74 QString m_titel;
75 QString m_artist;
76 QString m_album;
77 QString m_genre;
78 QString m_comment;
79 ArtworkModel m_cover;
80 unsigned int m_year;
81 unsigned int m_position;
84 ///////////////////////////////////////////////////////////////////////////////
85 // Audio File - Technical Info
86 ///////////////////////////////////////////////////////////////////////////////
88 class AudioFileModel_TechInfo : public QObject
90 Q_OBJECT
92 public:
93 //Constructors & Destructor
94 AudioFileModel_TechInfo(void);
95 AudioFileModel_TechInfo(const AudioFileModel_TechInfo &model);
96 AudioFileModel_TechInfo &operator=(const AudioFileModel_TechInfo &model);
97 ~AudioFileModel_TechInfo(void);
99 //Getter
100 inline const QString &containerType(void) const { return m_containerType; }
101 inline const QString &containerProfile(void) const { return m_containerProfile; }
102 inline const QString &audioType(void) const { return m_audioType; }
103 inline const QString &audioProfile(void) const { return m_audioProfile; }
104 inline const QString &audioVersion(void) const { return m_audioVersion; }
105 inline const QString &audioEncodeLib(void) const { return m_audioEncodeLib; }
106 inline unsigned int audioSamplerate(void) const { return m_audioSamplerate; }
107 inline unsigned int audioChannels(void) const { return m_audioChannels; }
108 inline unsigned int audioBitdepth(void) const { return m_audioBitdepth; }
109 inline unsigned int audioBitrate(void) const { return m_audioBitrate; }
110 inline unsigned int audioBitrateMode(void) const { return m_audioBitrateMode; }
111 inline unsigned int duration(void) const { return m_duration; }
113 //Setter
114 inline void setContainerType(const QString &containerType) { m_containerType = containerType.trimmed(); }
115 inline void setContainerProfile(const QString &containerProfile) { m_containerProfile = containerProfile.trimmed(); }
116 inline void setAudioType(const QString &audioType) { m_audioType = audioType.trimmed(); }
117 inline void setAudioProfile(const QString &audioProfile) { m_audioProfile = audioProfile.trimmed(); }
118 inline void setAudioVersion(const QString &audioVersion) { m_audioVersion = audioVersion.trimmed(); }
119 inline void setAudioEncodeLib(const QString &audioEncodeLib) { m_audioEncodeLib = audioEncodeLib.trimmed(); }
120 inline void setAudioSamplerate(const unsigned int audioSamplerate) { m_audioSamplerate = audioSamplerate; }
121 inline void setAudioChannels(const unsigned int audioChannels) { m_audioChannels = audioChannels; }
122 inline void setAudioBitdepth(const unsigned int audioBitdepth) { m_audioBitdepth = audioBitdepth; }
123 inline void setAudioBitrate(const unsigned int audioBitrate) { m_audioBitrate = audioBitrate; }
124 inline void setAudioBitrateMode(const unsigned int audioBitrateMode) { m_audioBitrateMode = audioBitrateMode; }
125 inline void setDuration(const unsigned int duration) { m_duration = duration; }
127 //Reset
128 void reset(void);
130 private:
131 QString m_containerType;
132 QString m_containerProfile;
133 QString m_audioType;
134 QString m_audioProfile;
135 QString m_audioVersion;
136 QString m_audioEncodeLib;
137 unsigned int m_audioSamplerate;
138 unsigned int m_audioChannels;
139 unsigned int m_audioBitdepth;
140 unsigned int m_audioBitrate;
141 unsigned int m_audioBitrateMode;
142 unsigned int m_duration;
145 ///////////////////////////////////////////////////////////////////////////////
146 // Audio File Model
147 ///////////////////////////////////////////////////////////////////////////////
149 class AudioFileModel : public QObject
151 Q_OBJECT
153 public:
154 //Types
155 enum BitrateMode
157 BitrateModeUndefined = 0,
158 BitrateModeConstant = 1,
159 BitrateModeVariable = 2,
162 //Constants
163 static const unsigned int BITDEPTH_IEEE_FLOAT32;
165 //Constructors & Destructor
166 AudioFileModel(const QString &path = QString());
167 AudioFileModel(const AudioFileModel &model);
168 AudioFileModel &operator=(const AudioFileModel &model);
169 ~AudioFileModel(void);
171 //Getter
172 inline const QString &filePath(void) const { return m_filePath; }
173 inline const AudioFileModel_MetaInfo &metaInfo(void) const { return m_metaInfo; }
174 inline const AudioFileModel_TechInfo &techInfo(void) const { return m_techInfo; }
175 inline AudioFileModel_MetaInfo &metaInfo(void) { return m_metaInfo; }
176 inline AudioFileModel_TechInfo &techInfo(void) { return m_techInfo; }
178 //Setter
179 inline void setFilePath(const QString &filePath) { m_filePath = filePath; }
180 inline void setMetaInfo(const AudioFileModel_MetaInfo &metaInfo) { m_metaInfo = metaInfo; }
181 inline void setTechInfo(const AudioFileModel_TechInfo &techInfo) { m_techInfo = techInfo; }
183 //Helpers
184 const QString durationInfo(void) const;
185 const QString containerInfo(void) const;
186 const QString audioBaseInfo(void) const;
187 const QString audioCompressInfo(void) const;
189 //Reset
190 void reset(void);
192 private:
193 QString m_filePath;
194 AudioFileModel_MetaInfo m_metaInfo;
195 AudioFileModel_TechInfo m_techInfo;