mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +08:00
refs #521, reading of setup and version
* fixed in launcher so reloading works (this also uses fixed URL list) * signal for version synchronized * removed setupreader.h where possible -> less compile dependencies * removed redundant logging * removed unused cleanup override * connect &QCoreApplication::aboutToQuit in threaded reader
This commit is contained in:
@@ -17,7 +17,11 @@ namespace BlackMisc
|
||||
CThreadedReader::CThreadedReader(QObject *owner, const QString &name) :
|
||||
CContinuousWorker(owner, name),
|
||||
m_updateTimer(new QTimer(this))
|
||||
{ }
|
||||
{
|
||||
bool c = connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &CThreadedReader::gracefulShutdown);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||
Q_UNUSED(c);
|
||||
}
|
||||
|
||||
qint64 CThreadedReader::lastModifiedMsSinceEpoch(QNetworkReply *nwReply) const
|
||||
{
|
||||
@@ -51,7 +55,10 @@ namespace BlackMisc
|
||||
|
||||
void CThreadedReader::requestStop()
|
||||
{
|
||||
QMetaObject::invokeMethod(m_updateTimer, "stop");
|
||||
if (m_updateTimer)
|
||||
{
|
||||
QMetaObject::invokeMethod(m_updateTimer, "stop");
|
||||
}
|
||||
}
|
||||
|
||||
void CThreadedReader::requestReload()
|
||||
@@ -62,6 +69,7 @@ namespace BlackMisc
|
||||
|
||||
void CThreadedReader::gracefulShutdown()
|
||||
{
|
||||
if (this->m_shutdown) { return; }
|
||||
this->m_shutdown = true;
|
||||
this->requestStop();
|
||||
this->quit();
|
||||
@@ -69,12 +77,7 @@ namespace BlackMisc
|
||||
|
||||
CThreadedReader::~CThreadedReader()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void CThreadedReader::cleanup()
|
||||
{
|
||||
// cleanup code would go here
|
||||
this->m_shutdown = true;
|
||||
}
|
||||
|
||||
void CThreadedReader::setInterval(int updatePeriodMs)
|
||||
|
||||
@@ -49,9 +49,6 @@ namespace BlackMisc
|
||||
//! Destructor
|
||||
virtual ~CThreadedReader();
|
||||
|
||||
//! \copydoc CContinuousWorker::cleanup
|
||||
virtual void cleanup() override;
|
||||
|
||||
//! Set the update time
|
||||
//! \param updatePeriodMs <=0 stops the timer
|
||||
//! \threadsafe
|
||||
@@ -61,6 +58,7 @@ namespace BlackMisc
|
||||
//! \threadsafe
|
||||
int interval() const;
|
||||
|
||||
public slots:
|
||||
//! Graceful shutdown
|
||||
//! \threadsafe
|
||||
void gracefulShutdown();
|
||||
|
||||
Reference in New Issue
Block a user