mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
Replace private slot with private method
With the new Qt5 C++11 syntax, private slots are not really necessary. Replacing it with a normal private method reduces the generated code from moc and also syntax issues are raised as compiler errors instead of runtime asserts.
This commit is contained in:
@@ -41,14 +41,12 @@ namespace BlackCore
|
||||
CVatsimMetarReader::CVatsimMetarReader(QObject *owner) :
|
||||
CThreadedReader(owner, "CVatsimMetarReader")
|
||||
{
|
||||
this->connect(this->m_updateTimer, &QTimer::timeout, this, &CVatsimMetarReader::ps_readMetars);
|
||||
this->connect(this->m_updateTimer, &QTimer::timeout, this, &CVatsimMetarReader::readMetars);
|
||||
}
|
||||
|
||||
void CVatsimMetarReader::readInBackgroundThread()
|
||||
{
|
||||
bool s = QMetaObject::invokeMethod(this, "ps_readMetars");
|
||||
Q_ASSERT_X(s, Q_FUNC_INFO, "Cannot invoke");
|
||||
Q_UNUSED(s);
|
||||
QTimer::singleShot(0, this, &CVatsimMetarReader::readMetars);
|
||||
}
|
||||
|
||||
CMetarList CVatsimMetarReader::getMetars() const
|
||||
@@ -79,7 +77,7 @@ namespace BlackCore
|
||||
return m_settings.get();
|
||||
}
|
||||
|
||||
void CVatsimMetarReader::ps_readMetars()
|
||||
void CVatsimMetarReader::readMetars()
|
||||
{
|
||||
this->threadAssertCheck();
|
||||
this->restartTimer(true); // when timer active, restart so we cause no undesired reads
|
||||
@@ -88,10 +86,10 @@ namespace BlackCore
|
||||
const CUrl url(urls.obtainNextWorkingUrl(true));
|
||||
if (url.isEmpty()) { return; }
|
||||
Q_ASSERT_X(sApp, Q_FUNC_INFO, "No Application");
|
||||
sApp->getFromNetwork(url.withAppendedQuery("id=all"), { this, &CVatsimMetarReader::ps_decodeMetars});
|
||||
sApp->getFromNetwork(url.withAppendedQuery("id=all"), { this, &CVatsimMetarReader::decodeMetars});
|
||||
}
|
||||
|
||||
void CVatsimMetarReader::ps_decodeMetars(QNetworkReply *nwReplyPtr)
|
||||
void CVatsimMetarReader::decodeMetars(QNetworkReply *nwReplyPtr)
|
||||
{
|
||||
// wrap pointer, make sure any exit cleans up reply
|
||||
// required to use delete later as object is created in a different thread
|
||||
|
||||
@@ -66,13 +66,13 @@ namespace BlackCore
|
||||
virtual BlackCore::Settings::CSettingsReader getSettings() const override;
|
||||
//! @}
|
||||
|
||||
private slots:
|
||||
private:
|
||||
//! Decode METARs
|
||||
//! \threadsafe
|
||||
void ps_decodeMetars(QNetworkReply *nwReply);
|
||||
void decodeMetars(QNetworkReply *nwReply);
|
||||
|
||||
//! Do reading
|
||||
void ps_readMetars();
|
||||
void readMetars();
|
||||
|
||||
private:
|
||||
BlackMisc::Weather::CMetarDecoder m_metarDecoder;
|
||||
|
||||
Reference in New Issue
Block a user