[EVO] Add a priority on Jobs ; make DirectoryFetcher less important

master
Ulrich Van Den Hekke 12 years ago
parent 580753ab6d
commit 11302721f0

@ -32,6 +32,7 @@ QAtomicInt XinxJob::_count_job;
XinxJob::XinxJob() : _state(JOB_WAIT), _manager_delete(true)
{
setAutoDelete(false);
setPriority(0);
}
XinxJob::~XinxJob()
@ -54,11 +55,21 @@ void XinxJob::setManagerDelete(bool value)
_manager_delete = value;
}
bool XinxJob::managerDelete() const
bool XinxJob::isManagerDelete() const
{
return _manager_delete;
}
void XinxJob::setPriority(int value)
{
_priority = value;
}
int XinxJob::priority() const
{
return _priority;
}
QString XinxJob::status() const
{
switch (_state)

@ -48,7 +48,10 @@ public:
static int countRunningJob();
void setManagerDelete(bool value);
bool managerDelete() const;
bool isManagerDelete() const;
void setPriority(int value);
int priority() const;
public slots:
virtual void abort();
@ -68,6 +71,7 @@ protected:
static QAtomicInt _count_job;
QAtomicInt _state;
bool _manager_delete;
int _priority;
};
#endif // XINXJOBS_H

@ -91,7 +91,7 @@ void XinxJobManager::addJob(XinxJob* job)
d->_waiting_job_list.append(job);
}
emit jobAdded(job);
d->_pool->start(job);
d->_pool->start(job, job->priority());
//emit jobStarted(countTotalJob (), countRunningJob ());
emit progressRangeChanged(0, d->_progress_max);
emit progressValueChanged(d->_progress_value);
@ -134,7 +134,7 @@ void XinxJobManager::slotJobEnding()
qDebug() << "Remove job (" << countRunningJob() << "/" << countTotalJob() << ")";
if (job->managerDelete())
if (job->isManagerDelete())
{
job->deleteLater();
}

@ -40,6 +40,7 @@ bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
DirectoryFetcher::DirectoryFetcher()
{
setPriority(-100);
_matchedFileList = XinxPluginsLoader::self()->managedFilters();
}

Loading…
Cancel
Save