Sayonara Player
Loading...
Searching...
No Matches
Editor.h
1/* TagEdit.h */
2
3/* Copyright (C) 2011-2024 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 TAGEDIT_H
22#define TAGEDIT_H
23
24#include <QThread>
25#include <QPixmap>
26
27#include "Utils/Pimpl.h"
28
29class Genre;
30
31namespace Tagging
32{
33 class TagReader;
34 class TagWriter;
35 class Editor :
36 public QObject
37 {
38 Q_OBJECT
39 PIMPL(Editor)
40
41 signals:
42 void sigStarted();
43 void sigFinished();
44 void sigProgress(int);
45 void sigMetadataReceived(const MetaDataList& tracks);
46
47 public:
48 Editor(const std::shared_ptr<TagReader>& tagReader, const std::shared_ptr<TagWriter>& tagWriter,
49 bool doSelectiveUpdate, QObject* parent);
50 Editor(const std::shared_ptr<TagReader>& tagReader, const std::shared_ptr<TagWriter>& tagWriter,
51 const MetaDataList& tracks, bool doSelectiveUpdate, QObject* parent);
52 ~Editor() override;
53
54 enum FailReason
55 {
56 FileNotWriteable = 1,
57 FileNotFound,
58 TagLibError,
59 NoError
60 };
61
66 void undo(int index);
67
71 void undoAll();
72
78 MetaData metadata(int index) const;
79
85
86 bool applyRegularExpression(const QString& regex, int index);
87
92 void addGenre(int index, const Genre& genre);
93
94 void deleteGenre(int index, const Genre& genre);
95
96 void renameGenre(int idx, const Genre& genre, const Genre& new_genre);
97
102 int count() const;
103
107 bool hasChanges() const;
108
114 void updateTrack(int index, const MetaData& track);
115
121 void updateCover(int index, const QPixmap& cover);
122
127 // void remove_cover(int idx);
128
134 bool hasCoverReplacement(int index) const;
135
140 void setMetadata(const MetaDataList& tracks);
141
142 bool isCoverSupported(int index) const;
143
144 bool canLoadEntireAlbum() const;
145 void loadEntireAlbum();
146
147 QMap<QString, FailReason> failedFiles() const;
148
149 public slots:
150
154 void commit();
155
156 private:
160 void insertMissingArtistsAndAlbums();
161 void startSameAlbumCrawler(const QString& filepath);
162
163 private slots:
164 void loadEntireAlbumFinished();
165 };
166}
167
168#endif // TAGEDIT_H
Definition Genre.h:31
Definition MetaDataList.h:34
Definition MetaData.h:43
Definition org_mpris_media_player2_adaptor.h:21
Definition Editor.h:37
int count() const
gets the number of tracks
bool hasChanges() const
indicates if there are pending changes
void commit()
Commits changes to db.
void updateTrack(int index, const MetaData &track)
writes changes to (changed) metadata for a specific track
void addGenre(int index, const Genre &genre)
Add a genre to all (changed) metdata.
bool hasCoverReplacement(int index) const
remove_cover for a specific track
void undoAll()
undo changes for all tracks
MetaData metadata(int index) const
get the (changed) metadata for a specific index
void updateCover(int index, const QPixmap &cover)
update the cover for a specific track.
void undo(int index)
undo changes for a specific track
void setMetadata(const MetaDataList &tracks)
initializes the TagEdit object with a MetaDataList
MetaDataList metadata() const
get all (changed) metadata
The GUI_TagEdit class.
Definition Engine.h:33