mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-04 21:27:58 +02:00
* Remove items from queue when they're played.
This commit is contained in:
@@ -47,6 +47,12 @@ QueueView::QueueView( AnimatedSplitter* parent )
|
|||||||
ui->queue->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );
|
ui->queue->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );
|
||||||
ui->queue->overlay()->setEnabled( false );
|
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() ) );
|
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) );
|
||||||
|
|
||||||
ui->toggleButton->installEventFilter( this );
|
ui->toggleButton->installEventFilter( this );
|
||||||
@@ -119,9 +125,8 @@ 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->toggleButton->setText( tr( "Show Queue" ) );
|
|
||||||
|
|
||||||
AnimatedWidget::hide();
|
AnimatedWidget::hide();
|
||||||
|
updateLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -132,8 +137,8 @@ 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->toggleButton->setText( tr( "Hide Queue" ) );
|
|
||||||
AnimatedWidget::show();
|
AnimatedWidget::show();
|
||||||
|
updateLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -155,3 +160,22 @@ QueueView::onHidden( QWidget* widget, bool animated )
|
|||||||
|
|
||||||
AnimatedWidget::onHidden( widget, 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:
|
protected:
|
||||||
void changeEvent( QEvent* e );
|
void changeEvent( QEvent* e );
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateLabel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::QueueView* ui;
|
Ui::QueueView* ui;
|
||||||
QTimer* m_dragTimer;
|
QTimer* m_dragTimer;
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show Queue</string>
|
<string>Open Queue</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
|
Reference in New Issue
Block a user