- Add a new Log() function to replace ad-hoc std::cout calls wrapped in debugMode checks

- Remove debugMode from classes that don't need it (i.e all of them)
This commit is contained in:
Alfred Reynolds
2021-08-26 12:13:09 +12:00
parent 833e7ef915
commit be8f615c21
16 changed files with 105 additions and 131 deletions

View File

@@ -1,4 +1,5 @@
#include "appconfig.h"
#include "logger.h"
#include <QJsonDocument>
#include <QJsonObject>
@@ -47,7 +48,7 @@ void SetJSONBool(bool &value, QJsonObject jsonDoc, const char *key) {
}
}
Config loadConfiguration(const std::string &configFilePath, const Config &currentConfig, bool debugMode) {
Config loadConfiguration(const std::string &configFilePath, const Config &currentConfig) {
QString jsonFile(configFilePath.c_str());
QDir directory;
if(!directory.exists(jsonFile))
@@ -57,10 +58,7 @@ Config loadConfiguration(const std::string &configFilePath, const Config &curren
Config userConfig = currentConfig;
if(debugMode)
{
std::cout << "Found options file: " << jsonFile.toStdString() << std::endl;
}
Log( "Found options file: ", jsonFile.toStdString() );
QString val;
QFile file;
@@ -222,7 +220,7 @@ AppConfig loadAppConfiguration(const AppConfig &commandLineConfig) {
return commandLineConfig;
}
AppConfig loadedConfig = loadConfiguration(jsonFile.toStdString(), commandLineConfig, commandLineConfig.debugMode);
AppConfig loadedConfig = loadConfiguration(jsonFile.toStdString(), commandLineConfig);
QString val;
QFile file;
@@ -273,12 +271,12 @@ AppConfig loadAppConfiguration(const AppConfig &commandLineConfig) {
return loadedConfig;
}
Config getConfigurationForFolder(const std::string &folderPath, const Config &currentConfig, bool debugMode) {
Config getConfigurationForFolder(const std::string &folderPath, const Config &currentConfig) {
QDir directory(folderPath.c_str());
QString jsonFile = directory.filePath(QString("options.json"));
if(directory.exists(jsonFile))
{
return loadConfiguration(jsonFile.toStdString(), currentConfig, debugMode );
return loadConfiguration(jsonFile.toStdString(), currentConfig );
}
return currentConfig;
}

View File

@@ -77,7 +77,7 @@ struct AppConfig : public Config {
};
AppConfig loadAppConfiguration(const AppConfig &commandLineConfig);
Config getConfigurationForFolder(const std::string &folderPath, const Config &currentConfig, bool debugMode);
Config getConfigurationForFolder(const std::string &folderPath, const Config &currentConfig);
ImageAspect parseAspectFromString(char aspect);
QString getAppConfigFilePath(const std::string &configPath);

View File

@@ -1,6 +1,7 @@
#include "imageselector.h"
#include "pathtraverser.h"
#include "mainwindow.h"
#include "logger.h"
#include <QDirIterator>
#include <QTimer>
#include <QApplication>
@@ -21,11 +22,6 @@ ImageSelector::ImageSelector() {}
ImageSelector::~ImageSelector(){}
void ImageSelector::setDebugMode(bool debugModeIn)
{
debugMode = debugModeIn;
}
int ReadExifTag(ExifData* exifData, ExifTag tag, bool shortRead = false)
{
int value = -1;
@@ -133,12 +129,12 @@ bool ImageSelector::imageInsideTimeWindow(const QVector<DisplayTimeWindow> &time
return true;
}
}
if(debugMode && timeWindows.count() > 0)
if(ShouldLog() && timeWindows.count() > 0)
{
std::cout << "image display time outside windows: " << std::endl;
Log( "image display time outside window: ");
for(auto &timeWindow : timeWindows)
{
std::cout << "time: " << timeWindow.startDisplay.toString().toStdString() << "-" << timeWindow.endDisplay.toString().toStdString() << std::endl;
Log("time: ", timeWindow.startDisplay.toString().toStdString(), "-", timeWindow.endDisplay.toString().toStdString());
}
}
return false;
@@ -151,19 +147,13 @@ bool ImageSelector::imageMatchesFilter(const ImageDetails& imageDetails)
if(!QFileInfo::exists(QString(imageDetails.filename.c_str())))
{
if(debugMode)
{
std::cout << "file not found: " << imageDetails.filename << std::endl;
}
Log("file not found: ", imageDetails.filename);
return false;
}
if(!imageValidForAspect(imageDetails))
{
if(debugMode)
{
std::cout << "image aspect ratio doesn't match filter '" << imageDetails.options.onlyAspect << "' : " << imageDetails.filename << std::endl;
}
Log("image aspect ratio doesn't match filter '", imageDetails.options.onlyAspect, "' : ", imageDetails.filename);
return false;
}
@@ -217,10 +207,7 @@ const ImageDetails RandomImageSelector::getNextImage(const ImageDisplayOptions &
unsigned int RandomImageSelector::selectRandom(const QStringList& images) const
{
if(debugMode)
{
std::cout << "images: " << images.size() << std::endl;
}
Log("images: ", images.size());
if (images.size() == 0)
{
throw std::string("No jpg images found in given folder");
@@ -335,11 +322,11 @@ void SortedImageSelector::reloadImagesIfEmpty()
{
images = pathTraverser->getImages();
std::sort(images.begin(), images.end());
if(debugMode)
if(ShouldLog())
{
std::cout << "read " << images.size() << " images." << std::endl;
Log( "read ", images.size(), " images.");
for (int i = 0;i <images.size();i++){
std::cout << images[i].toStdString() << std::endl;
Log(images[i].toStdString());
}
}
}

View File

@@ -17,7 +17,6 @@ public:
ImageSelector(); // use case for when you don't own your own traverser
virtual ~ImageSelector();
virtual const ImageDetails getNextImage(const ImageDisplayOptions &baseOptions) = 0;
void setDebugMode(bool debugModeIn);
protected:
ImageDetails populateImageDetails(const std::string&filename, const ImageDisplayOptions &baseOptions);
@@ -25,7 +24,6 @@ protected:
bool imageMatchesFilter(const ImageDetails& imageDetails);
bool imageInsideTimeWindow(const QVector<DisplayTimeWindow> &timeWindows);
std::unique_ptr<PathTraverser> pathTraverser;
bool debugMode = false;
};
class RandomImageSelector : public ImageSelector

View File

@@ -23,7 +23,7 @@ void ImageSwitcher::updateImage()
{
if(reloadConfigIfNeeded)
{
reloadConfigIfNeeded(window, this, selector.get());
reloadConfigIfNeeded(window, this);
}
ImageDetails imageDetails = selector->getNextImage(window.getBaseOptions());
if (imageDetails.filename == "")
@@ -52,7 +52,7 @@ void ImageSwitcher::scheduleImageUpdate()
QTimer::singleShot(100, this, SLOT(updateImage()));
}
void ImageSwitcher::setConfigFileReloader(std::function<void(MainWindow &w, ImageSwitcher *switcher, ImageSelector *selector)> reloadConfigIfNeededIn)
void ImageSwitcher::setConfigFileReloader(std::function<void(MainWindow &w, ImageSwitcher *switcher)> reloadConfigIfNeededIn)
{
reloadConfigIfNeeded = reloadConfigIfNeededIn;
}

View File

@@ -16,7 +16,7 @@ public:
ImageSwitcher(MainWindow& w, unsigned int timeoutMsec, std::unique_ptr<ImageSelector>& selector);
void start();
void scheduleImageUpdate();
void setConfigFileReloader(std::function<void(MainWindow &w, ImageSwitcher *switcher, ImageSelector *selector)> reloadConfigIfNeededIn);
void setConfigFileReloader(std::function<void(MainWindow &w, ImageSwitcher *switcher)> reloadConfigIfNeededIn);
void setRotationTime(unsigned int timeoutMsec);
void setImageSelector(std::unique_ptr<ImageSelector>& selector);
@@ -29,7 +29,7 @@ private:
QTimer timer;
const unsigned int timeoutNoContent = 5 * 1000; // 5 sec
QTimer timerNoContent;
std::function<void(MainWindow &w, ImageSwitcher *switcher, ImageSelector *selector)> reloadConfigIfNeeded;
std::function<void(MainWindow &w, ImageSwitcher *switcher)> reloadConfigIfNeeded;
};
#endif // IMAGESWITCHER_H

14
src/logger.cpp Normal file
View File

@@ -0,0 +1,14 @@
#include "logger.h"
static bool shouldLog = false;
void SetupLogger(bool shouldLogIn)
{
shouldLog = shouldLogIn;
}
bool ShouldLog()
{
return shouldLog;
}

20
src/logger.h Normal file
View File

@@ -0,0 +1,20 @@
#ifndef LOGGER_H
#define LOGGER_H
#include <iostream>
#include <string_view>
#include <sstream>
void SetupLogger(bool shouldLog);
bool ShouldLog();
template <typename ...Args>
void Log(Args&& ...args) {
if(!ShouldLog())
return;
std::ostringstream stream;
(stream << ... << std::forward<Args>(args)) << std::endl;
std::cout << stream.str();
}
#endif // LOGGER_H

View File

@@ -4,6 +4,7 @@
#include "pathtraverser.h"
#include "overlay.h"
#include "appconfig.h"
#include "logger.h"
#include <QApplication>
#include <QNetworkAccessManager>
@@ -123,30 +124,28 @@ void ConfigureWindowFromSettings(MainWindow &w, const AppConfig &appConfig)
w.setBackgroundOpacity(appConfig.backgroundOpacity);
}
std::unique_ptr<Overlay> o = std::unique_ptr<Overlay>(new Overlay(appConfig.overlay));
o->setDebugMode(appConfig.debugMode);
w.setDebugMode(appConfig.debugMode);
w.setOverlay(o);
w.setBaseOptions(appConfig.baseDisplayOptions);
}
std::unique_ptr<ImageSelector> GetSelectorForConfig(const PathEntry& path, QNetworkAccessManager& networkManagerIn, const bool debugMode)
std::unique_ptr<ImageSelector> GetSelectorForConfig(const PathEntry& path, QNetworkAccessManager& networkManagerIn)
{
std::unique_ptr<PathTraverser> pathTraverser;
if (!path.rssFeedURL.empty())
{
pathTraverser = std::unique_ptr<PathTraverser>(new RedditRSSFeedPathTraverser(path.rssFeedURL, networkManagerIn, debugMode));
pathTraverser = std::unique_ptr<PathTraverser>(new RedditRSSFeedPathTraverser(path.rssFeedURL, networkManagerIn));
}
else if (!path.imageList.empty())
{
pathTraverser = std::unique_ptr<PathTraverser>(new ImageListPathTraverser(path.imageList, debugMode));
pathTraverser = std::unique_ptr<PathTraverser>(new ImageListPathTraverser(path.imageList));
}
else if (path.recursive)
{
pathTraverser = std::unique_ptr<PathTraverser>(new RecursivePathTraverser(path.path, debugMode));
pathTraverser = std::unique_ptr<PathTraverser>(new RecursivePathTraverser(path.path));
}
else
{
pathTraverser = std::unique_ptr<PathTraverser>(new DefaultPathTraverser(path.path, debugMode));
pathTraverser = std::unique_ptr<PathTraverser>(new DefaultPathTraverser(path.path));
}
std::unique_ptr<ImageSelector> selector;
@@ -170,14 +169,14 @@ std::unique_ptr<ImageSelector> GetSelectorForApp(const AppConfig& appConfig, QNe
{
if(appConfig.paths.count()==1)
{
return GetSelectorForConfig(appConfig.paths[0], networkManagerIn, appConfig.debugMode);
return GetSelectorForConfig(appConfig.paths[0], networkManagerIn);
}
else
{
std::unique_ptr<ListImageSelector> listSelector(new ListImageSelector());
for(const auto &path : appConfig.paths)
{
auto selector = GetSelectorForConfig(path, networkManagerIn, appConfig.debugMode);
auto selector = GetSelectorForConfig(path, networkManagerIn);
listSelector->AddImageSelector(selector, path.exclusive, path.baseDisplayOptions);
}
// new things
@@ -186,7 +185,7 @@ std::unique_ptr<ImageSelector> GetSelectorForApp(const AppConfig& appConfig, QNe
}
void ReloadConfigIfNeeded(AppConfig &appConfig, MainWindow &w, ImageSwitcher *switcher, ImageSelector *selector, QNetworkAccessManager& networkManager)
void ReloadConfigIfNeeded(AppConfig &appConfig, MainWindow &w, ImageSwitcher *switcher, QNetworkAccessManager& networkManager)
{
QString jsonFile = getAppConfigFilePath(appConfig.configPath);
QDir directory;
@@ -207,7 +206,6 @@ void ReloadConfigIfNeeded(AppConfig &appConfig, MainWindow &w, ImageSwitcher *sw
switcher->setImageSelector(selector);
}
selector->setDebugMode(appConfig.debugMode);
switcher->setRotationTime(appConfig.rotationSeconds * 1000);
}
}
@@ -231,12 +229,9 @@ int main(int argc, char *argv[])
usage(argv[0]);
return 1;
}
if(appConfig.debugMode)
{
std::cout << "Rotation Time: " << appConfig.rotationSeconds << std::endl;
std::cout << "Overlay input: " << appConfig.overlay << std::endl;
}
SetupLogger(appConfig.debugMode);
Log( "Rotation Time: ", appConfig.rotationSeconds );
Log( "Overlay input: ", appConfig.overlay );
QNetworkAccessManager webCtrl;
@@ -246,11 +241,10 @@ int main(int argc, char *argv[])
w.show();
std::unique_ptr<ImageSelector> selector = GetSelectorForApp(appConfig, webCtrl);
selector->setDebugMode(appConfig.debugMode);
ImageSwitcher switcher(w, appConfig.rotationSeconds * 1000, selector);
w.setImageSwitcher(&switcher);
std::function<void(MainWindow &w, ImageSwitcher *switcher, ImageSelector *selector)> reloader = [&appConfig, &webCtrl](MainWindow &w, ImageSwitcher *switcher, ImageSelector *selector) { ReloadConfigIfNeeded(appConfig, w, switcher, selector, webCtrl); };
std::function<void(MainWindow &w, ImageSwitcher *switcher)> reloader = [&appConfig, &webCtrl](MainWindow &w, ImageSwitcher *switcher) { ReloadConfigIfNeeded(appConfig, w, switcher, webCtrl); };
switcher.setConfigFileReloader(reloader);
switcher.start();
return a.exec();

View File

@@ -2,6 +2,7 @@
#include "overlay.h"
#include "ui_mainwindow.h"
#include "imageswitcher.h"
#include "logger.h"
#include <QLabel>
#include <QPixmap>
#include <QBitmap>
@@ -130,10 +131,7 @@ void MainWindow::checkWindowSize()
QSize screenSize = screen->geometry().size();
if(size() != screenSize)
{
if(debugMode)
{
std::cout << "Resizing Window" << screenSize.width() << "," << screenSize.height() << std::endl;
}
Log("Resizing Window", screenSize.width(), "," , screenSize.height() );
setFixedSize(screenSize);
updateImage(true);
}
@@ -144,10 +142,7 @@ void MainWindow::checkWindowSize()
ImageAspect newAspect = isLandscape ? ImageAspect_Landscape : ImageAspect_Portrait;
if (newAspect != baseImageOptions.onlyAspect)
{
if(debugMode)
{
std::cout << "Changing image orientation to " << newAspect << std::endl;
}
Log("Changing image orientation to ", newAspect);
baseImageOptions.onlyAspect = newAspect;
currentImage.filename = "";
warn("Monitor aspect changed, updating image...");
@@ -237,10 +232,7 @@ void MainWindow::updateImage(bool immediately)
p.load( currentImage.filename.c_str() );
}
if(debugMode)
{
std::cout << "size:" << p.width() << "x" << p.height() << "(window:" << width() << "," << height() << ")" << std::endl;
}
Log("size:", p.width(), "x", p.height(), "(window:", width(), ",", height(), ")");
QPixmap rotated = getRotatedPixmap(p);
QPixmap scaled = getScaledPixmap(rotated);
@@ -253,7 +245,7 @@ void MainWindow::updateImage(bool immediately)
drawText(background, overlay->getMarginTopRight(), overlay->getFontsizeTopRight(), overlay->getRenderedTopRight(currentImage.filename).c_str(), Qt::AlignTop|Qt::AlignRight);
drawText(background, overlay->getMarginBottomLeft(), overlay->getFontsizeBottomLeft(), overlay->getRenderedBottomLeft(currentImage.filename).c_str(), Qt::AlignBottom|Qt::AlignLeft);
drawText(background, overlay->getMarginBottomRight(), overlay->getFontsizeBottomRight(), overlay->getRenderedBottomRight(currentImage.filename).c_str(), Qt::AlignBottom|Qt::AlignRight);
if (debugMode)
if (ShouldLog())
{
// draw a thumbnail version of the source image in the bottom left, to check for cropping issues
QPainter pt(&background);
@@ -288,7 +280,6 @@ void MainWindow::updateImage(bool immediately)
}
void MainWindow::drawText(QPixmap& image, int margin, int fontsize, QString text, int alignment) {
//std::cout << "text: " << text.toStdString() << " margin: " << margin << " fontsize: " << fontsize<< std::endl;
QPainter pt(&image);
pt.setPen(QPen(Qt::white));
pt.setFont(QFont("Sans", fontsize, QFont::Bold));
@@ -426,11 +417,6 @@ void MainWindow::setImageSwitcher(ImageSwitcher *switcherIn)
switcher = switcherIn;
}
void MainWindow::setDebugMode(bool debugModeIn)
{
debugMode = debugModeIn;
}
const ImageDisplayOptions &MainWindow::getBaseOptions()
{
return baseImageOptions;

View File

@@ -30,7 +30,6 @@ public:
void setBackgroundOpacity(unsigned int opacity);
void warn(std::string text);
void setOverlay(std::unique_ptr<Overlay> &overlay);
void setDebugMode(bool debugModeIn);
void setBaseOptions(const ImageDisplayOptions &baseOptionsIn);
const ImageDisplayOptions &getBaseOptions();
void setImageSwitcher(ImageSwitcher *switcherIn);
@@ -50,7 +49,6 @@ private:
QByteArray downloadedData;
QNetworkAccessManager *networkManager = nullptr;
QNetworkReply *pendingReply = nullptr;
bool debugMode = false;
QSize lastScreenSize = {0,0};
std::unique_ptr<Overlay> overlay;

View File

@@ -1,4 +1,5 @@
#include "overlay.h"
#include "logger.h"
#include <QString>
#include <QDateTime>
#include <libexif/exif-data.h>
@@ -19,11 +20,6 @@ Overlay::Overlay(const std::string overlayInput):
Overlay::~Overlay() {}
void Overlay::setDebugMode(const bool debugModeIn)
{
debugMode = debugModeIn;
}
void Overlay::parseInput() {
QString str = QString(overlayInput.c_str());
QStringList corners = str.split(QLatin1Char(';'));
@@ -55,10 +51,7 @@ void Overlay::parseInput() {
QString Overlay::getTemplate(QStringList components){
if (components.size()>3) {
if(debugMode)
{
std::cout << "template: " << components[3].toStdString() << std::endl;
}
Log("template: ", components[3].toStdString());
return components[3];
}
return "";
@@ -66,10 +59,7 @@ QString Overlay::getTemplate(QStringList components){
int Overlay::getMargin(QStringList components){
if (components.size()>1) {
if(debugMode)
{
std::cout << "margin: " << components[1].toStdString() << std::endl;
}
Log("margin: ", components[1].toStdString());
int num = components[1].toInt();
if (num > 0) {
return num;
@@ -81,10 +71,7 @@ int Overlay::getMargin(QStringList components){
int Overlay::getFontsize(QStringList components){
if (components.size()>2) {
if(debugMode)
{
std::cout << "fontsize: " << components[2].toStdString() << std::endl;
}
Log("fontsize: ", components[2].toStdString());
int num = components[2].toInt();
if (num > 0) {
return num;

View File

@@ -27,13 +27,10 @@ class Overlay
int getMarginBottomRight();
int getFontsizeBottomRight();
void setDebugMode(const bool debugModeIn);
private:
const std::string overlayInput;
int margin;
int fontsize;
bool debugMode = false;
QString topLeftTemplate;
QString topRightTemplate;

View File

@@ -1,6 +1,7 @@
#include "pathtraverser.h"
#include "mainwindow.h"
#include "appconfig.h"
#include "logger.h"
#include <QDirIterator>
#include <QDir>
@@ -11,8 +12,8 @@
#include <stdlib.h> /* srand, rand */
PathTraverser::PathTraverser(const std::string path, bool debugModeIn):
path(path), debugMode(debugModeIn)
PathTraverser::PathTraverser(const std::string path):
path(path)
{}
PathTraverser::~PathTraverser() {}
@@ -28,11 +29,11 @@ ImageDisplayOptions PathTraverser::LoadOptionsForDirectory(const std::string &di
{
Config baseConfig;
baseConfig.baseDisplayOptions = baseOptions;
return getConfigurationForFolder(directoryPath, baseConfig, debugMode).baseDisplayOptions;
return getConfigurationForFolder(directoryPath, baseConfig).baseDisplayOptions;
}
RecursivePathTraverser::RecursivePathTraverser(const std::string path,bool debugMode):
PathTraverser(path,debugMode)
RecursivePathTraverser::RecursivePathTraverser(const std::string path):
PathTraverser(path)
{}
RecursivePathTraverser::~RecursivePathTraverser() {}
@@ -61,8 +62,8 @@ ImageDisplayOptions RecursivePathTraverser::UpdateOptionsForImage(const std::str
return LoadOptionsForDirectory(d.absolutePath().toStdString(), baseOptions);
}
DefaultPathTraverser::DefaultPathTraverser(const std::string path,bool debugMode):
PathTraverser(path,debugMode),
DefaultPathTraverser::DefaultPathTraverser(const std::string path):
PathTraverser(path),
directory(path.c_str())
{}
@@ -85,8 +86,8 @@ ImageDisplayOptions DefaultPathTraverser::UpdateOptionsForImage(const std::strin
return LoadOptionsForDirectory(directory.absolutePath().toStdString(), baseOptions);
}
ImageListPathTraverser::ImageListPathTraverser(const std::string &imageListString,bool debugMode):
PathTraverser("",debugMode)
ImageListPathTraverser::ImageListPathTraverser(const std::string &imageListString):
PathTraverser("")
{
QString str = QString(imageListString.c_str());
imageList = str.split(QLatin1Char(','));
@@ -114,8 +115,8 @@ ImageDisplayOptions ImageListPathTraverser::UpdateOptionsForImage(const std::str
}
RedditRSSFeedPathTraverser::RedditRSSFeedPathTraverser(const std::string& rssFeedURLIn, QNetworkAccessManager& networkManager, bool debugModeIn) :
PathTraverser("",debugModeIn), rssFeedURL(rssFeedURLIn), webCtrl(networkManager)
RedditRSSFeedPathTraverser::RedditRSSFeedPathTraverser(const std::string& rssFeedURLIn, QNetworkAccessManager& networkManager) :
PathTraverser(""), rssFeedURL(rssFeedURLIn), webCtrl(networkManager)
{
connect( &webCtrl, SIGNAL (finished(QNetworkReply*)), this, SLOT (fileDownloaded(QNetworkReply*)));
RequestRSSFeed();
@@ -131,10 +132,7 @@ void RedditRSSFeedPathTraverser::RequestRSSFeed()
{
pendingReply->abort();
}
if (debugMode)
{
std::cout << "Requesting RSS feed:" << rssFeedURL << std::endl;
}
Log("Requesting RSS feed:", rssFeedURL);
rssRequestedTime = QDateTime::currentDateTime();
QNetworkRequest request(QUrl(rssFeedURL.c_str()));
pendingReply = webCtrl.get(request);
@@ -159,10 +157,7 @@ void RedditRSSFeedPathTraverser::fileDownloaded(QNetworkReply* netReply)
netReply->deleteLater();
if (!vt.isNull())
{
if (debugMode)
{
std::cout << "Redirected to:" << vt.toUrl().toString().toStdString() << std::endl;
}
Log("Redirected to:", vt.toUrl().toString().toStdString());
webCtrl.get(QNetworkRequest(vt.toUrl()));
}
else
@@ -171,10 +166,7 @@ void RedditRSSFeedPathTraverser::fileDownloaded(QNetworkReply* netReply)
QString error;
if (!doc.setContent(str, false, &error))
{
if (debugMode)
{
std::cout << "Failed to load page:" << error.toStdString() << std::endl;
}
Log("Failed to load page:", error.toStdString());
}
else
{

View File

@@ -15,7 +15,7 @@ class MainWindow;
class PathTraverser
{
public:
PathTraverser(const std::string path, bool debugModeIn);
PathTraverser(const std::string path);
virtual ~PathTraverser();
virtual QStringList getImages() const = 0;
virtual const std::string getImagePath(const std::string image) const = 0;
@@ -23,7 +23,6 @@ class PathTraverser
protected:
const std::string path;
bool debugMode = false;
QStringList getImageFormats() const;
ImageDisplayOptions LoadOptionsForDirectory(const std::string &directoryPath, const ImageDisplayOptions &baseOptions) const;
};
@@ -31,7 +30,7 @@ class PathTraverser
class RecursivePathTraverser : public PathTraverser
{
public:
RecursivePathTraverser(const std::string path, bool debugModeIn);
RecursivePathTraverser(const std::string path);
virtual ~RecursivePathTraverser();
QStringList getImages() const;
virtual const std::string getImagePath(const std::string image) const;
@@ -41,7 +40,7 @@ class RecursivePathTraverser : public PathTraverser
class DefaultPathTraverser : public PathTraverser
{
public:
DefaultPathTraverser(const std::string path, bool debugModeIn);
DefaultPathTraverser(const std::string path);
virtual ~DefaultPathTraverser();
QStringList getImages() const;
virtual const std::string getImagePath(const std::string image) const;
@@ -53,7 +52,7 @@ class DefaultPathTraverser : public PathTraverser
class ImageListPathTraverser : public PathTraverser
{
public:
ImageListPathTraverser(const std::string &imageListString, bool debugModeIn);
ImageListPathTraverser(const std::string &imageListString);
virtual ~ImageListPathTraverser();
QStringList getImages() const;
virtual const std::string getImagePath(const std::string image) const;
@@ -66,7 +65,7 @@ class RedditRSSFeedPathTraverser: public QObject, public PathTraverser
{
Q_OBJECT
public:
RedditRSSFeedPathTraverser(const std::string& rSSFeedURL,QNetworkAccessManager& networkManager, bool debugModeIn);
RedditRSSFeedPathTraverser(const std::string& rSSFeedURL,QNetworkAccessManager& networkManager);
virtual ~RedditRSSFeedPathTraverser();
virtual QStringList getImages() const;

View File

@@ -5,7 +5,9 @@
#-------------------------------------------------
QT += core gui network xml
CONFIG += qt debug
CONFIG += qt
CONFIG += debug
CONFIG += c++1z
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -35,7 +37,8 @@ SOURCES += \
pathtraverser.cpp \
overlay.cpp \
imageselector.cpp \
appconfig.cpp
appconfig.cpp \
logger.cpp
HEADERS += \
mainwindow.h \
@@ -44,7 +47,8 @@ HEADERS += \
overlay.h \
imageswitcher.h \
imagestructs.h \
appconfig.h
appconfig.h \
logger.h
FORMS += \
mainwindow.ui