Permalink
Browse files

Clicking on a track widget now disables the widget, keeps the backgro…

…und in the same colour as pressed, and overlays a spinner.
  • Loading branch information...
1 parent f2cbc43 commit 179ae19549e1e0211c997f9bd5e9def6a4bba5f2 @eartle eartle committed Apr 23, 2012
Showing with 184 additions and 191 deletions.
  1. +14 −6 app/client/Last.fm.css
  2. +22 −16 app/client/Widgets/TrackWidget.cpp
  3. +2 −1 app/client/Widgets/TrackWidget.h
  4. +146 −168 app/client/Widgets/TrackWidget.ui
@@ -544,19 +544,17 @@ TrackWidget {
TrackWidget QFrame#frame {
border: none;
-}
-
-TrackWidget QStackedWidget {
- border: none;
padding: 10px 20px;
}
TrackWidget:hover {
background-color: #eeeeee;
}
-TrackWidget:pressed {
- background-color: #d6d6d6;
+TrackWidget:pressed,
+TrackWidget:disabled {
+ border-top: 1px solid #d6d6d6;
+ background-color: #d6d6d6;
}
TrackWidget#nowPlaying {
@@ -1343,3 +1341,13 @@ background-image: url(":/volume_knob_PRESS.png");
StatusBar QFrame#permanentWidget {
margin: 0px 10px;
}
+
+QDialog QLabel#as {
+ border: none;
+ background-repeat: no-repeat;
+ background-position: center;
+ qproperty-pixmap: url(":/as.png");
+ qproperty-scaledContents: true;
+ max-height: 64px;
+ max-width: 64px;
+}
@@ -23,7 +23,9 @@ TrackWidget::TrackWidget( Track& track, QWidget *parent )
{
ui->setupUi( this );
- ui->stackedWidget->setCurrentWidget( ui->trackPage );
+ m_spinner = new QLabel( this );
+ m_spinner->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
+ m_spinner->hide();
#ifdef NDEBUG
// hide the delete button from release builds until we get a proper design
@@ -47,8 +49,6 @@ TrackWidget::TrackWidget( Track& track, QWidget *parent )
ui->buy->setAttribute( Qt::WA_LayoutUsesWidgetRect );
setAttribute( Qt::WA_MacNoClickThrough );
- ui->stackedWidget->setAttribute( Qt::WA_MacNoClickThrough );
- ui->trackPage->setAttribute( Qt::WA_MacNoClickThrough );
ui->albumArt->setAttribute( Qt::WA_MacNoClickThrough );
ui->love->setAttribute( Qt::WA_MacNoClickThrough );
ui->tag->setAttribute( Qt::WA_MacNoClickThrough );
@@ -73,7 +73,7 @@ TrackWidget::~TrackWidget()
QSize
TrackWidget::sizeHint() const
{
- QSize sizeHint = ui->stackedWidget->sizeHint();
+ QSize sizeHint = ui->frame->sizeHint();
sizeHint.setWidth( QPushButton::sizeHint().width() );
return sizeHint;
}
@@ -123,29 +123,35 @@ TrackWidget::playNext()
void
TrackWidget::startSpinner()
{
- if ( !m_spinner )
+ m_spinner->setGeometry( rect() );
+
+ if ( !m_spinnerMovie )
{
- m_spinner = new QMovie( ":/loading_meta.gif", "GIF", this );
- m_spinner->setCacheMode( QMovie::CacheAll );
- ui->spinner->setMovie( m_spinner );
+ m_spinnerMovie = new QMovie( ":/loading_meta.gif", "GIF", this );
+ m_spinnerMovie->setCacheMode( QMovie::CacheAll );
+ m_spinner->setMovie( m_spinnerMovie );
}
- m_spinner->start();
- ui->stackedWidget->setCurrentWidget( ui->spinnerPage );
+ setEnabled( false );
+
+ m_spinnerMovie->start();
+ m_spinner->show();
}
void
TrackWidget::clearSpinner()
{
- if ( !m_spinner )
+ if ( !m_spinnerMovie )
{
- m_spinner = new QMovie( ":/loading_meta.gif", "GIF", this );
- m_spinner->setCacheMode( QMovie::CacheAll );
- ui->spinner->setMovie( m_spinner );
+ m_spinnerMovie = new QMovie( ":/loading_meta.gif", "GIF", this );
+ m_spinnerMovie->setCacheMode( QMovie::CacheAll );
+ m_spinner->setMovie( m_spinnerMovie );
}
- m_spinner->stop();
- ui->stackedWidget->setCurrentWidget( ui->trackPage );
+ setEnabled( true );
+
+ m_spinnerMovie->stop();
+ m_spinner->hide();
}
void
@@ -86,7 +86,8 @@ private slots:
bool m_nowPlaying;
bool m_triedFetchAlbumArt;
- QPointer<QMovie> m_spinner;
+ QPointer<QMovie> m_spinnerMovie;
+ class QLabel* m_spinner;
};
#endif // TRACKWIDGET_H
Oops, something went wrong.

0 comments on commit 179ae19

Please sign in to comment.