Commit f0e2e153 authored by Tomaz Canabrava's avatar Tomaz Canabrava

Modernize Qt connections

First commit of modernizarion of Qt signal connections,
the new signal connection is very userfull because of a few
nice things:

- it's checked at compile time instead of runtime
- it can connect to any function or method, so we don't need
to use slots anymore
- it's way faster because it doesn't need to work with string
comparisson, but it's basically a direct call.
Signed-off-by: 's avatarTomaz Canabrava <tomaz.canabrava@intel.com>
parent a8fbcbab
......@@ -69,9 +69,8 @@ void APMRemoteParamsDownloader::refreshParamList()
QUrl url = FRAME_PARAMS_LIST;
m_networkReply->deleteLater();
m_networkReply = m_networkAccessManager.get(QNetworkRequest(url));
connect(m_networkReply, SIGNAL(finished()), this, SLOT(httpParamListFinished()));
connect(m_networkReply, SIGNAL(downloadProgress(qint64,qint64)),
this, SLOT(updateDataReadProgress(qint64,qint64)));
connect(m_networkReply, &QNetworkReply::finished, this, &APMRemoteParamsDownloader::httpParamListFinished);
connect(m_networkReply, &QNetworkReply::downloadProgress, this, &APMRemoteParamsDownloader::updateDataReadProgress);
}
/* Returned Json Example
......@@ -120,9 +119,9 @@ void APMRemoteParamsDownloader::startFileDownloadRequest()
m_downloadedParamFile->open(QIODevice::WriteOnly);
m_networkReply = m_networkAccessManager.get(QNetworkRequest(url));
connect(m_networkReply, SIGNAL(finished()), this, SLOT(httpFinished()));
connect(m_networkReply, SIGNAL(readyRead()), this, SLOT(httpReadyRead()));
connect(m_networkReply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(updateDataReadProgress(qint64,qint64)));
connect(m_networkReply, &QNetworkReply::finished, this, &APMRemoteParamsDownloader::httpFinished);
connect(m_networkReply, &QNetworkReply::readyRead, this, &APMRemoteParamsDownloader::httpReadyRead);
connect(m_networkReply, &QNetworkReply::downloadProgress, this, &APMRemoteParamsDownloader::updateDataReadProgress);
curr++;
}
......
......@@ -17,18 +17,19 @@ class APMRemoteParamsDownloader : public QObject
public:
explicit APMRemoteParamsDownloader(const QString& file);
QString statusText() const;
public slots:
void refreshParamList();
void httpParamListFinished();
void httpFinished();
void httpReadyRead();
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
private:
void setStatusText(const QString& text);
void startFileDownloadRequest();
void manualListSetup();
void processDownloadedVersionObject(const QByteArray& listObject);
void startDownloadingRemoteParams();
signals:
void finished();
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment