1 /*
2  * Cantata
3  *
4  * Copyright (c) 2011-2020 Craig Drummond <craig.p.drummond@gmail.com>
5  *
6  * ----
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; see the file COPYING.  If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef ALBUM_VIEW_H
25 #define ALBUM_VIEW_H
26 
27 #include "view.h"
28 #include <QList>
29 
30 class QImage;
31 class NetworkJob;
32 class QByteArray;
33 class QUrl;
34 class ContextEngine;
35 class Action;
36 
37 class AlbumView : public View
38 {
39     Q_OBJECT
40 public:
41     static const QLatin1String constCacheDir;
42     static const QLatin1String constInfoExt;
43 
44     AlbumView(QWidget *p);
45     ~AlbumView() override;
46 
47     void update(const Song &song, bool force=false) override;
48 
49 Q_SIGNALS:
50     void playSong(const QString &file);
51 
52 public Q_SLOTS:
53     void coverRetrieved(const Song &s, const QImage &img, const QString &file);
54     void coverUpdated(const Song &s, const QImage &img, const QString &file);
55     void playSong(const QUrl &u);
56 
57 private Q_SLOTS:
58     void showContextMenu(const QPoint &pos);
59     void refresh();
60     void clearCache();
61     void searchResponse(const QString &resp, const QString &lang);
62 
63 private:
64     void clearDetails();
65     void getTrackListing();
66     void getDetails();
67     void updateDetails(bool preservePos=false);
68     void abort() override;
69 
70 private:
71     QString currentArtist;
72     Action *refreshAction;
73     #ifndef Q_OS_WIN
74     Action *fullWidthCoverAction;
75     #endif
76     ContextEngine *engine;
77     int detailsReceived;
78     QString pic;
79     QString details;
80     QString trackList;
81     QString bioArtist;
82     QString bio;
83     QList<Song> songs;
84 };
85 
86 #endif
87