2010-10-02 15:37:10 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-10-02 15:37:10 +02:00
|
|
|
|
|
|
|
Clementine is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SONGINFOBASE_H
|
|
|
|
#define SONGINFOBASE_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
2010-10-10 18:09:20 +02:00
|
|
|
#include "collapsibleinfopane.h"
|
|
|
|
#include "songinfofetcher.h"
|
2010-10-02 15:37:10 +02:00
|
|
|
#include "core/song.h"
|
2010-10-16 17:22:14 +02:00
|
|
|
#include "playlist/playlistitem.h"
|
2010-12-04 17:19:30 +01:00
|
|
|
#include "smartplaylists/generator_fwd.h"
|
2010-10-10 18:09:20 +02:00
|
|
|
#include "widgets/widgetfadehelper.h"
|
2010-10-02 15:37:10 +02:00
|
|
|
|
2010-10-10 18:09:20 +02:00
|
|
|
class CollapsibleInfoPane;
|
|
|
|
class WidgetFadeHelper;
|
|
|
|
|
2010-12-30 18:35:10 +01:00
|
|
|
class QNetworkAccessManager;
|
2010-10-10 18:09:20 +02:00
|
|
|
class QScrollArea;
|
|
|
|
class QVBoxLayout;
|
2010-10-08 01:13:41 +02:00
|
|
|
|
2010-10-02 15:37:10 +02:00
|
|
|
class SongInfoBase : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2010-10-16 19:20:54 +02:00
|
|
|
SongInfoBase(QWidget* parent = 0);
|
2010-10-02 15:37:10 +02:00
|
|
|
|
2010-10-11 21:49:12 +02:00
|
|
|
static const char* kSettingsGroup;
|
|
|
|
|
2010-10-02 15:37:10 +02:00
|
|
|
public slots:
|
|
|
|
void SongChanged(const Song& metadata);
|
|
|
|
void SongFinished();
|
2010-10-16 15:56:49 +02:00
|
|
|
virtual void ReloadSettings();
|
2010-10-02 15:37:10 +02:00
|
|
|
|
2010-10-16 16:45:23 +02:00
|
|
|
signals:
|
|
|
|
void ShowSettingsDialog();
|
2011-11-11 22:35:25 +01:00
|
|
|
void DoGlobalSearch(const QString& query);
|
2010-10-16 16:45:23 +02:00
|
|
|
|
2010-10-02 15:37:10 +02:00
|
|
|
protected:
|
|
|
|
void showEvent(QShowEvent* e);
|
|
|
|
|
2010-10-10 18:09:20 +02:00
|
|
|
virtual void Update(const Song& metadata);
|
2010-10-09 14:39:49 +02:00
|
|
|
virtual bool NeedsUpdate(const Song& old_metadata, const Song& new_metadata) const { return true; }
|
2010-10-02 15:37:10 +02:00
|
|
|
|
2010-10-10 18:09:20 +02:00
|
|
|
void AddWidget(QWidget* widget);
|
|
|
|
void AddSection(CollapsibleInfoPane* section);
|
|
|
|
void Clear();
|
2010-10-11 21:49:12 +02:00
|
|
|
void CollapseSections();
|
2010-10-10 18:09:20 +02:00
|
|
|
|
|
|
|
protected slots:
|
2013-12-21 19:58:51 +01:00
|
|
|
virtual void InfoResultReady (int id, const CollapsibleInfoPane::Data& data);
|
2010-10-10 18:09:20 +02:00
|
|
|
virtual void ResultReady(int id, const SongInfoFetcher::Result& result);
|
|
|
|
|
|
|
|
protected:
|
2010-12-30 18:35:10 +01:00
|
|
|
QNetworkAccessManager* network_;
|
2010-10-10 18:09:20 +02:00
|
|
|
SongInfoFetcher* fetcher_;
|
|
|
|
int current_request_id_;
|
2010-10-08 01:13:41 +02:00
|
|
|
|
2010-10-09 14:39:49 +02:00
|
|
|
private:
|
|
|
|
void MaybeUpdate(const Song& metadata);
|
2010-10-16 16:45:23 +02:00
|
|
|
void ConnectWidget(QWidget* widget);
|
2010-10-09 14:39:49 +02:00
|
|
|
|
2010-10-11 23:42:31 +02:00
|
|
|
private slots:
|
|
|
|
void SectionToggled(bool value);
|
|
|
|
|
2010-10-02 15:37:10 +02:00
|
|
|
private:
|
2010-10-10 18:09:20 +02:00
|
|
|
QScrollArea* scroll_area_;
|
|
|
|
|
|
|
|
QVBoxLayout* container_;
|
|
|
|
QList<QWidget*> widgets_;
|
|
|
|
|
|
|
|
QWidget* section_container_;
|
|
|
|
QList<CollapsibleInfoPane*> sections_;
|
|
|
|
|
|
|
|
WidgetFadeHelper* fader_;
|
|
|
|
|
2010-10-02 15:37:10 +02:00
|
|
|
Song queued_metadata_;
|
2010-10-09 14:39:49 +02:00
|
|
|
Song old_metadata_;
|
2010-10-02 15:37:10 +02:00
|
|
|
bool dirty_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SONGINFOBASE_H
|
2013-12-21 19:58:51 +01:00
|
|
|
|