Sayonara Player
TagEdit.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 "Helper/Pimpl.h"
29 
30 class MetaDataList;
31 class MetaData;
41 class TagEdit :
42  public QThread
43 {
44  Q_OBJECT
45 
46  PIMPL(TagEdit)
47 
48 signals:
49  void sig_progress(int);
50  void sig_metadata_received(const MetaDataList& v_md);
51 
52 
53 public:
54  explicit TagEdit(QObject* parent=nullptr);
55  explicit TagEdit(const MetaDataList& v_md, QObject* parent=nullptr);
56  virtual ~TagEdit();
57 
58 
63  void undo(int idx);
64 
68  void undo_all();
69 
70 
76  const MetaData& get_metadata(int idx) const;
77 
78 
83  const MetaDataList& get_all_metadata() const;
84 
85 
90  void add_genre(int idx, const QString& genre);
91 
92 
93  void delete_genre(int idx, const QString& genre);
94 
95  void rename_genre(int idx, const QString& genre, const QString& new_name);
96 
97 
98 
103  int get_n_tracks() const;
104 
105 
111  void update_track(int idx, const MetaData& md);
112 
118  void update_cover(int idx, const QImage& cover);
119 
124 // void remove_cover(int idx);
125 
131  bool has_cover_replacement(int idx) const;
132 
133 
138  void set_metadata(const MetaDataList& v_md);
139 
140  bool is_cover_supported(int idx) const;
141 
142 
143 public slots:
144 
148  void commit();
149 
150 
151 private:
155  void apply_artists_and_albums_to_md();
156 
157  void run() override;
158 
159 private slots:
160  void thread_finished();
161 };
162 
163 #endif // TAGEDIT_H
The TagEdit class Metadata has to be added using the set_metadata(const MetaDataList&) method...
Definition: TagEdit.h:41
void commit()
Commits changes to db.
void update_track(int idx, const MetaData &md)
writes changes to (changed) metadata for a specific track
The MetaData class.
Definition: MetaData.h:55
void set_metadata(const MetaDataList &v_md)
initializes the TagEdit object with a MetaDataList
Definition: MetaDataList.h:39
void add_genre(int idx, const QString &genre)
Add a genre to all (changed) metdata.
bool has_cover_replacement(int idx) const
remove_cover for a specific track
void undo_all()
undo changes for all tracks
void undo(int idx)
undo changes for a specific track
const MetaDataList & get_all_metadata() const
get all (changed) metadata
void update_cover(int idx, const QImage &cover)
update the cover for a specific track.
const MetaData & get_metadata(int idx) const
get the (changed) metadata for a specific index
int get_n_tracks() const
gets the number of tracks