mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 16:29:43 +01:00
* Fixed TWK-325: Show a spinner animation while searching for tracks.
This commit is contained in:
parent
ca65bb2ccc
commit
e0b406e7ef
@ -56,6 +56,7 @@ explicit TrackView( QWidget* parent = 0 );
|
||||
TrackHeader* header() const { return m_header; }
|
||||
OverlayWidget* overlay() const { return m_overlay; }
|
||||
Tomahawk::ContextMenu* contextMenu() const { return m_contextMenu; }
|
||||
LoadingSpinner* loadingSpinner() const { return m_loadingSpinner; }
|
||||
|
||||
QModelIndex hoveredIndex() const { return m_hoveredIndex; }
|
||||
QModelIndex contextMenuIndex() const { return m_contextMenuIndex; }
|
||||
|
@ -38,9 +38,12 @@ using namespace Tomahawk;
|
||||
query_ptr
|
||||
Query::get( const QString& artist, const QString& track, const QString& album, const QID& qid, bool autoResolve )
|
||||
{
|
||||
if ( qid.isEmpty() )
|
||||
autoResolve = false;
|
||||
|
||||
query_ptr q = query_ptr( new Query( artist, track, album, qid, autoResolve ) );
|
||||
|
||||
if ( autoResolve && !qid.isEmpty() )
|
||||
if ( autoResolve )
|
||||
Pipeline::instance()->resolve( q );
|
||||
return q;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "sourcelist.h"
|
||||
#include "viewmanager.h"
|
||||
#include "dynamic/widgets/LoadingSpinner.h"
|
||||
#include "playlist/playlistmodel.h"
|
||||
#include "widgets/overlaywidget.h"
|
||||
|
||||
@ -48,11 +49,13 @@ SearchWidget::SearchWidget( const QString& search, QWidget* parent )
|
||||
ui->resultsView->setFrameShape( QFrame::NoFrame );
|
||||
ui->resultsView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||
|
||||
ui->resultsView->loadingSpinner()->fadeIn();
|
||||
m_queries << Tomahawk::Query::get( search, uuid() );
|
||||
|
||||
foreach ( const Tomahawk::query_ptr& query, m_queries )
|
||||
{
|
||||
connect( query.data(), SIGNAL( resultsAdded( QList<Tomahawk::result_ptr> ) ), SLOT( onResultsFound( QList<Tomahawk::result_ptr> ) ) );
|
||||
connect( query.data(), SIGNAL( resolvingFinished( bool ) ), SLOT( onQueryFinished() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,3 +100,10 @@ SearchWidget::onResultsFound( const QList<Tomahawk::result_ptr>& results )
|
||||
m_resultsModel->append( q );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SearchWidget::onQueryFinished()
|
||||
{
|
||||
ui->resultsView->loadingSpinner()->fadeOut();
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ signals:
|
||||
|
||||
private slots:
|
||||
void onResultsFound( const QList<Tomahawk::result_ptr>& results );
|
||||
void onQueryFinished();
|
||||
|
||||
private:
|
||||
Ui::SearchWidget *ui;
|
||||
|
Loading…
x
Reference in New Issue
Block a user