Sayonara Player
TaggingUtils.h
1 /* TaggingEnums.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras)
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program 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.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef SAYONARA_TAGGING_ENUMS_H
22 #define SAYONARA_TAGGING_ENUMS_H
23 
24 #include <taglib/audioproperties.h>
25 #include <taglib/id3v1tag.h>
26 #include <taglib/id3v2tag.h>
27 #include <taglib/mp4tag.h>
28 #include <taglib/xiphcomment.h>
29 #include <taglib/tstring.h>
30 #include <taglib/fileref.h>
31 
32 #include <QString>
33 
34 namespace Tagging
35 {
39  enum class Quality :
40  unsigned char
41  {
42  Fast = TagLib::AudioProperties::Fast,
43  Standard = TagLib::AudioProperties::Average,
44  Quality = TagLib::AudioProperties::Accurate,
45  Dirty
46  };
47 
48  enum class TagType :
49  unsigned char
50  {
51  ID3v1 = 0,
52  ID3v2,
53  Xiph,
54  MP4,
55  Unsupported,
56  Unknown
57  };
58 
59  struct ParsedTag
60  {
61  TagLib::Tag* tag {nullptr};
62  TagType type {TagType::Unknown};
63 
64  TagLib::MP4::Tag* mp4Tag() const;
65  TagLib::ID3v2::Tag* id3Tag() const;
66  TagLib::Ogg::XiphComment* xiphTag() const;
67  };
68 
69  bool isValidFile(const TagLib::FileRef& fileRef);
70 
71  Tagging::TagType getTagType(const QString& filepath);
72  QString tagTypeToString(Tagging::TagType);
73  Tagging::ParsedTag getParsedTagFromFileRef(const TagLib::FileRef& fileRef);
74 
75  TagLib::String convertString(const QString& str);
76  QString convertString(const TagLib::String& str);
77 }
78 #endif // SAYONARA_TAGGING_ENUMS_H
79 
The GUI_TagEdit class.
Definition: GenreFetcher.h:34
Quality
The Quality enum.
Definition: TaggingUtils.h:41
Definition: TaggingUtils.h:60