- Remove network/image download code (as it is unused)

This commit is contained in:
Alfred Reynolds
2021-11-13 13:42:39 +13:00
parent cf45a045ff
commit 190ff6a508
6 changed files with 2 additions and 67 deletions

View File

@@ -18,8 +18,6 @@
#include <QGraphicsPixmapItem>
#include <QApplication>
#include <QScreen>
#include <QNetworkReply>
#include <sstream>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
@@ -162,46 +160,15 @@ void MainWindow::checkWindowSize()
void MainWindow::setImage(const ImageDetails &imageDetails)
{
currentImage = imageDetails;
downloadedData.clear();
if (pendingReply)
{
pendingReply->abort();
}
updateImage();
}
void MainWindow::fileDownloaded(QNetworkReply* netReply)
{
if (netReply == pendingReply)
{
pendingReply = nullptr;
QNetworkReply::NetworkError err = netReply->error();
if (err == QNetworkReply::NoError)
{
downloadedData = netReply->readAll();
netReply->deleteLater();
updateImage();
}
}
}
void MainWindow::updateImage()
{
checkWindowSize();
if (currentImage.filename == "")
return;
if (currentImage.filename.find("https://") != std::string::npos && downloadedData.isNull())
{
if (pendingReply == nullptr)
{
QNetworkRequest request(QUrl(currentImage.filename.c_str()));
pendingReply = networkManager->get(request);
connect( networkManager, SIGNAL (finished(QNetworkReply*)), this, SLOT (fileDownloaded(QNetworkReply*)));
}
return;
}
QLabel *label = this->findChild<QLabel*>("image");
const QPixmap* oldImage = label->pixmap();
if (oldImage != NULL && transitionSeconds > 0)
@@ -212,18 +179,7 @@ void MainWindow::updateImage()
}
QPixmap p;
if (!downloadedData.isNull())
{
p.loadFromData(downloadedData);
// BUG BUG have the selector update this?
currentImage.width = p.width();
currentImage.height = p.height();
currentImage.rotation = 0;
}
else
{
p.load( currentImage.filename.c_str() );
}
p.load( currentImage.filename.c_str() );
Log("size:", p.width(), "x", p.height(), "(window:", width(), ",", height(), ")");
@@ -440,8 +396,3 @@ const ImageDisplayOptions &MainWindow::getBaseOptions()
{
return baseImageOptions;
}
void MainWindow::setNetworkManager(QNetworkAccessManager *networkManagerIn)
{
networkManager = networkManagerIn;
}