Sayonara Player
GUI_TagEdit.h
1 /* GUI_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 GUI_TAGEDIT_H_
22 #define GUI_TAGEDIT_H_
23 
24 #include "Gui/Utils/Widgets/Widget.h"
25 #include "Components/Tagging/Expression.h"
26 #include "Utils/Pimpl.h"
27 
32 namespace Tagging
33 {
34  class Editor;
35 }
36 
37 class QAbstractButton;
38 class MetaDataList;
39 class MetaData;
40 
41 UI_FWD(GUI_TagEdit)
42 
43 class GUI_TagEdit :
44  public Gui::Widget
45 {
46  Q_OBJECT
47  UI_CLASS(GUI_TagEdit)
48  PIMPL(GUI_TagEdit)
49 
50  signals:
51  void sigOkClicked(const MetaDataList&);
52  void sigUndoClicked(int idx);
53  void sigUndoAllClicked();
54  void sigCancelled();
55 
56  public:
57  explicit GUI_TagEdit(QWidget* parent=nullptr);
58  ~GUI_TagEdit() override;
59 
63  void commit();
64 
68  void cancel();
69 
75  void showCloseButton(bool show);
76 
77  void showDefaultTab();
81  void showCoverTab();
82 
83 
84  void setMetadata(const MetaDataList& v_md);
85  int count() const;
86 
87  Tagging::Editor* editor() const;
88 
89  QAbstractButton* saveButton();
90  QAbstractButton* closeButton();
91 
92  private:
93  void setCurrentIndex(int index);
94  void initCompleter();
95 
99  void refreshCurrentTrack();
100 
104  void reset();
105 
110  void writeChanges(int idx);
111 
117  bool checkIndex(int idx) const;
118 
119  Tagging::Editor* createEditor();
120  void runEditor(Tagging::Editor* editor);
121 
122  private slots:
126  void nextButtonClicked();
127 
131  void prevButtonClicked();
132 
136  void undoClicked();
137 
141  void undoAllClicked();
142 
147  void progressChanged(int val);
148 
152  void metadataChanged(const MetaDataList&);
153 
154  void applyTagFromPath();
155 
156  void applyAllTagFromPath();
157 
161  void commitStarted();
162 
166  void commitFinished();
167 
171  void loadEntireAlbum();
172 
173  protected:
174  void showEvent(QShowEvent* e) override;
175  void languageChanged() override;
176 };
177 
178 #endif
GUI_TagEdit::showCoverTab
void showCoverTab()
Directly go to the cover tab.
GUI_TagEdit::commit
void commit()
Commits changes to db/file.
GUI_TagEdit::cancel
void cancel()
calls undo_all, and closes the entire dialog
GUI_TagEdit
Definition: GUI_TagEdit.h:45
MetaDataList
The MetaDataList class.
Definition: MetaDataList.h:37
Tagging::Editor
The TagEdit class Metadata has to be added using the set_metadata(const MetaDataList&) method....
Definition: Editor.h:43
Tagging
The GUI_TagEdit class.
Definition: GenreFetcher.h:34
GUI_TagEdit::showCloseButton
void showCloseButton(bool show)
shows/hides the close button. We don't need a close button when this widget is part of another
MetaData
The MetaData class.
Definition: MetaData.h:47