MythTV  master
mythmusic/mythmusic/editmetadata.h
Go to the documentation of this file.
1 #ifndef EDITMETADATA_H_
2 #define EDITMETADATA_H_
3 
4 #include <iostream>
5 using namespace std;
6 
7 #include <mythscreentype.h>
8 #include <musicmetadata.h>
9 
10 class MythUIStateType;
11 class MythUIImage;
12 class MythUIButton;
13 class MythUIButtonList;
15 class MythUICheckBox;
16 class MythUISearchDialog;
17 
19 {
20  Q_OBJECT
21 
22  public:
23  EditMetadataCommon(MythScreenStack *parent, MusicMetadata *source_metadata, const QString &name);
24  EditMetadataCommon(MythScreenStack *parent, const QString &name)
25  : MythScreenType(parent, name) {}
26 
27  ~EditMetadataCommon(void);
28 
29  bool CreateCommon(void);
30 
31  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
32 
33  void setSaveMetadataOnly(void);
34 
35  signals:
36  void metadataChanged(void);
37 
38  protected slots:
39  void showSaveMenu(void);
40  static void saveToDatabase(void);
41  void saveToMetadata(void);
42  void saveAll(void);
43  void cleanupAndClose(void);
44 
45  protected:
46  static bool hasMetadataChanged(void);
47  void updateMetadata(void);
48  void searchForAlbumImages(void);
49  static void scanForImages(void);
50 
51  static bool s_metadataOnly;
54 
55  bool m_albumArtChanged {false};
56  QString m_searchType;
57  MythUIButton *m_doneButton {nullptr};
58 };
59 
61 {
62  Q_OBJECT
63 
64  public:
65  EditMetadataDialog(MythScreenStack *parent, MusicMetadata *source_metadata);
66  explicit EditMetadataDialog(MythScreenStack *parent);
67  ~EditMetadataDialog(void);
68 
69  bool Create(void) override; // MythScreenType
70 
71  bool keyPressEvent(QKeyEvent *event) override; // EditMetadataCommon
72  void customEvent(QEvent *event) override; // MythUIType
73 
74  protected slots:
75  void searchArtist(void);
76  void searchCompilationArtist(void);
77  void searchAlbum(void);
78  void searchGenre(void);
79 
80  void setArtist(const QString& artist);
81  void setCompArtist(const QString& compArtist);
82  void setAlbum(const QString& album);
83  void setGenre(const QString& genre);
84  void ratingSpinChanged(MythUIButtonListItem *item);
85 
86  void artistLostFocus(void);
87  void albumLostFocus(void);
88  void genreLostFocus(void);
89 
90  void incRating(void);
91  void decRating(void);
92 
93  void checkClicked(bool state);
94 
95  void switchToAlbumArt(void);
96 
97  private:
98  void showMenu(void);
99  void fillWidgets(void);
100 
101  void updateArtistImage(void);
102  void updateAlbumImage(void);
103  void updateGenreImage(void);
104 
105  void updateRating(void);
106 
107  void searchForArtistImages(void);
108  void searchForGenreImages(void);
109 
110  //
111  // GUI stuff
112  //
113  MythUITextEdit *m_artistEdit {nullptr};
114  MythUITextEdit *m_compArtistEdit {nullptr};
115  MythUITextEdit *m_albumEdit {nullptr};
116  MythUITextEdit *m_titleEdit {nullptr};
117  MythUITextEdit *m_genreEdit {nullptr};
118 
119  MythUISpinBox *m_yearSpin {nullptr};
120  MythUISpinBox *m_trackSpin {nullptr};
121  MythUISpinBox *m_discSpin {nullptr};
122  MythUISpinBox *m_ratingSpin {nullptr};
123 
124  MythUIStateType *m_ratingState {nullptr};
125  MythUIButton *m_incRatingButton {nullptr};
126  MythUIButton *m_decRatingButton {nullptr};
127 
128  MythUIButton *m_searchArtistButton {nullptr};
129  MythUIButton *m_searchCompArtistButton {nullptr};
130  MythUIButton *m_searchAlbumButton {nullptr};
131  MythUIButton *m_searchGenreButton {nullptr};
132 
133  MythUIImage *m_artistIcon {nullptr};
134  MythUIImage *m_albumIcon {nullptr};
135  MythUIImage *m_genreIcon {nullptr};
136 
137  MythUICheckBox *m_compilationCheck {nullptr};
138 
139  MythUIButton *m_albumartButton {nullptr};
140 };
141 
143 {
144  Q_OBJECT
145 
146  public:
147  explicit EditAlbumartDialog(MythScreenStack *parent);
149 
150  bool Create(void) override; // MythScreenType
151 
152  bool keyPressEvent(QKeyEvent *event) override; // EditMetadataCommon
153  void customEvent(QEvent *event) override; // MythUIType
154 
155  signals:
156  void metadataChanged(void);
157 
158  protected slots:
159  void switchToMetadata(void);
160  void showMenu(void);
161  void showTypeMenu(bool changeType = true);
162  void gridItemChanged(MythUIButtonListItem *item);
163 
164  void rescanForImages(void);
165 
166  void doRemoveImageFromTag(bool doIt);
167 
168  private:
169  void updateImageGrid(void);
170  void copySelectedImageToTag(void);
171  void removeSelectedImageFromTag(void);
172  void startCopyImageToTag(void);
173  void copyImageToTag(ImageType imageType);
174  void doCopyImageToTag(const AlbumArtImage *image);
175  static void removeCachedImage(const AlbumArtImage *image);
176 
178 
179  //
180  // GUI stuff
181  //
182  MythUIButton *m_metadataButton {nullptr};
183 
184  MythUIImage *m_coverartImage {nullptr};
185  MythUIButtonList *m_coverartList {nullptr};
186  MythUIText *m_imagetypeText {nullptr};
187  MythUIText *m_imagefilenameText {nullptr};
188 };
189 
190 #endif
This widget is used for grouping other widgets for display when a particular named state is called.
unsigned int slots[4]
Definition: element.c:38
A widget for offering a range of numerical values where only the the bounding values and interval are...
Definition: mythuispinbox.h:16
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
A checkbox widget supporting three check states - on,off,half and two conditions - selected and unsel...
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
A text entry and edit widget.
static MusicMetadata * s_metadata
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
A single button widget.
Definition: mythuibutton.h:21
ImageType
Definition: musicmetadata.h:26
Screen in which all other widgets are contained and rendered.
EditMetadataCommon(MythScreenStack *parent, const QString &name)
static MusicMetadata * s_sourceMetadata
Provide a dialog to quickly find an entry in a list.