[libcalamares] Make status of JobQueue queryable
- while the queue is executing (the thread is running jobs) the isRunning() method returns true. - re-work some internals to reset isRunning() before emitting finished() signal.
This commit is contained in:
parent
112895fddc
commit
184462a875
@ -140,7 +140,7 @@ private:
|
|||||||
m_queue, "failed", Qt::QueuedConnection, Q_ARG( QString, message ), Q_ARG( QString, details ) );
|
m_queue, "failed", Qt::QueuedConnection, Q_ARG( QString, message ), Q_ARG( QString, details ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void emitFinished() { QMetaObject::invokeMethod( m_queue, "finished", Qt::QueuedConnection ); }
|
void emitFinished() { QMetaObject::invokeMethod( m_queue, "finish", Qt::QueuedConnection ); }
|
||||||
};
|
};
|
||||||
|
|
||||||
JobThread::~JobThread() {}
|
JobThread::~JobThread() {}
|
||||||
@ -195,6 +195,7 @@ JobQueue::start()
|
|||||||
Q_ASSERT( !m_thread->isRunning() );
|
Q_ASSERT( !m_thread->isRunning() );
|
||||||
m_thread->setJobs( std::move( m_jobs ) );
|
m_thread->setJobs( std::move( m_jobs ) );
|
||||||
m_jobs.clear();
|
m_jobs.clear();
|
||||||
|
m_finished = false;
|
||||||
m_thread->start();
|
m_thread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,4 +217,11 @@ JobQueue::enqueue( const JobList& jobs )
|
|||||||
emit queueChanged( m_jobs );
|
emit queueChanged( m_jobs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
JobQueue::finish()
|
||||||
|
{
|
||||||
|
m_finished = true;
|
||||||
|
emit finished();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
||||||
|
@ -45,6 +45,11 @@ public:
|
|||||||
void enqueue( const JobList& jobs );
|
void enqueue( const JobList& jobs );
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
|
bool isRunning() const { return !m_finished; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void finish();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void queueChanged( const JobList& jobs );
|
void queueChanged( const JobList& jobs );
|
||||||
void progress( qreal percent, const QString& prettyName );
|
void progress( qreal percent, const QString& prettyName );
|
||||||
@ -57,6 +62,7 @@ private:
|
|||||||
JobList m_jobs;
|
JobList m_jobs;
|
||||||
JobThread* m_thread;
|
JobThread* m_thread;
|
||||||
GlobalStorage* m_storage;
|
GlobalStorage* m_storage;
|
||||||
|
bool m_finished = true; ///< Initially, not running
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
||||||
|
Loading…
Reference in New Issue
Block a user