Sayonara Player
Editor.h
1 /* TagEdit.h */
2 
3 /* Copyright (C) 2011-2017 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 <QImage>
26 #include <QStringList>
27 
28 #include "Utils/Pimpl.h"
29 
30 class Genre;
31 class MetaDataList;
32 class MetaData;
33 namespace Tagging
34 {
44  class Editor :
45  public QThread
46  {
47  Q_OBJECT
48  PIMPL(Editor)
49 
50  signals:
51  void sig_progress(int);
52  void sig_metadata_received(const MetaDataList& v_md);
53 
54 
55  public:
56  explicit Editor(QObject* parent=nullptr);
57  explicit Editor(const MetaDataList& v_md, QObject* parent=nullptr);
58  ~Editor();
59 
60 
65  void undo(int idx);
66 
70  void undo_all();
71 
72 
78  const MetaData& metadata(int idx) const;
79 
80 
85  const MetaDataList& metadata() const;
86 
87 
92  void add_genre(int idx, const Genre& genre);
93 
94 
95  void delete_genre(int idx, const Genre& genre);
96 
97  void rename_genre(int idx, const Genre& genre, const Genre& new_genre);
98 
99 
100 
105  int count() const;
106 
107 
113  void update_track(int idx, const MetaData& md);
114 
120  void update_cover(int idx, const QImage& cover);
121 
126  // void remove_cover(int idx);
127 
133  bool has_cover_replacement(int idx) const;
134 
135 
140  void set_metadata(const MetaDataList& v_md);
141 
142  bool is_cover_supported(int idx) const;
143 
144 
145  public slots:
146 
150  void commit();
151 
152 
153  private:
157  void apply_artists_and_albums_to_md();
158 
159  void run() override;
160 
161  private slots:
162  void thread_finished();
163  };
164 }
165 
166 #endif // TAGEDIT_H
void update_track(int idx, const MetaData &md)
writes changes to (changed) metadata for a specific track
void commit()
Commits changes to db.
void set_metadata(const MetaDataList &v_md)
initializes the TagEdit object with a MetaDataList
The MetaData class.
Definition: MetaData.h:48
const MetaDataList & metadata() const
get all (changed) metadata
The MetaDataList class.
Definition: MetaDataList.h:38
The GUI_TagEdit class.
Definition: AbstractLibrary.h:42
void undo_all()
undo changes for all tracks
Definition: Genre.h:27
bool has_cover_replacement(int idx) const
remove_cover for a specific track
void add_genre(int idx, const Genre &genre)
Add a genre to all (changed) metdata.
int count() const
gets the number of tracks
void undo(int idx)
undo changes for a specific track
The TagEdit class Metadata has to be added using the set_metadata(const MetaDataList&) method...
Definition: Editor.h:44
void update_cover(int idx, const QImage &cover)
update the cover for a specific track.