Fixed connecting to rebrickable on Linux.

This commit is contained in:
Leonardo Zide 2018-01-19 11:17:21 -08:00
parent 0ec956e700
commit a3995efa36
3 changed files with 14 additions and 5 deletions

View file

@ -1,4 +1,5 @@
#pragma once
#ifndef LC_GLOBAL_H
#define LC_GLOBAL_H
#ifdef __cplusplus
@ -65,3 +66,5 @@ class lcMemFile;
class lcDiskFile;
#endif
#endif // LC_GLOBAL_H

View file

@ -69,7 +69,7 @@ lcSetsDatabaseDialog::lcSetsDatabaseDialog(QWidget* Parent)
connect(ui->SetsTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(accept()));
connect(this, SIGNAL(finished(int)), this, SLOT(Finished(int)));
#ifndef Q_OS_WIN
connect(&mNetworkManager, SIGNAL(finished(QNetworkReply*)), SLOT(DownloadFinished(lcHttpReply*)));
connect(&mNetworkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(DownloadFinished(QNetworkReply*)));
#endif
mKeyListReply = RequestURL("http://www.leocad.org/rebrickable.json");
@ -84,7 +84,7 @@ lcHttpReply* lcSetsDatabaseDialog::RequestURL(const QString& URL)
{
#ifdef Q_OS_WIN
lcHttpReply* Reply = new lcHttpReply(this, URL);
connect(Reply, &QThread::finished, [this, Reply] { DownloadFinished(Reply); });
connect(Reply, &QThread::finished, [this, Reply] { ProcessReply(Reply); });
Reply->start();
return Reply;
#else
@ -221,7 +221,12 @@ void lcSetsDatabaseDialog::on_SearchButton_clicked()
}
}
void lcSetsDatabaseDialog::DownloadFinished(lcHttpReply* Reply)
void lcSetsDatabaseDialog::DownloadFinished(QNetworkReply* Reply)
{
ProcessReply(Reply);
}
void lcSetsDatabaseDialog::ProcessReply(lcHttpReply* Reply)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
if (Reply == mKeyListReply)

View file

@ -68,13 +68,14 @@ public:
virtual bool eventFilter(QObject* Object, QEvent* Event) override;
public slots:
void DownloadFinished(lcHttpReply* Reply);
void DownloadFinished(QNetworkReply* Reply);
void on_SearchButton_clicked();
void accept() override;
void Finished(int Result);
protected:
lcHttpReply* RequestURL(const QString& URL);
void ProcessReply(lcHttpReply* Reply);
#ifndef Q_OS_WIN
QNetworkAccessManager mNetworkManager;