Miam-Player  0.8.0
A nice music player
tageditor.h
Go to the documentation of this file.
1 #ifndef TAGEDITOR_H
2 #define TAGEDITOR_H
3 
5 #include <model/sqldatabase.h>
6 #include <cover.h>
7 #include <abstractview.h>
8 
9 #include "tagconverter.h"
10 #include "ui_tageditor.h"
11 
12 #include <QUrl>
13 #include <QWidget>
14 
15 class AcoustId;
16 
26 {
27  Q_OBJECT
28 private:
29  AcoustId* _acoustId;
30 
31  QMap<int, QComboBox*> _combos;
32 
33  static QStringList genres;
34 
35  QMap<int, Cover*> _covers;
36  QMap<int, Cover*> _unsavedCovers;
37 
38  QMap<int, QSet<QString>> _cacheData;
39 
40 public:
43 
44  explicit TagEditor(QWidget *parent = nullptr);
45 
46  void addDirectory(const QDir &dir);
47 
48  virtual QList<QUrl> selectedTracks() override;
49 
50  inline virtual ViewType type() const override { return VT_BuiltIn; }
51 
52  virtual void updateSelectedTracks() override;
53 
54  virtual bool viewProperty(Settings::ViewProperty vp) const override;
55 
56 protected:
58  virtual void changeEvent(QEvent *event) override;
59 
61  virtual void closeEvent(QCloseEvent *event) override;
62 
64  virtual void dragEnterEvent(QDragEnterEvent *event) override;
65 
67  virtual void dragMoveEvent(QDragMoveEvent *event) override;
68 
70  virtual void dropEvent(QDropEvent *event) override;
71 
73  virtual bool eventFilter(QObject *obj, QEvent *event) override;
74 
75 private:
77  void buildCache();
78 
79  void clearCovers(QMap<int, Cover *> &coversToRemove);
80 
82  void addTracks(const QStringList &tracks);
83 
84 public slots:
86  void addItemsToEditor(const QList<QUrl> &tracks);
87 
89  void clear();
90 
91  virtual void setViewProperty(Settings::ViewProperty vp, QVariant value) override;
92 
93 private slots:
94  void applyCoverToAll(bool isForAll, Cover *cover);
95 
96  void autoFetchTags();
97 
99  void commitChanges();
100 
102  void displayTags();
103 
105  void displayCover();
106 
107  void recordSingleItemChange(QTableWidgetItem *item);
108 
109  void replaceCover(Cover *newCover);
110 
112  void rollbackChanges();
113 
114  void updateCells(QString text);
115 
116 signals:
117  void aboutToCloseTagEditor();
118 };
119 
120 #endif // TAGEDITOR_H
ViewProperty
Definition: settings.h:32
virtual void updateSelectedTracks()=0
#define MIAMTAGEDITOR_LIBRARY
Definition: miamtageditor_global.hpp:8
The TagConverter class displays a small popup to help one to extract Tag into files and vice-versa...
Definition: tagconverter.h:17
ViewType
Definition: abstractview.h:39
The SelectedTracksModel class.
Definition: selectedtracksmodel.h:14
The Cover class.
Definition: cover.h:14
virtual bool viewProperty(Settings::ViewProperty) const
Definition: abstractview.h:61
The TagEditor class is the main class for editing metadata inside this soft.
Definition: tageditor.h:25
virtual void setViewProperty(Settings::ViewProperty vp, QVariant value)=0
The AcoustId class can fetch tags automatically from Webservice.
Definition: acoustid.h:17
virtual QList< QUrl > selectedTracks()=0
virtual ViewType type() const override
Definition: tageditor.h:50
Definition: ui_tageditor.h:427
The AbstractView class is the base class for all views in Miam-Player.
Definition: abstractview.h:22
TagConverter * tagConverter
Definition: tageditor.h:42
Definition: abstractview.h:40