Sayonara Player
CoverButton.h
1 /* CoverButton.h */
2 
3 /* Copyright (C) 2011-2017 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 COVER_BUTTON_H
22 #define COVER_BUTTON_H
23 
24 #include <QPushButton>
25 
26 #include "Utils/Pimpl.h"
27 #include "GUI/Utils/Widgets/WidgetTemplate.h"
28 
29 class QPixmap;
30 class QResizeEvent;
31 
32 namespace Cover
33 {
34  class Location;
35 }
36 
37 
42 class CoverButton :
43  public Gui::WidgetTemplate<QPushButton>
44 {
45  Q_OBJECT
46  PIMPL(CoverButton)
47 
48 signals:
49  void sig_rejected();
50 
51 public:
52  explicit CoverButton(QWidget* parent=nullptr);
53  virtual ~CoverButton();
54 
60  void set_cover_location(const Cover::Location& cl);
61 
67  void force_cover(const QImage& img);
68 
74  void force_cover(const QPixmap& img);
75 
76 
77 private:
78  QIcon current_icon() const;
79 
80 protected:
81  void paintEvent(QPaintEvent* event) override;
82  void showEvent(QShowEvent* e) override;
83 
84 private slots:
85  void cover_button_clicked();
86  void alternative_cover_fetched(const Cover::Location& cl);
87  void cover_lookup_finished(bool success);
88  void set_cover_image(const QPixmap& pm);
89 
90 public slots:
91  void refresh();
92 
93 };
94 
95 #endif
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition: WidgetTemplate.h:47
The CoverLocation class.
Definition: CoverLocation.h:43
The CoverButton class.
Definition: CoverButton.h:42
void set_cover_location(const Cover::Location &cl)
Set an appropriate cover location. Afterwards a search is triggered to find the cover.
void force_cover(const QImage &img)
Force a cover in order to override a searched cover. This is intended if the audio file contains a co...