mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 16:14:40 +02:00
Show an error message when the station couldn't resolve enough tracks
This commit is contained in:
@@ -112,7 +112,7 @@ DynamicModel::trackResolveFinished( bool success )
|
|||||||
if( m_currentAttempts < 30 ) {
|
if( m_currentAttempts < 30 ) {
|
||||||
m_playlist->generator()->fetchNext();
|
m_playlist->generator()->fetchNext();
|
||||||
} else {
|
} else {
|
||||||
// TODO handle failure
|
emit trackGenerationFailure( tr( "Could not find a playable track.\n\nPlease change the filters and try again." ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@ class StationModelItem;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extends PlaylistModel with support for handling StationModelItems
|
* Extends PlaylistModel with support for handling stations
|
||||||
*/
|
*/
|
||||||
class DynamicModel : public PlaylistModel
|
class DynamicModel : public PlaylistModel
|
||||||
{
|
{
|
||||||
@@ -45,6 +45,8 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void collapseFromTo( int startRow, int num );
|
void collapseFromTo( int startRow, int num );
|
||||||
|
|
||||||
|
void trackGenerationFailure( const QString& msg );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void newTrackGenerated( const Tomahawk::query_ptr& query );
|
void newTrackGenerated( const Tomahawk::query_ptr& query );
|
||||||
|
|
||||||
|
@@ -78,6 +78,14 @@ DynamicView::showMessageTimeout( const QString& title, const QString& body )
|
|||||||
overlay()->show( 5 );
|
overlay()->show( 5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DynamicView::showMessage(const QString& message)
|
||||||
|
{
|
||||||
|
overlay()->setText( message );
|
||||||
|
overlay()->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DynamicView::onTrackCountChanged( unsigned int tracks )
|
DynamicView::onTrackCountChanged( unsigned int tracks )
|
||||||
{
|
{
|
||||||
|
@@ -42,6 +42,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showMessageTimeout( const QString& title, const QString& body );
|
void showMessageTimeout( const QString& title, const QString& body );
|
||||||
|
void showMessage( const QString& message );
|
||||||
|
|
||||||
// collapse and animate the transition
|
// collapse and animate the transition
|
||||||
// there MUST be a row *after* startRow + num. that is, you can't collapse
|
// there MUST be a row *after* startRow + num. that is, you can't collapse
|
||||||
|
@@ -112,7 +112,8 @@ DynamicControlWrapper::removeFromLayout()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QToolButton* DynamicControlWrapper::initButton( QWidget* parent )
|
QToolButton*
|
||||||
|
DynamicControlWrapper::initButton( QWidget* parent )
|
||||||
{
|
{
|
||||||
QToolButton* btn = new QToolButton( parent );
|
QToolButton* btn = new QToolButton( parent );
|
||||||
btn->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
|
btn->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
|
||||||
@@ -123,7 +124,8 @@ QToolButton* DynamicControlWrapper::initButton( QWidget* parent )
|
|||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* DynamicControlWrapper::createDummy( QWidget* fromW, QWidget* parent )
|
QWidget*
|
||||||
|
DynamicControlWrapper::createDummy( QWidget* fromW, QWidget* parent )
|
||||||
{
|
{
|
||||||
QWidget* dummy = new QWidget( parent );
|
QWidget* dummy = new QWidget( parent );
|
||||||
dummy->setContentsMargins( 0, 0, 0, 0 );
|
dummy->setContentsMargins( 0, 0, 0, 0 );
|
||||||
|
@@ -90,8 +90,9 @@ DynamicWidget::DynamicWidget( const Tomahawk::dynplaylist_ptr& playlist, QWidget
|
|||||||
m_view->setModel( m_model );
|
m_view->setModel( m_model );
|
||||||
m_view->setContentsMargins( 0, 0, 0, 0 );
|
m_view->setContentsMargins( 0, 0, 0, 0 );
|
||||||
m_layout->addWidget( m_view, 1 );
|
m_layout->addWidget( m_view, 1 );
|
||||||
|
|
||||||
connect( m_model, SIGNAL( collapseFromTo( int, int ) ), m_view, SLOT( collapseEntries( int, int ) ), Qt::QueuedConnection );
|
connect( m_model, SIGNAL( collapseFromTo( int, int ) ), m_view, SLOT( collapseEntries( int, int ) ), Qt::QueuedConnection );
|
||||||
|
connect( m_model, SIGNAL( trackGenerationFailure( QString ) ), m_view, SLOT( showMessage( QString ) ) );
|
||||||
loadDynamicPlaylist( playlist );
|
loadDynamicPlaylist( playlist );
|
||||||
|
|
||||||
m_layout->setContentsMargins( 0, 0, 0, 0 );
|
m_layout->setContentsMargins( 0, 0, 0, 0 );
|
||||||
|
Reference in New Issue
Block a user