Sayonara Player
GUI_TagEdit.h
1 /* GUI_TagEdit.h */
2 
3 /* Copyright (C) 2011-2016 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 
22 #ifndef GUI_TAGEDIT_H_
23 #define GUI_TAGEDIT_H_
24 
25 #include <QLineEdit>
26 #include <QFocusEvent>
27 #include <QString>
28 #include <QRegExp>
29 
30 #include "GUI/TagEdit/ui_GUI_TagEdit.h"
31 #include "GUI/Helper/SayonaraWidget/SayonaraWidget.h"
32 #include "Components/TagEdit/TagExpression.h"
33 
34 
35 
40 class TagEdit;
41 class CoverLocation;
42 class MetaDataList;
43 class MetaData;
44 
45 class GUI_TagEdit :
46  public SayonaraWidget,
47  private Ui::GUI_TagEdit
48 {
49 
50  Q_OBJECT
51 
52 public:
53  GUI_TagEdit(QWidget* parent=nullptr);
54  virtual ~GUI_TagEdit();
55 
60  TagEdit* get_tag_edit() const;
61 
65  void commit();
66 
70  void cancel();
71 
72  void show_button_commit(bool b);
73  void show_button_cancel(bool b);
74 
75 
76 signals:
77  void sig_ok_clicked(const MetaDataList&);
78  void sig_undo_clicked(int idx);
79  void sig_undo_all_clicked();
80  void sig_cancelled();
81 
82 
83 
84 private:
85  TagEdit* _tag_edit=nullptr;
86  TagExpression _tag_expression;
87  QMap<int, QString> _cover_path_map;
88 
89  int _cur_idx;
90 
91 
95  QMap<Tag, ReplacedString> _tag_str_map;
96 
97 
98 
99 private:
100 
101  bool is_cover_replacement_active() const;
102  void update_cover(int idx, const QString& cover_path);
103  void set_cover(const MetaData& md);
104  void show_replacement_field(bool b);
105 
106 
113  bool replace_selected_tag_text(Tag t, bool activate);
114 
115 
120  void apply_tag(int idx);
121 
122 
126  void track_idx_changed();
127 
128 
132  void reset();
133 
134 
139  void write_changes(int idx);
140 
141 
147  bool check_idx(int idx) const;
148 
149 
150 
151 
152 private slots:
156  void next_button_clicked();
157 
158 
162  void prev_button_clicked();
163 
164 
168  void apply_tag_clicked();
169  void apply_tag_all_clicked();
170 
171 
175  void album_all_changed(bool b);
176 
177 
181  void artist_all_changed(bool b);
182 
183 
187  void genre_all_changed(bool b);
188 
189 
193  void year_all_changed(bool b);
194 
195 
199  void discnumber_all_changed(bool b);
200 
201 
205  void rating_all_changed(bool b);
206 
210  void cover_all_changed(bool b);
211 
212 
217  void btn_title_checked(bool b);
218 
219 
224  void btn_artist_checked(bool b);
225 
226 
231  void btn_album_checked(bool b);
232 
233 
238  void btn_track_nr_checked(bool b);
239 
240 
245  void btn_disc_nr_checked(bool b);
246 
247 
252  void btn_year_checked(bool b);
253 
254 
258  void btn_tag_help_clicked();
259 
263  void tag_text_changed(const QString&);
264 
265 
270  void set_tag_colors(bool valid);
271 
272 
273 
277  void undo_clicked();
278 
279 
283  void undo_all_clicked();
284 
285 
290  void progress_changed(int val);
291 
292 
296  void metadata_changed(const MetaDataList&);
297 
298 
299 
303  void language_changed() override;
304 
308  void commit_finished();
309 
310 
311  void rb_dont_replace_toggled(bool b);
312 
313 };
314 
315 #endif
The TagEdit class Metadata has to be added using the set_metadata(const MetaDataList&) method...
Definition: TagEdit.h:44
Definition: GUI_TagEdit.h:45
Definition: MetaData.h:49
Definition: MetaDataList.h:44
TagEdit * get_tag_edit() const
Get tag edit object.
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() wi...
Definition: SayonaraWidget.h:41
void commit()
Commits changes to db/file.
The CoverLocation class.
Definition: CoverLocation.h:38
void cancel()
calls undo_all, and closes the entire dialog
The TagExpression class.
Definition: TagExpression.h:47
Definition: ui_GUI_TagEdit.h:625