From 190ff6a508164f7e75532e95aefd569fb92d3db7 Mon Sep 17 00:00:00 2001 From: Alfred Reynolds Date: Sat, 13 Nov 2021 13:42:39 +1300 Subject: [PATCH] - Remove network/image download code (as it is unused) --- src/main.cpp | 4 ---- src/mainwindow.cpp | 51 +------------------------------------------ src/mainwindow.h | 7 ------ src/pathtraverser.cpp | 2 -- src/pathtraverser.h | 3 --- src/slide.pro | 2 +- 6 files changed, 2 insertions(+), 67 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6ec6f74..e80c628 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,7 +7,6 @@ #include "logger.h" #include -#include #include #include #include @@ -261,11 +260,8 @@ int main(int argc, char *argv[]) Log( "Rotation Time: ", appConfig.rotationSeconds ); Log( "Overlay input: ", appConfig.overlay ); - QNetworkAccessManager webCtrl; - MainWindow w; ConfigureWindowFromSettings(w, appConfig); - w.setNetworkManager(&webCtrl); w.show(); std::unique_ptr selector = GetSelectorForApp(appConfig); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index de72901..582f888 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -18,8 +18,6 @@ #include #include #include -#include -#include 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("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; -} diff --git a/src/mainwindow.h b/src/mainwindow.h index 916d249..329a809 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -3,7 +3,6 @@ #include #include -#include #include "imagestructs.h" #include "imageselector.h" @@ -34,12 +33,9 @@ public: void setBaseOptions(const ImageDisplayOptions &baseOptionsIn); const ImageDisplayOptions &getBaseOptions(); void setImageSwitcher(ImageSwitcher *switcherIn); - void setNetworkManager(QNetworkAccessManager *networkManagerIn); void setOverlayHexRGB(QString overlayHexRGB); public slots: void checkWindowSize(); -private slots: - void fileDownloaded(QNetworkReply* pReply); private: Ui::MainWindow *ui; @@ -48,9 +44,6 @@ private: ImageDisplayOptions baseImageOptions; bool imageAspectMatchesMonitor = false; ImageDetails currentImage; - QByteArray downloadedData; - QNetworkAccessManager *networkManager = nullptr; - QNetworkReply *pendingReply = nullptr; QSize lastScreenSize = {0,0}; QString overlayHexRGB = "#FFFF"; unsigned int transitionSeconds = 1; diff --git a/src/pathtraverser.cpp b/src/pathtraverser.cpp index 1be7974..73ee6ec 100644 --- a/src/pathtraverser.cpp +++ b/src/pathtraverser.cpp @@ -6,8 +6,6 @@ #include #include #include -#include -#include #include #include /* srand, rand */ diff --git a/src/pathtraverser.h b/src/pathtraverser.h index c018081..412183a 100644 --- a/src/pathtraverser.h +++ b/src/pathtraverser.h @@ -4,9 +4,6 @@ #include #include #include -#include -#include -#include #include "imageselector.h" static const QStringList supportedFormats={"jpg","jpeg","png","tif","tiff"}; diff --git a/src/slide.pro b/src/slide.pro index 04cc324..0cffcbd 100644 --- a/src/slide.pro +++ b/src/slide.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += core gui network xml +QT += core gui CONFIG += qt CONFIG += debug CONFIG += c++1z