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 #include "Components/TagEdit/TagEdit.h"
34 
35 
36 
37 
42 class GUI_TagEdit :
43  public SayonaraWidget,
44  private Ui::GUI_TagEdit
45 {
46 
47  Q_OBJECT
48 
49 public:
50  GUI_TagEdit(QWidget* parent=nullptr);
51  virtual ~GUI_TagEdit();
52 
57  TagEdit* get_tag_edit() const;
58 
62  void commit();
63 
67  void cancel();
68 
69  void show_button_commit(bool b);
70  void show_button_cancel(bool b);
71 
72 
73 signals:
74  void sig_ok_clicked(const MetaDataList&);
75  void sig_undo_clicked(int idx);
76  void sig_undo_all_clicked();
77  void sig_cancelled();
78 
79 
80 private:
81  TagEdit* _tag_edit=nullptr;
82  TagExpression _tag_expression;
83 
84  int _cur_idx;
85 
86 
90  QMap<Tag, ReplacedString> _tag_str_map;
91 
92 
93 
94 private:
95 
102  bool replace_selected_tag_text(Tag t, bool activate);
103 
104 
109  void apply_tag(int idx);
110 
111 
115  void track_idx_changed();
116 
117 
121  void reset();
122 
123 
128  void write_changes(int idx);
129 
130 
136  bool check_idx(int idx) const;
137 
138 
139 
140 
141 private slots:
145  void next_button_clicked();
146 
147 
151  void prev_button_clicked();
152 
153 
157  void apply_tag_clicked();
158  void apply_tag_all_clicked();
159 
160 
164  void album_all_changed(bool b);
165 
166 
170  void artist_all_changed(bool b);
171 
172 
176  void genre_all_changed(bool b);
177 
178 
182  void year_all_changed(bool b);
183 
184 
188  void discnumber_all_changed(bool b);
189 
190 
194  void rating_all_changed(bool b);
195 
196 
201  void btn_title_checked(bool b);
202 
203 
208  void btn_artist_checked(bool b);
209 
210 
215  void btn_album_checked(bool b);
216 
217 
222  void btn_track_nr_checked(bool b);
223 
224 
229  void btn_disc_nr_checked(bool b);
230 
231 
236  void btn_year_checked(bool b);
237 
238 
242  void tag_text_changed(const QString&);
243 
244 
249  void set_tag_colors(bool valid);
250 
251 
252 
256  void undo_clicked();
257 
258 
262  void undo_all_clicked();
263 
264 
269  void progress_changed(int val);
270 
271 
275  void metadata_changed(const MetaDataList&);
276 
277 
278 
282  void language_changed() override;
283 
287  void commit_finished();
288 
289 };
290 
291 #endif
The TagEdit class.
Definition: TagEdit.h:38
The GUI_TagEdit class.
Definition: GUI_TagEdit.h:42
Definition: MetaDataList.h:46
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.
TagEdit * get_tag_edit() const
Get tag edit object.
void cancel()
calls undo_all, and closes the entire dialog
The TagExpression class.
Definition: TagExpression.h:49
Definition: ui_GUI_TagEdit.h:532