2010-06-17 00:00:39 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-06-17 00:00:39 +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 NOWPLAYINGWIDGET_H
|
|
|
|
#define NOWPLAYINGWIDGET_H
|
|
|
|
|
|
|
|
#include "core/backgroundthread.h"
|
|
|
|
#include "core/song.h"
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
2011-01-24 01:09:57 +01:00
|
|
|
class AlbumCoverChoiceController;
|
2010-06-17 00:00:39 +02:00
|
|
|
class AlbumCoverLoader;
|
2010-12-26 18:16:40 +01:00
|
|
|
class LibraryBackend;
|
2010-06-17 00:00:39 +02:00
|
|
|
|
2011-01-24 01:09:57 +01:00
|
|
|
class QAction;
|
2010-06-17 23:38:03 +02:00
|
|
|
class QActionGroup;
|
|
|
|
class QMenu;
|
Fixes issu...
,'``.._ ,'``.
:,--._:)\,:,._,.: All Glory to
:`--,'' :`...';\ the HYPNO TOAD!
`,' `---' `.
/ :
/ \
,' :\.___,-.
`...,---'``````-..._ |: \
( ) ;: ) \ _,-.
`. ( // `' \
: `.// ) ) , ;
,-|`. _,'/ ) ) ,' ,'
( :`.`-..____..=:.-': . _,' ,'
`,'\ ``--....-)=' `._, \ ,') _ '``._
_.-/ _ `. (_) / )' ; / \ \`-.'
`--( `-:`. `' ___..' _,-' |/ `.)
`-. `.`.``-----``--, .'
|/`.\`' ,','); SSt
` (/ (/
2010-07-12 21:51:23 +02:00
|
|
|
class QMovie;
|
2010-06-17 23:38:03 +02:00
|
|
|
class QSignalMapper;
|
2010-06-17 00:00:39 +02:00
|
|
|
class QTextDocument;
|
|
|
|
class QTimeLine;
|
|
|
|
|
|
|
|
class NowPlayingWidget : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
NowPlayingWidget(QWidget* parent = 0);
|
|
|
|
|
2010-06-18 00:31:22 +02:00
|
|
|
static const char* kSettingsGroup;
|
2010-06-17 00:00:39 +02:00
|
|
|
static const int kPadding;
|
2010-06-17 23:38:03 +02:00
|
|
|
static const int kGradientHead;
|
|
|
|
static const int kGradientTail;
|
|
|
|
static const int kMaxCoverSize;
|
|
|
|
static const int kBottomOffset;
|
2010-06-18 02:24:09 +02:00
|
|
|
static const int kTopBorder;
|
2010-06-17 23:38:03 +02:00
|
|
|
|
|
|
|
// Values are saved in QSettings
|
|
|
|
enum Mode {
|
|
|
|
SmallSongDetails = 0,
|
|
|
|
LargeSongDetails = 1,
|
|
|
|
};
|
2010-06-17 00:00:39 +02:00
|
|
|
|
2010-12-26 18:16:40 +01:00
|
|
|
void SetLibraryBackend(LibraryBackend* backend);
|
2010-06-17 00:00:39 +02:00
|
|
|
|
2010-12-26 18:16:40 +01:00
|
|
|
void set_ideal_height(int height);
|
2010-06-18 02:06:59 +02:00
|
|
|
bool show_above_status_bar() const;
|
|
|
|
|
2010-06-17 00:00:39 +02:00
|
|
|
QSize sizeHint() const;
|
|
|
|
|
2010-06-18 02:06:59 +02:00
|
|
|
signals:
|
|
|
|
void ShowAboveStatusBarChanged(bool above);
|
|
|
|
|
2010-06-17 00:00:39 +02:00
|
|
|
public slots:
|
|
|
|
void NowPlaying(const Song& metadata);
|
|
|
|
void Stopped();
|
Fixes issu...
,'``.._ ,'``.
:,--._:)\,:,._,.: All Glory to
:`--,'' :`...';\ the HYPNO TOAD!
`,' `---' `.
/ :
/ \
,' :\.___,-.
`...,---'``````-..._ |: \
( ) ;: ) \ _,-.
`. ( // `' \
: `.// ) ) , ;
,-|`. _,'/ ) ) ,' ,'
( :`.`-..____..=:.-': . _,' ,'
`,'\ ``--....-)=' `._, \ ,') _ '``._
_.-/ _ `. (_) / )' ; / \ \`-.'
`--( `-:`. `' ___..' _,-' |/ `.)
`-. `.`.``-----``--, .'
|/`.\`' ,','); SSt
` (/ (/
2010-07-12 21:51:23 +02:00
|
|
|
void AllHail(bool hypnotoad);
|
2010-12-10 15:26:29 +01:00
|
|
|
void EnableKittens(bool aww);
|
2010-06-17 00:00:39 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent* e);
|
2010-06-17 23:38:03 +02:00
|
|
|
void resizeEvent(QResizeEvent*);
|
|
|
|
void contextMenuEvent(QContextMenuEvent* e);
|
2010-06-17 00:00:39 +02:00
|
|
|
|
|
|
|
private slots:
|
2010-06-17 23:38:03 +02:00
|
|
|
void SetMode(int mode);
|
2010-06-18 02:06:59 +02:00
|
|
|
void ShowAboveStatusBar(bool above);
|
2010-06-17 23:38:03 +02:00
|
|
|
|
2010-06-17 00:00:39 +02:00
|
|
|
void CoverLoaderInitialised();
|
2011-01-31 21:53:38 +01:00
|
|
|
void AlbumArtLoaded(quint64 id, const QImage& scaled, const QImage& original);
|
2010-06-17 00:00:39 +02:00
|
|
|
|
|
|
|
void SetVisible(bool visible);
|
|
|
|
void SetHeight(int height);
|
|
|
|
|
|
|
|
void FadePreviousTrack(qreal value);
|
|
|
|
|
2010-12-26 18:16:40 +01:00
|
|
|
void LoadCoverFromFile();
|
2011-02-02 17:22:04 +01:00
|
|
|
void SaveCoverToFile();
|
2011-01-23 21:24:17 +01:00
|
|
|
void LoadCoverFromURL();
|
2011-01-24 01:09:57 +01:00
|
|
|
void SearchForCover();
|
2010-12-26 18:16:40 +01:00
|
|
|
void UnsetCover();
|
2011-01-24 01:09:57 +01:00
|
|
|
void ShowCover();
|
2010-12-26 18:16:40 +01:00
|
|
|
|
2010-06-17 00:00:39 +02:00
|
|
|
private:
|
2010-06-17 23:38:03 +02:00
|
|
|
void CreateModeAction(Mode mode, const QString& text, QActionGroup* group,
|
|
|
|
QSignalMapper* mapper);
|
|
|
|
void UpdateDetailsText();
|
2010-12-10 15:26:29 +01:00
|
|
|
void UpdateHeight(AlbumCoverLoader* loader);
|
2010-06-17 00:00:39 +02:00
|
|
|
void DrawContents(QPainter* p);
|
|
|
|
|
|
|
|
private:
|
2011-01-24 01:09:57 +01:00
|
|
|
AlbumCoverChoiceController* album_cover_choice_controller_;
|
2011-01-23 21:24:17 +01:00
|
|
|
|
2010-06-17 00:00:39 +02:00
|
|
|
BackgroundThread<AlbumCoverLoader>* cover_loader_;
|
2010-12-10 15:26:29 +01:00
|
|
|
BackgroundThread<AlbumCoverLoader>* kitten_loader_;
|
2010-06-17 00:00:39 +02:00
|
|
|
|
2010-06-17 23:38:03 +02:00
|
|
|
Mode mode_;
|
|
|
|
|
|
|
|
QMenu* menu_;
|
2011-01-24 01:09:57 +01:00
|
|
|
|
2010-06-18 02:06:59 +02:00
|
|
|
QAction* above_statusbar_action_;
|
2011-01-24 01:09:57 +01:00
|
|
|
|
2010-06-17 00:00:39 +02:00
|
|
|
bool visible_;
|
2010-06-17 23:38:03 +02:00
|
|
|
int small_ideal_height_;
|
|
|
|
int cover_height_;
|
|
|
|
int total_height_;
|
2010-06-17 00:00:39 +02:00
|
|
|
QTimeLine* show_hide_animation_;
|
|
|
|
QTimeLine* fade_animation_;
|
|
|
|
|
2010-06-17 23:38:03 +02:00
|
|
|
// Information about the current track
|
2010-06-17 00:00:39 +02:00
|
|
|
Song metadata_;
|
|
|
|
quint64 load_cover_id_;
|
|
|
|
QPixmap cover_;
|
2011-01-31 21:53:38 +01:00
|
|
|
// A copy of the original, unscaled album cover.
|
|
|
|
QImage original_;
|
2010-06-17 00:00:39 +02:00
|
|
|
QTextDocument* details_;
|
|
|
|
|
2010-06-17 23:38:03 +02:00
|
|
|
// Holds the last track while we're fading to the new track
|
2010-06-17 00:00:39 +02:00
|
|
|
QPixmap previous_track_;
|
|
|
|
qreal previous_track_opacity_;
|
Fixes issu...
,'``.._ ,'``.
:,--._:)\,:,._,.: All Glory to
:`--,'' :`...';\ the HYPNO TOAD!
`,' `---' `.
/ :
/ \
,' :\.___,-.
`...,---'``````-..._ |: \
( ) ;: ) \ _,-.
`. ( // `' \
: `.// ) ) , ;
,-|`. _,'/ ) ) ,' ,'
( :`.`-..____..=:.-': . _,' ,'
`,'\ ``--....-)=' `._, \ ,') _ '``._
_.-/ _ `. (_) / )' ; / \ \`-.'
`--( `-:`. `' ___..' _,-' |/ `.)
`-. `.`.``-----``--, .'
|/`.\`' ,','); SSt
` (/ (/
2010-07-12 21:51:23 +02:00
|
|
|
|
|
|
|
static const char* kHypnotoadPath;
|
|
|
|
QMovie* hypnotoad_;
|
2010-12-10 15:26:29 +01:00
|
|
|
|
|
|
|
bool aww_;
|
2010-06-17 00:00:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NOWPLAYINGWIDGET_H
|