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