ALL GLORY TO THE HYPNOTOAD. Fixes issue 1374
This commit is contained in:
parent
f37467ac69
commit
f700df2f54
@ -228,6 +228,7 @@ set(SOURCES
|
||||
widgets/fileview.cpp
|
||||
widgets/fileviewlist.cpp
|
||||
widgets/freespacebar.cpp
|
||||
widgets/fullscreenhypnotoad.cpp
|
||||
widgets/lineedit.cpp
|
||||
widgets/linetextedit.cpp
|
||||
widgets/multiloadingindicator.cpp
|
||||
|
48
src/widgets/fullscreenhypnotoad.cpp
Normal file
48
src/widgets/fullscreenhypnotoad.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include "fullscreenhypnotoad.h"
|
||||
|
||||
#include <QMovie>
|
||||
|
||||
FullscreenHypnotoad::FullscreenHypnotoad()
|
||||
: movie_(new QMovie(":/hypnotoad.gif"))
|
||||
{
|
||||
setMovie(movie_);
|
||||
setScaledContents(true);
|
||||
|
||||
// White background
|
||||
QPalette p(palette());
|
||||
p.setColor(QPalette::Window, Qt::white);
|
||||
setPalette(p);
|
||||
}
|
||||
|
||||
void FullscreenHypnotoad::mouseReleaseEvent(QMouseEvent* e) {
|
||||
hide();
|
||||
}
|
||||
|
||||
void FullscreenHypnotoad::keyReleaseEvent(QKeyEvent* e) {
|
||||
hide();
|
||||
}
|
||||
|
||||
void FullscreenHypnotoad::showEvent(QShowEvent*) {
|
||||
movie_->start();
|
||||
}
|
||||
|
||||
void FullscreenHypnotoad::hideEvent(QHideEvent*) {
|
||||
movie_->stop();
|
||||
}
|
37
src/widgets/fullscreenhypnotoad.h
Normal file
37
src/widgets/fullscreenhypnotoad.h
Normal file
@ -0,0 +1,37 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
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 FULLSCREENHYPNOTOAD_H
|
||||
#define FULLSCREENHYPNOTOAD_H
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
class FullscreenHypnotoad : public QLabel {
|
||||
public:
|
||||
FullscreenHypnotoad();
|
||||
|
||||
protected:
|
||||
void keyReleaseEvent(QKeyEvent* e);
|
||||
void mouseReleaseEvent(QMouseEvent* e);
|
||||
void showEvent(QShowEvent* e);
|
||||
void hideEvent(QHideEvent* e);
|
||||
|
||||
private:
|
||||
QMovie* movie_;
|
||||
};
|
||||
|
||||
#endif // FULLSCREENHYPNOTOAD_H
|
@ -15,6 +15,7 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "fullscreenhypnotoad.h"
|
||||
#include "nowplayingwidget.h"
|
||||
#include "core/albumcoverloader.h"
|
||||
#include "core/kittenloader.h"
|
||||
@ -69,7 +70,7 @@ NowPlayingWidget::NowPlayingWidget(QWidget *parent)
|
||||
load_cover_id_(0),
|
||||
details_(new QTextDocument(this)),
|
||||
previous_track_opacity_(0.0),
|
||||
hypnotoad_(NULL),
|
||||
bask_in_his_glory_action_(NULL),
|
||||
aww_(false)
|
||||
{
|
||||
// Load settings
|
||||
@ -110,6 +111,10 @@ NowPlayingWidget::NowPlayingWidget(QWidget *parent)
|
||||
connect(above_statusbar_action_, SIGNAL(toggled(bool)), SLOT(ShowAboveStatusBar(bool)));
|
||||
above_statusbar_action_->setChecked(s.value("above_status_bar", false).toBool());
|
||||
|
||||
bask_in_his_glory_action_ = menu_->addAction(tr("ALL GLORY TO THE HYPNOTOAD"));
|
||||
bask_in_his_glory_action_->setVisible(false);
|
||||
connect(bask_in_his_glory_action_, SIGNAL(triggered()), SLOT(Bask()));
|
||||
|
||||
// Animations
|
||||
connect(show_hide_animation_, SIGNAL(frameChanged(int)), SLOT(SetHeight(int)));
|
||||
setMaximumHeight(0);
|
||||
@ -122,6 +127,9 @@ NowPlayingWidget::NowPlayingWidget(QWidget *parent)
|
||||
connect(cover_loader_, SIGNAL(Initialised()), SLOT(CoverLoaderInitialised()));
|
||||
}
|
||||
|
||||
NowPlayingWidget::~NowPlayingWidget() {
|
||||
}
|
||||
|
||||
void NowPlayingWidget::CreateModeAction(Mode mode, const QString &text, QActionGroup *group, QSignalMapper* mapper) {
|
||||
QAction* action = new QAction(text, group);
|
||||
action->setCheckable(true);
|
||||
@ -384,6 +392,8 @@ void NowPlayingWidget::contextMenuEvent(QContextMenuEvent* e) {
|
||||
album_cover_choice_controller_->show_cover_action()->setEnabled(!art_is_not_set);
|
||||
}
|
||||
|
||||
bask_in_his_glory_action_->setVisible(hypnotoad_);
|
||||
|
||||
// show the menu
|
||||
menu_->popup(mapToGlobal(e->pos()));
|
||||
}
|
||||
@ -402,13 +412,12 @@ bool NowPlayingWidget::show_above_status_bar() const {
|
||||
|
||||
void NowPlayingWidget::AllHail(bool hypnotoad) {
|
||||
if (hypnotoad) {
|
||||
hypnotoad_ = new QMovie(kHypnotoadPath, QByteArray(), this);
|
||||
connect(hypnotoad_, SIGNAL(updated(const QRect&)), SLOT(update()));
|
||||
hypnotoad_.reset(new QMovie(kHypnotoadPath, QByteArray(), this));
|
||||
connect(hypnotoad_.get(), SIGNAL(updated(const QRect&)), SLOT(update()));
|
||||
hypnotoad_->start();
|
||||
update();
|
||||
} else {
|
||||
delete hypnotoad_;
|
||||
hypnotoad_ = NULL;
|
||||
hypnotoad_.reset();
|
||||
update();
|
||||
}
|
||||
}
|
||||
@ -462,3 +471,8 @@ void NowPlayingWidget::ShowCover() {
|
||||
void NowPlayingWidget::SetLibraryBackend(LibraryBackend* backend) {
|
||||
album_cover_choice_controller_->SetLibrary(backend);
|
||||
}
|
||||
|
||||
void NowPlayingWidget::Bask() {
|
||||
big_hypnotoad_.reset(new FullscreenHypnotoad);
|
||||
big_hypnotoad_->showFullScreen();
|
||||
}
|
||||
|
@ -23,8 +23,11 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
class AlbumCoverChoiceController;
|
||||
class AlbumCoverLoader;
|
||||
class FullscreenHypnotoad;
|
||||
class LibraryBackend;
|
||||
|
||||
class QAction;
|
||||
@ -40,6 +43,7 @@ class NowPlayingWidget : public QWidget {
|
||||
|
||||
public:
|
||||
NowPlayingWidget(QWidget* parent = 0);
|
||||
~NowPlayingWidget();
|
||||
|
||||
static const char* kSettingsGroup;
|
||||
static const int kPadding;
|
||||
@ -95,6 +99,8 @@ private slots:
|
||||
void UnsetCover();
|
||||
void ShowCover();
|
||||
|
||||
void Bask();
|
||||
|
||||
private:
|
||||
void CreateModeAction(Mode mode, const QString& text, QActionGroup* group,
|
||||
QSignalMapper* mapper);
|
||||
@ -134,7 +140,9 @@ private:
|
||||
qreal previous_track_opacity_;
|
||||
|
||||
static const char* kHypnotoadPath;
|
||||
QMovie* hypnotoad_;
|
||||
QAction* bask_in_his_glory_action_;
|
||||
boost::scoped_ptr<QMovie> hypnotoad_;
|
||||
boost::scoped_ptr<FullscreenHypnotoad> big_hypnotoad_;
|
||||
|
||||
bool aww_;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user