mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 00:09:47 +01:00
* Remove items from queue when they're played.
This commit is contained in:
parent
c829752b7e
commit
bb1800d27f
@ -47,6 +47,12 @@ QueueView::QueueView( AnimatedSplitter* parent )
|
||||
ui->queue->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );
|
||||
ui->queue->overlay()->setEnabled( false );
|
||||
|
||||
PlaylistModel* queueModel = new PlaylistModel( this );
|
||||
queueModel->setStyle( PlaylistModel::Short );
|
||||
ui->queue->setPlaylistModel( queueModel );
|
||||
queueModel->setReadOnly( false );
|
||||
|
||||
connect( queueModel, SIGNAL( trackCountChanged( unsigned int ) ), SLOT( updateLabel() ) );
|
||||
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) );
|
||||
|
||||
ui->toggleButton->installEventFilter( this );
|
||||
@ -119,9 +125,8 @@ QueueView::hide()
|
||||
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) );
|
||||
disconnect( ui->toggleButton, SIGNAL( resized( QPoint ) ), this, SIGNAL( resizeBy( QPoint ) ) );
|
||||
|
||||
ui->toggleButton->setText( tr( "Show Queue" ) );
|
||||
|
||||
AnimatedWidget::hide();
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
|
||||
@ -132,8 +137,8 @@ QueueView::show()
|
||||
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( hide() ) );
|
||||
connect( ui->toggleButton, SIGNAL( resized( QPoint ) ), SIGNAL( resizeBy( QPoint ) ) );
|
||||
|
||||
ui->toggleButton->setText( tr( "Hide Queue" ) );
|
||||
AnimatedWidget::show();
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
|
||||
@ -155,3 +160,22 @@ QueueView::onHidden( QWidget* widget, bool animated )
|
||||
|
||||
AnimatedWidget::onHidden( widget, animated );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QueueView::updateLabel()
|
||||
{
|
||||
if ( isHidden() )
|
||||
{
|
||||
const unsigned int c = queue()->model()->rowCount( QModelIndex() );
|
||||
|
||||
if ( c )
|
||||
ui->toggleButton->setText( tr( "Open Queue - %n item(s)", "", c ) );
|
||||
else
|
||||
ui->toggleButton->setText( tr( "Open Queue" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->toggleButton->setText( tr( "Close Queue" ) );
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,9 @@ public slots:
|
||||
protected:
|
||||
void changeEvent( QEvent* e );
|
||||
|
||||
private slots:
|
||||
void updateLabel();
|
||||
|
||||
private:
|
||||
Ui::QueueView* ui;
|
||||
QTimer* m_dragTimer;
|
||||
|
@ -38,7 +38,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show Queue</string>
|
||||
<string>Open Queue</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
|
Loading…
x
Reference in New Issue
Block a user