mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-21 00:12:06 +02:00
Added IndexStatusManager, which observes indexing progress and creates a job-item accordingly.
This commit is contained in:
parent
fb66be9746
commit
a8642a687f
@ -18,7 +18,11 @@
|
||||
|
||||
#include "IndexingJobItem.h"
|
||||
|
||||
#include "JobStatusModel.h"
|
||||
#include "JobStatusView.h"
|
||||
#include "database/Database.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include <QPixmap>
|
||||
|
||||
@ -29,16 +33,40 @@ IndexingJobItem::mainText() const
|
||||
return tr( "Indexing Music Library" );
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
IndexingJobItem::icon() const
|
||||
{
|
||||
return TomahawkUtils::defaultPixmap( TomahawkUtils::ViewRefresh, TomahawkUtils::Original, QSize( 128, 128 ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void IndexingJobItem::done()
|
||||
void
|
||||
IndexingJobItem::done()
|
||||
{
|
||||
emit finished();
|
||||
}
|
||||
|
||||
|
||||
IndexStatusManager::IndexStatusManager( QObject* parent )
|
||||
: QObject( parent )
|
||||
{
|
||||
connect( Tomahawk::Database::instance(), SIGNAL( indexStarted() ), SLOT( started() ) );
|
||||
connect( Tomahawk::Database::instance(), SIGNAL( indexReady() ), SLOT( finished() ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IndexStatusManager::started()
|
||||
{
|
||||
m_curItem = new IndexingJobItem;
|
||||
JobStatusView::instance()->model()->addJob( m_curItem.data() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IndexStatusManager::finished()
|
||||
{
|
||||
if ( m_curItem )
|
||||
m_curItem->done();
|
||||
}
|
||||
|
@ -19,8 +19,9 @@
|
||||
#ifndef INDEXINGJOBITEM_H
|
||||
#define INDEXINGJOBITEM_H
|
||||
|
||||
#include <jobview/JobStatusItem.h>
|
||||
#include "JobStatusItem.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class IndexingJobItem : public JobStatusItem
|
||||
{
|
||||
@ -37,4 +38,19 @@ public:
|
||||
virtual QString type() const { return "indexerjob"; }
|
||||
};
|
||||
|
||||
class IndexStatusManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit IndexStatusManager( QObject* parent = 0 );
|
||||
virtual ~IndexStatusManager() {}
|
||||
|
||||
private slots:
|
||||
void started();
|
||||
void finished();
|
||||
|
||||
private:
|
||||
QPointer<IndexingJobItem> m_curItem;
|
||||
};
|
||||
|
||||
#endif // INDEXINGJOBITEM_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user