1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-19 23:41:51 +02:00

Show system notification when finishing download.

This commit is contained in:
Christian Muehlhaeuser 2015-03-31 19:03:15 +02:00
parent b896a7fb91
commit c9610a7426
2 changed files with 15 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include <QTimer>
#include "TomahawkSettings.h"
#include "infosystem/InfoSystem.h"
#include "utils/Logger.h"
DownloadManager* DownloadManager::s_instance = 0;
@ -158,6 +159,7 @@ DownloadManager::addJob( const downloadjob_ptr& job )
m_jobs << job;
emit jobAdded( job );
connect( job.data(), SIGNAL( finished() ), SLOT( onJobFinished() ) );
connect( job.data(), SIGNAL( finished() ), SLOT( checkJobs() ) );
connect( job.data(), SIGNAL( stateChanged( DownloadJob::TrackState, DownloadJob::TrackState ) ), SLOT( checkJobs() ) ) ;
// connect( job.data(), SIGNAL( stateChanged( DownloadJob::TrackState, DownloadJob::TrackState ) ), SIGNAL( stateChanged( DownloadJob::TrackState, DownloadJob::TrackState ) ) );
@ -248,6 +250,18 @@ DownloadManager::checkJobs()
}
void
DownloadManager::onJobFinished()
{
DownloadJob* job = qobject_cast<DownloadJob*>( sender() );
Tomahawk::InfoSystem::InfoPushData pushData( "DownloadManager", Tomahawk::InfoSystem::InfoNotifyUser,
tr( "Tomahawk finished downloading %1 by %2." ).arg( job->track()->track() ).arg( job->track()->artist() ),
Tomahawk::InfoSystem::PushNoFlag );
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
}
void
DownloadManager::pause()
{

View File

@ -63,6 +63,7 @@ signals:
void stateChanged( DownloadManagerState newState, DownloadManagerState oldState );
private slots:
void onJobFinished();
private:
QList< downloadjob_ptr > m_jobs;