mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 16:05:21 +01:00
imagewriter: Remove unique_ptr for _networkManager
This commit is contained in:
parent
a6200ba994
commit
2bd4a068bc
2 changed files with 8 additions and 8 deletions
|
@ -60,7 +60,8 @@ namespace {
|
||||||
ImageWriter::ImageWriter(QObject *parent)
|
ImageWriter::ImageWriter(QObject *parent)
|
||||||
: QObject(parent), _repo(QUrl(QString(OSLIST_URL))), _dlnow(0), _verifynow(0),
|
: QObject(parent), _repo(QUrl(QString(OSLIST_URL))), _dlnow(0), _verifynow(0),
|
||||||
_engine(nullptr), _thread(nullptr), _verifyEnabled(false), _cachingEnabled(false),
|
_engine(nullptr), _thread(nullptr), _verifyEnabled(false), _cachingEnabled(false),
|
||||||
_embeddedMode(false), _online(false), _customCacheFile(false), _trans(nullptr)
|
_embeddedMode(false), _online(false), _customCacheFile(false), _trans(nullptr),
|
||||||
|
_networkManager(this)
|
||||||
{
|
{
|
||||||
connect(&_polltimer, SIGNAL(timeout()), SLOT(pollProgress()));
|
connect(&_polltimer, SIGNAL(timeout()), SLOT(pollProgress()));
|
||||||
|
|
||||||
|
@ -173,8 +174,7 @@ ImageWriter::ImageWriter(QObject *parent)
|
||||||
//_currentKeyboard = "us";
|
//_currentKeyboard = "us";
|
||||||
|
|
||||||
// Centralised network manager, for fetching OS lists
|
// Centralised network manager, for fetching OS lists
|
||||||
_networkManager = std::make_unique<QNetworkAccessManager>(this);
|
connect(&_networkManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(handleNetworkRequestFinished(QNetworkReply *)));
|
||||||
connect(_networkManager.get(), SIGNAL(finished(QNetworkReply *)), this, SLOT(handleNetworkRequestFinished(QNetworkReply *)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageWriter::~ImageWriter()
|
ImageWriter::~ImageWriter()
|
||||||
|
@ -452,7 +452,7 @@ namespace {
|
||||||
return returnArray;
|
return returnArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
void findAndQueueUnresolvedSubitemsJson(QJsonArray incoming, QNetworkAccessManager *manager, uint8_t count = 0) {
|
void findAndQueueUnresolvedSubitemsJson(QJsonArray incoming, QNetworkAccessManager &manager, uint8_t count = 0) {
|
||||||
if (count > MAX_SUBITEMS_DEPTH) {
|
if (count > MAX_SUBITEMS_DEPTH) {
|
||||||
qDebug() << "Aborting fetch of subitems JSON, exceeded maximum configured limit of " << MAX_SUBITEMS_DEPTH << " levels.";
|
qDebug() << "Aborting fetch of subitems JSON, exceeded maximum configured limit of " << MAX_SUBITEMS_DEPTH << " levels.";
|
||||||
return;
|
return;
|
||||||
|
@ -465,7 +465,7 @@ namespace {
|
||||||
findAndQueueUnresolvedSubitemsJson(entryObject["subitems"].toArray(), manager, count++);
|
findAndQueueUnresolvedSubitemsJson(entryObject["subitems"].toArray(), manager, count++);
|
||||||
} else if (entryObject.contains("subitems_url")) {
|
} else if (entryObject.contains("subitems_url")) {
|
||||||
auto url = entryObject["subitems_url"].toString();
|
auto url = entryObject["subitems_url"].toString();
|
||||||
manager->get(QNetworkRequest(url));
|
manager.get(QNetworkRequest(url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,7 @@ void ImageWriter::handleNetworkRequestFinished(QNetworkReply *data) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
findAndQueueUnresolvedSubitemsJson(response_object["os_list"].toArray(), _networkManager.get());
|
findAndQueueUnresolvedSubitemsJson(response_object["os_list"].toArray(), _networkManager);
|
||||||
emit osListPrepared();
|
emit osListPrepared();
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Incorrectly formatted OS list at: " << data->url();
|
qDebug() << "Incorrectly formatted OS list at: " << data->url();
|
||||||
|
@ -572,7 +572,7 @@ void ImageWriter::beginOSListFetch() {
|
||||||
|
|
||||||
// This will set up a chain of requests that culiminate in the eventual fetch and assembly of
|
// This will set up a chain of requests that culiminate in the eventual fetch and assembly of
|
||||||
// a complete cached OS list.
|
// a complete cached OS list.
|
||||||
_networkManager->get(QNetworkRequest(request));
|
_networkManager.get(QNetworkRequest(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageWriter::setCustomCacheFile(const QString &cacheFile, const QByteArray &sha256)
|
void ImageWriter::setCustomCacheFile(const QString &cacheFile, const QByteArray &sha256)
|
||||||
|
|
|
@ -181,7 +181,7 @@ private:
|
||||||
// Recursively walk all the entries with subitems and, for any which
|
// Recursively walk all the entries with subitems and, for any which
|
||||||
// refer to an external JSON list, fetch the list and put it in place.
|
// refer to an external JSON list, fetch the list and put it in place.
|
||||||
void fillSubLists(QJsonArray &topLevel);
|
void fillSubLists(QJsonArray &topLevel);
|
||||||
std::unique_ptr<QNetworkAccessManager> _networkManager;
|
QNetworkAccessManager _networkManager;
|
||||||
QJsonDocument _completeOsList;
|
QJsonDocument _completeOsList;
|
||||||
QJsonArray _deviceFilter;
|
QJsonArray _deviceFilter;
|
||||||
std::mutex _deviceListMutationMutex;
|
std::mutex _deviceListMutationMutex;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue