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
|
|
|
|
|
2014-02-06 14:48:00 +01:00
|
|
|
#include <memory>
|
2010-06-17 00:00:39 +02:00
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
2014-02-06 14:48:00 +01:00
|
|
|
#include "core/song.h"
|
|
|
|
#include "covers/albumcoverloaderoptions.h"
|
2011-03-13 23:46:25 +01:00
|
|
|
|
2011-01-24 01:09:57 +01:00
|
|
|
class AlbumCoverChoiceController;
|
2012-02-12 14:41:50 +01:00
|
|
|
class Application;
|
2011-03-13 23:46:25 +01:00
|
|
|
class FullscreenHypnotoad;
|
2012-02-13 21:44:04 +01:00
|
|
|
class KittenLoader;
|
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
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
2014-02-10 16:03:54 +01:00
|
|
|
NowPlayingWidget(QWidget* parent = nullptr);
|
2011-03-13 23:46:25 +01:00
|
|
|
~NowPlayingWidget();
|
2010-06-17 00:00:39 +02:00
|
|
|
|
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
|
2014-05-15 01:07:53 +02:00
|
|
|
enum Mode {
|
|
|
|
SmallSongDetails = 0,
|
|
|
|
LargeSongDetails = 1,
|
|
|
|
LargeSongDetailsBelow = 2,
|
2015-01-26 19:11:19 +01:00
|
|
|
LargeNoSongDetails = 3,
|
2014-05-15 01:07:53 +02:00
|
|
|
};
|
2010-06-17 00:00:39 +02:00
|
|
|
|
2012-02-12 14:41:50 +01:00
|
|
|
void SetApplication(Application* app);
|
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);
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public slots:
|
2010-06-17 00:00:39 +02:00
|
|
|
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
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
protected:
|
2010-06-17 00:00:39 +02:00
|
|
|
void paintEvent(QPaintEvent* e);
|
2010-06-17 23:38:03 +02:00
|
|
|
void resizeEvent(QResizeEvent*);
|
|
|
|
void contextMenuEvent(QContextMenuEvent* e);
|
2014-06-24 12:15:46 +02:00
|
|
|
void mouseReleaseEvent(QMouseEvent*);
|
2011-03-14 21:01:27 +01:00
|
|
|
void dragEnterEvent(QDragEnterEvent* e);
|
|
|
|
void dropEvent(QDropEvent* e);
|
2010-06-17 00:00:39 +02:00
|
|
|
|
2014-02-07 16:34:20 +01: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);
|
2014-05-15 22:02:46 +02:00
|
|
|
void FitCoverWidth(bool fit);
|
2010-06-17 23:38:03 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
void AlbumArtLoaded(const Song& metadata, const QString& uri,
|
|
|
|
const QImage& image);
|
2012-02-13 21:44:04 +01:00
|
|
|
void KittenLoaded(quint64 id, const QImage& image);
|
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();
|
2013-12-30 23:50:57 +01:00
|
|
|
void SearchCoverAutomatically();
|
2010-12-26 18:16:40 +01:00
|
|
|
|
2011-03-13 23:46:25 +01:00
|
|
|
void Bask();
|
|
|
|
|
2013-12-30 23:50:57 +01:00
|
|
|
void AutomaticCoverSearchDone();
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2010-06-17 23:38:03 +02:00
|
|
|
void CreateModeAction(Mode mode, const QString& text, QActionGroup* group,
|
|
|
|
QSignalMapper* mapper);
|
|
|
|
void UpdateDetailsText();
|
2012-02-13 21:44:04 +01:00
|
|
|
void UpdateHeight();
|
2010-06-17 00:00:39 +02:00
|
|
|
void DrawContents(QPainter* p);
|
2012-02-13 21:44:04 +01:00
|
|
|
void SetImage(const QImage& image);
|
|
|
|
void ScaleCover();
|
2013-12-30 23:50:57 +01:00
|
|
|
bool GetCoverAutomatically();
|
2010-06-17 00:00:39 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2012-02-12 14:41:50 +01:00
|
|
|
Application* app_;
|
2011-01-24 01:09:57 +01:00
|
|
|
AlbumCoverChoiceController* album_cover_choice_controller_;
|
2011-01-23 21:24:17 +01: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_;
|
2014-05-15 22:02:46 +02:00
|
|
|
QAction* fit_cover_width_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_;
|
2012-02-13 21:44:04 +01:00
|
|
|
AlbumCoverLoaderOptions cover_loader_options_;
|
2010-06-17 23:38:03 +02:00
|
|
|
int total_height_;
|
2014-05-15 22:02:46 +02:00
|
|
|
bool fit_width_;
|
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_;
|
|
|
|
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;
|
2011-03-13 23:46:25 +01:00
|
|
|
QAction* bask_in_his_glory_action_;
|
2014-02-06 14:48:00 +01:00
|
|
|
std::unique_ptr<QMovie> hypnotoad_;
|
|
|
|
std::unique_ptr<FullscreenHypnotoad> big_hypnotoad_;
|
2010-12-10 15:26:29 +01:00
|
|
|
|
2014-02-06 14:48:00 +01:00
|
|
|
std::unique_ptr<QMovie> spinner_animation_;
|
2013-12-30 23:50:57 +01:00
|
|
|
bool downloading_covers_;
|
|
|
|
|
2010-12-10 15:26:29 +01:00
|
|
|
bool aww_;
|
2012-02-13 21:44:04 +01:00
|
|
|
KittenLoader* kittens_;
|
|
|
|
quint64 pending_kitten_;
|
2010-06-17 00:00:39 +02:00
|
|
|
};
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
#endif // NOWPLAYINGWIDGET_H
|