- Remove network/image download code (as it is unused)
This commit is contained in:
@@ -7,7 +7,6 @@
|
|||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
@@ -261,11 +260,8 @@ int main(int argc, char *argv[])
|
|||||||
Log( "Rotation Time: ", appConfig.rotationSeconds );
|
Log( "Rotation Time: ", appConfig.rotationSeconds );
|
||||||
Log( "Overlay input: ", appConfig.overlay );
|
Log( "Overlay input: ", appConfig.overlay );
|
||||||
|
|
||||||
QNetworkAccessManager webCtrl;
|
|
||||||
|
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
ConfigureWindowFromSettings(w, appConfig);
|
ConfigureWindowFromSettings(w, appConfig);
|
||||||
w.setNetworkManager(&webCtrl);
|
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
std::unique_ptr<ImageSelector> selector = GetSelectorForApp(appConfig);
|
std::unique_ptr<ImageSelector> selector = GetSelectorForApp(appConfig);
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
#include <QGraphicsPixmapItem>
|
#include <QGraphicsPixmapItem>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
@@ -162,46 +160,15 @@ void MainWindow::checkWindowSize()
|
|||||||
void MainWindow::setImage(const ImageDetails &imageDetails)
|
void MainWindow::setImage(const ImageDetails &imageDetails)
|
||||||
{
|
{
|
||||||
currentImage = imageDetails;
|
currentImage = imageDetails;
|
||||||
downloadedData.clear();
|
|
||||||
if (pendingReply)
|
|
||||||
{
|
|
||||||
pendingReply->abort();
|
|
||||||
}
|
|
||||||
updateImage();
|
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()
|
void MainWindow::updateImage()
|
||||||
{
|
{
|
||||||
checkWindowSize();
|
checkWindowSize();
|
||||||
if (currentImage.filename == "")
|
if (currentImage.filename == "")
|
||||||
return;
|
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");
|
QLabel *label = this->findChild<QLabel*>("image");
|
||||||
const QPixmap* oldImage = label->pixmap();
|
const QPixmap* oldImage = label->pixmap();
|
||||||
if (oldImage != NULL && transitionSeconds > 0)
|
if (oldImage != NULL && transitionSeconds > 0)
|
||||||
@@ -212,18 +179,7 @@ void MainWindow::updateImage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QPixmap p;
|
QPixmap p;
|
||||||
if (!downloadedData.isNull())
|
p.load( currentImage.filename.c_str() );
|
||||||
{
|
|
||||||
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() );
|
|
||||||
}
|
|
||||||
|
|
||||||
Log("size:", p.width(), "x", p.height(), "(window:", width(), ",", height(), ")");
|
Log("size:", p.width(), "x", p.height(), "(window:", width(), ",", height(), ")");
|
||||||
|
|
||||||
@@ -440,8 +396,3 @@ const ImageDisplayOptions &MainWindow::getBaseOptions()
|
|||||||
{
|
{
|
||||||
return baseImageOptions;
|
return baseImageOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setNetworkManager(QNetworkAccessManager *networkManagerIn)
|
|
||||||
{
|
|
||||||
networkManager = networkManagerIn;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include "imagestructs.h"
|
#include "imagestructs.h"
|
||||||
#include "imageselector.h"
|
#include "imageselector.h"
|
||||||
|
|
||||||
@@ -34,12 +33,9 @@ public:
|
|||||||
void setBaseOptions(const ImageDisplayOptions &baseOptionsIn);
|
void setBaseOptions(const ImageDisplayOptions &baseOptionsIn);
|
||||||
const ImageDisplayOptions &getBaseOptions();
|
const ImageDisplayOptions &getBaseOptions();
|
||||||
void setImageSwitcher(ImageSwitcher *switcherIn);
|
void setImageSwitcher(ImageSwitcher *switcherIn);
|
||||||
void setNetworkManager(QNetworkAccessManager *networkManagerIn);
|
|
||||||
void setOverlayHexRGB(QString overlayHexRGB);
|
void setOverlayHexRGB(QString overlayHexRGB);
|
||||||
public slots:
|
public slots:
|
||||||
void checkWindowSize();
|
void checkWindowSize();
|
||||||
private slots:
|
|
||||||
void fileDownloaded(QNetworkReply* pReply);
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|
||||||
@@ -48,9 +44,6 @@ private:
|
|||||||
ImageDisplayOptions baseImageOptions;
|
ImageDisplayOptions baseImageOptions;
|
||||||
bool imageAspectMatchesMonitor = false;
|
bool imageAspectMatchesMonitor = false;
|
||||||
ImageDetails currentImage;
|
ImageDetails currentImage;
|
||||||
QByteArray downloadedData;
|
|
||||||
QNetworkAccessManager *networkManager = nullptr;
|
|
||||||
QNetworkReply *pendingReply = nullptr;
|
|
||||||
QSize lastScreenSize = {0,0};
|
QSize lastScreenSize = {0,0};
|
||||||
QString overlayHexRGB = "#FFFF";
|
QString overlayHexRGB = "#FFFF";
|
||||||
unsigned int transitionSeconds = 1;
|
unsigned int transitionSeconds = 1;
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDomDocument>
|
|
||||||
#include <QDomAttr>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h> /* srand, rand */
|
#include <stdlib.h> /* srand, rand */
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QNetworkRequest>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include "imageselector.h"
|
#include "imageselector.h"
|
||||||
|
|
||||||
static const QStringList supportedFormats={"jpg","jpeg","png","tif","tiff"};
|
static const QStringList supportedFormats={"jpg","jpeg","png","tif","tiff"};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui network xml
|
QT += core gui
|
||||||
CONFIG += qt
|
CONFIG += qt
|
||||||
CONFIG += debug
|
CONFIG += debug
|
||||||
CONFIG += c++1z
|
CONFIG += c++1z
|
||||||
|
|||||||
Reference in New Issue
Block a user