Sayonara Player
Editor.h
1/* TagEdit.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 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{
41 class Editor :
42 public QObject
43 {
44 Q_OBJECT
45 PIMPL(Editor)
46
47 signals:
48 void sigStarted();
49 void sigFinished();
50 void sigProgress(int);
51 void sigMetadataReceived(const MetaDataList& tracks);
52
53 public:
54 explicit Editor(QObject* parent = nullptr);
55 explicit Editor(const MetaDataList& tracks, QObject* parent = nullptr);
56 ~Editor() override;
57
58 enum FailReason
59 {
60 FileNotWriteable = 1,
61 FileNotFound,
62 TagLibError,
63 NoError
64 };
65
70 void undo(int index);
71
75 void undoAll();
76
82 MetaData metadata(int index) const;
83
89
90 bool applyRegularExpression(const QString& regex, int index);
91
96 void addGenre(int index, const Genre& genre);
97
98 void deleteGenre(int index, const Genre& genre);
99
100 void renameGenre(int idx, const Genre& genre, const Genre& new_genre);
101
106 int count() const;
107
111 bool hasChanges() const;
112
118 void updateTrack(int index, const MetaData& track);
119
125 void updateCover(int index, const QPixmap& cover);
126
131 // void remove_cover(int idx);
132
138 bool hasCoverReplacement(int index) const;
139
144 void setMetadata(const MetaDataList& tracks);
145
146 bool isCoverSupported(int index) const;
147
148 bool canLoadEntireAlbum() const;
149 void loadEntireAlbum();
150
151 QMap<QString, FailReason> failedFiles() const;
152
153 public slots:
154
158 void commit();
159
160 private:
164 void insertMissingArtistsAndAlbums();
165 void startSameAlbumCrawler(const QString& filepath);
166
167 private slots:
168 void loadEntireAlbumFinished();
169 };
170}
171
172#endif // TAGEDIT_H
Definition: Genre.h:31
The MetaDataList class.
Definition: MetaDataList.h:39
The MetaData class.
Definition: MetaData.h:47
Definition: org_mpris_media_player2_adaptor.h:21
The TagEdit class Metadata has to be added using the set_metadata(const MetaDataList&) method....
Definition: Editor.h:43
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: GenreFetcher.h:34