1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 22:26:32 +02:00

* Show / hide the empty-tooltip when sliding.

This commit is contained in:
Christian Muehlhaeuser
2012-06-01 07:46:59 +02:00
parent 83e073fc7c
commit 1da5ea8ae7
2 changed files with 15 additions and 2 deletions

View File

@@ -27,6 +27,7 @@
#include "PlaylistView.h" #include "PlaylistView.h"
#include "Source.h" #include "Source.h"
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
#include "widgets/OverlayWidget.h"
using namespace Tomahawk; using namespace Tomahawk;
@@ -42,18 +43,20 @@ QueueView::QueueView( AnimatedSplitter* parent )
setHiddenSize( QSize( 0, 22 ) ); setHiddenSize( QSize( 0, 22 ) );
ui->queue->setEmptyTip( tr( "The queue is currently empty. Drop something to enqueue it!" ) );
ui->queue->setProxyModel( new QueueProxyModel( ui->queue ) ); ui->queue->setProxyModel( new QueueProxyModel( ui->queue ) );
ui->queue->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored ); ui->queue->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );
PlaylistModel* queueModel = new PlaylistModel( this ); PlaylistModel* queueModel = new PlaylistModel( this );
queueModel->setStyle( PlaylistModel::Short ); queueModel->setStyle( PlaylistModel::Short );
queueModel->finishLoading();
ui->queue->setPlaylistModel( queueModel ); ui->queue->setPlaylistModel( queueModel );
queueModel->setReadOnly( false ); queueModel->setReadOnly( false );
queueModel->finishLoading();
ui->queue->setEmptyTip( tr( "The queue is currently empty. Drop something to enqueue it!" ) );
connect( queueModel, SIGNAL( trackCountChanged( unsigned int ) ), SLOT( updateLabel() ) ); connect( queueModel, SIGNAL( trackCountChanged( unsigned int ) ), SLOT( updateLabel() ) );
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) ); connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) );
connect( this, SIGNAL( animationFinished() ), SLOT( onAnimationFinished() ) );
ui->toggleButton->installEventFilter( this ); ui->toggleButton->installEventFilter( this );
ui->toggleButton->setCursor( Qt::PointingHandCursor ); ui->toggleButton->setCursor( Qt::PointingHandCursor );
@@ -125,6 +128,7 @@ QueueView::hide()
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) ); connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) );
disconnect( ui->toggleButton, SIGNAL( resized( QPoint ) ), this, SIGNAL( resizeBy( QPoint ) ) ); disconnect( ui->toggleButton, SIGNAL( resized( QPoint ) ), this, SIGNAL( resizeBy( QPoint ) ) );
ui->queue->overlay()->setVisible( false );
AnimatedWidget::hide(); AnimatedWidget::hide();
updateLabel(); updateLabel();
} }
@@ -137,6 +141,7 @@ QueueView::show()
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( hide() ) ); connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( hide() ) );
connect( ui->toggleButton, SIGNAL( resized( QPoint ) ), SIGNAL( resizeBy( QPoint ) ) ); connect( ui->toggleButton, SIGNAL( resized( QPoint ) ), SIGNAL( resizeBy( QPoint ) ) );
ui->queue->overlay()->setVisible( false );
AnimatedWidget::show(); AnimatedWidget::show();
updateLabel(); updateLabel();
} }
@@ -162,6 +167,13 @@ QueueView::onHidden( QWidget* widget, bool animated )
} }
void
QueueView::onAnimationFinished()
{
ui->queue->overlay()->setVisible( true );
}
void void
QueueView::updateLabel() QueueView::updateLabel()
{ {

View File

@@ -59,6 +59,7 @@ protected:
private slots: private slots:
void updateLabel(); void updateLabel();
void onAnimationFinished();
private: private:
Ui::QueueView* ui; Ui::QueueView* ui;