mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 16:14:40 +02:00
TWK-401: Only update source stats after addfiles dbcmd is finished, instead of playing a race condition game. Also, refresh recent albums on stats change
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
#include "databasecommand_collectionstats.h"
|
#include "databasecommand_collectionstats.h"
|
||||||
#include "databaseimpl.h"
|
#include "databaseimpl.h"
|
||||||
#include "network/controlconnection.h"
|
#include "network/controlconnection.h"
|
||||||
|
#include "sourcelist.h"
|
||||||
|
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
|
||||||
@@ -72,7 +73,15 @@ DatabaseCommand_AddFiles::postCommitHook()
|
|||||||
emit notify( m_queries );
|
emit notify( m_queries );
|
||||||
|
|
||||||
if( source()->isLocal() )
|
if( source()->isLocal() )
|
||||||
|
{
|
||||||
Servent::instance()->triggerDBSync();
|
Servent::instance()->triggerDBSync();
|
||||||
|
|
||||||
|
// Re-calculate local db stats
|
||||||
|
DatabaseCommand_CollectionStats* cmd = new DatabaseCommand_CollectionStats( SourceList::instance()->getLocal() );
|
||||||
|
connect( cmd, SIGNAL( done( QVariantMap ) ),
|
||||||
|
SourceList::instance()->getLocal().data(), SLOT( setStats( QVariantMap ) ), Qt::QueuedConnection );
|
||||||
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -108,6 +108,15 @@ void
|
|||||||
WelcomeWidget::updateRecentTracks()
|
WelcomeWidget::updateRecentTracks()
|
||||||
{
|
{
|
||||||
m_tracksModel->loadHistory( Tomahawk::source_ptr(), HISTORY_TRACK_ITEMS );
|
m_tracksModel->loadHistory( Tomahawk::source_ptr(), HISTORY_TRACK_ITEMS );
|
||||||
|
|
||||||
|
connect( SourceList::instance()->getLocal().data(), SIGNAL( stats( QVariantMap ) ), this, SLOT( updateRecentAdditions() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
WelcomeWidget::updateRecentAdditions()
|
||||||
|
{
|
||||||
|
m_recentAlbumsModel->clear();
|
||||||
|
m_recentAlbumsModel->addFilteredCollection( collection_ptr(), 20, DatabaseCommand_AllAlbums::ModificationTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -103,6 +103,7 @@ signals:
|
|||||||
public slots:
|
public slots:
|
||||||
void updateRecentTracks();
|
void updateRecentTracks();
|
||||||
void updatePlaylists();
|
void updatePlaylists();
|
||||||
|
void updateRecentAdditions();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSourceAdded( const Tomahawk::source_ptr& source );
|
void onSourceAdded( const Tomahawk::source_ptr& source );
|
||||||
|
@@ -283,14 +283,6 @@ MusicScanner::listerFinished( const QMap<QString, unsigned int>& newmtimes )
|
|||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// re-calculate source stats
|
|
||||||
{
|
|
||||||
DatabaseCommand_CollectionStats* cmd = new DatabaseCommand_CollectionStats( SourceList::instance()->getLocal() );
|
|
||||||
connect( cmd, SIGNAL( done( QVariantMap ) ),
|
|
||||||
SourceList::instance()->getLocal().data(), SLOT( setStats( QVariantMap ) ), Qt::QueuedConnection );
|
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !m_dirLister.isNull() )
|
if ( !m_dirLister.isNull() )
|
||||||
{
|
{
|
||||||
m_dirListerThreadController->quit();;
|
m_dirListerThreadController->quit();;
|
||||||
|
Reference in New Issue
Block a user