- Remove _t postfix from struct defns

- Remove inline header function definitions
- Change assorted functions to return structs rather than modifying an argument
This commit is contained in:
Alfred Reynolds
2021-08-05 19:50:07 +12:00
parent ceadcf7a54
commit eac73d618b
11 changed files with 100 additions and 70 deletions

View File

@@ -19,6 +19,11 @@ ImageSelector::ImageSelector(std::unique_ptr<PathTraverser>& pathTraverser):
ImageSelector::~ImageSelector(){} ImageSelector::~ImageSelector(){}
void ImageSelector::setDebugMode(bool debugModeIn)
{
debugMode = debugModeIn;
}
int ReadExifTag(ExifData* exifData, ExifTag tag, bool shortRead = false) int ReadExifTag(ExifData* exifData, ExifTag tag, bool shortRead = false)
{ {
int value = -1; int value = -1;
@@ -39,8 +44,9 @@ int ReadExifTag(ExifData* exifData, ExifTag tag, bool shortRead = false)
return value; return value;
} }
void ImageSelector::populateImageDetails(const std::string&fileName, ImageDetails_t &imageDetails, const ImageDisplayOptions_t &baseOptions) ImageDetails ImageSelector::populateImageDetails(const std::string&fileName, const ImageDisplayOptions &baseOptions)
{ {
ImageDetails imageDetails;
int orientation = -1; int orientation = -1;
int imageWidth = -1; int imageWidth = -1;
int imageHeight = -1; int imageHeight = -1;
@@ -99,16 +105,17 @@ void ImageSelector::populateImageDetails(const std::string&fileName, ImageDetail
imageDetails.height = imageHeight; imageDetails.height = imageHeight;
imageDetails.rotation = degrees; imageDetails.rotation = degrees;
if (imageWidth > imageHeight) { if (imageWidth > imageHeight) {
imageDetails.aspect = EImageAspect_Landscape; imageDetails.aspect = ImageAspect_Landscape;
} else if (imageHeight > imageWidth) { } else if (imageHeight > imageWidth) {
imageDetails.aspect = EImageAspect_Portrait; imageDetails.aspect = ImageAspect_Portrait;
} else { } else {
imageDetails.aspect = EImageAspect_Any; imageDetails.aspect = ImageAspect_Any;
} }
imageDetails.options = baseOptions; imageDetails.options = baseOptions;
return imageDetails;
} }
bool ImageSelector::imageMatchesFilter(const ImageDetails_t& imageDetails) bool ImageSelector::imageMatchesFilter(const ImageDetails& imageDetails)
{ {
if(!QFileInfo::exists(QString(imageDetails.filename.c_str()))) if(!QFileInfo::exists(QString(imageDetails.filename.c_str())))
{ {
@@ -131,9 +138,9 @@ bool ImageSelector::imageMatchesFilter(const ImageDetails_t& imageDetails)
return true; return true;
} }
bool ImageSelector::imageValidForAspect(const ImageDetails_t& imageDetails) bool ImageSelector::imageValidForAspect(const ImageDetails& imageDetails)
{ {
if (imageDetails.options.onlyAspect == EImageAspect_Any || if (imageDetails.options.onlyAspect == ImageAspect_Any ||
imageDetails.aspect == imageDetails.options.onlyAspect) imageDetails.aspect == imageDetails.options.onlyAspect)
{ {
return true; return true;
@@ -150,18 +157,18 @@ RandomImageSelector::RandomImageSelector(std::unique_ptr<PathTraverser>& pathTra
RandomImageSelector::~RandomImageSelector(){} RandomImageSelector::~RandomImageSelector(){}
const ImageDetails_t RandomImageSelector::getNextImage(const ImageDisplayOptions_t &baseOptions) const ImageDetails RandomImageSelector::getNextImage(const ImageDisplayOptions &baseOptions)
{ {
ImageDetails_t imageDetails; ImageDetails imageDetails;
try try
{ {
QStringList images = pathTraverser->getImages(); QStringList images = pathTraverser->getImages();
unsigned int selectedImage = selectRandom(images); unsigned int selectedImage = selectRandom(images);
populateImageDetails(pathTraverser->getImagePath(images.at(selectedImage).toStdString()), imageDetails, baseOptions); imageDetails = populateImageDetails(pathTraverser->getImagePath(images.at(selectedImage).toStdString()), baseOptions);
while(!imageMatchesFilter(imageDetails)) while(!imageMatchesFilter(imageDetails))
{ {
unsigned int selectedImage = selectRandom(images); unsigned int selectedImage = selectRandom(images);
populateImageDetails(pathTraverser->getImagePath(images.at(selectedImage).toStdString()), imageDetails, baseOptions); imageDetails = populateImageDetails(pathTraverser->getImagePath(images.at(selectedImage).toStdString()), baseOptions);
} }
} }
catch(const std::string& err) catch(const std::string& err)
@@ -169,7 +176,7 @@ const ImageDetails_t RandomImageSelector::getNextImage(const ImageDisplayOptions
std::cerr << "Error: " << err << std::endl; std::cerr << "Error: " << err << std::endl;
} }
std::cout << "updating image: " << imageDetails.filename << std::endl; std::cout << "updating image: " << imageDetails.filename << std::endl;
pathTraverser->UpdateOptionsForImage(imageDetails.filename, imageDetails.options); imageDetails.options = pathTraverser->UpdateOptionsForImage(imageDetails.filename, imageDetails.options);
return imageDetails; return imageDetails;
} }
@@ -198,23 +205,23 @@ ShuffleImageSelector::~ShuffleImageSelector()
{ {
} }
const ImageDetails_t ShuffleImageSelector::getNextImage(const ImageDisplayOptions_t &baseOptions) const ImageDetails ShuffleImageSelector::getNextImage(const ImageDisplayOptions &baseOptions)
{ {
reloadImagesIfNoneLeft(); reloadImagesIfNoneLeft();
ImageDetails_t imageDetails; ImageDetails imageDetails;
if (images.size() == 0) if (images.size() == 0)
{ {
return imageDetails; return imageDetails;
} }
populateImageDetails(pathTraverser->getImagePath(images.at(current_image_shuffle).toStdString()), imageDetails, baseOptions); imageDetails = populateImageDetails(pathTraverser->getImagePath(images.at(current_image_shuffle).toStdString()), baseOptions);
current_image_shuffle = current_image_shuffle + 1; // ignore and move to next image current_image_shuffle = current_image_shuffle + 1; // ignore and move to next image
while(!imageMatchesFilter(imageDetails)) { while(!imageMatchesFilter(imageDetails)) {
reloadImagesIfNoneLeft(); reloadImagesIfNoneLeft();
populateImageDetails(pathTraverser->getImagePath(images.at(current_image_shuffle).toStdString()), imageDetails,baseOptions); imageDetails = populateImageDetails(pathTraverser->getImagePath(images.at(current_image_shuffle).toStdString()),baseOptions);
current_image_shuffle = current_image_shuffle + 1; // ignore and move to next image current_image_shuffle = current_image_shuffle + 1; // ignore and move to next image
} }
std::cout << "updating image: " << imageDetails.filename << std::endl; std::cout << "updating image: " << imageDetails.filename << std::endl;
pathTraverser->UpdateOptionsForImage(imageDetails.filename, imageDetails.options); imageDetails.options = pathTraverser->UpdateOptionsForImage(imageDetails.filename, imageDetails.options);
return imageDetails; return imageDetails;
} }
@@ -254,22 +261,22 @@ bool operator<(const QString& lhs, const QString& rhs) noexcept{
} }
const ImageDetails_t SortedImageSelector::getNextImage(const ImageDisplayOptions_t &baseOptions) const ImageDetails SortedImageSelector::getNextImage(const ImageDisplayOptions &baseOptions)
{ {
reloadImagesIfEmpty(); reloadImagesIfEmpty();
ImageDetails_t imageDetails; ImageDetails imageDetails;
if (images.size() == 0) if (images.size() == 0)
{ {
return imageDetails; return imageDetails;
} }
populateImageDetails(pathTraverser->getImagePath(images.takeFirst().toStdString()), imageDetails, baseOptions); imageDetails = populateImageDetails(pathTraverser->getImagePath(images.takeFirst().toStdString()), baseOptions);
while(!imageMatchesFilter(imageDetails)) { while(!imageMatchesFilter(imageDetails)) {
reloadImagesIfEmpty(); reloadImagesIfEmpty();
populateImageDetails(pathTraverser->getImagePath(images.takeFirst().toStdString()), imageDetails, baseOptions); imageDetails = populateImageDetails(pathTraverser->getImagePath(images.takeFirst().toStdString()), baseOptions);
} }
std::cout << "updating image: " << imageDetails.filename << std::endl; std::cout << "updating image: " << imageDetails.filename << std::endl;
pathTraverser->UpdateOptionsForImage(imageDetails.filename, imageDetails.options); imageDetails.options = pathTraverser->UpdateOptionsForImage(imageDetails.filename, imageDetails.options);
return imageDetails; return imageDetails;
} }

View File

@@ -14,13 +14,13 @@ class ImageSelector
public: public:
ImageSelector(std::unique_ptr<PathTraverser>& pathTraverser); ImageSelector(std::unique_ptr<PathTraverser>& pathTraverser);
virtual ~ImageSelector(); virtual ~ImageSelector();
virtual const ImageDetails_t getNextImage(const ImageDisplayOptions_t &baseOptions) = 0; virtual const ImageDetails getNextImage(const ImageDisplayOptions &baseOptions) = 0;
void setDebugMode(bool debugModeIn) { debugMode = debugModeIn;} void setDebugMode(bool debugModeIn);
protected: protected:
void populateImageDetails(const std::string&filename, ImageDetails_t &imageDetails, const ImageDisplayOptions_t &baseOptions); ImageDetails populateImageDetails(const std::string&filename, const ImageDisplayOptions &baseOptions);
bool imageValidForAspect(const ImageDetails_t& imageDetails); bool imageValidForAspect(const ImageDetails& imageDetails);
bool imageMatchesFilter(const ImageDetails_t& imageDetails); bool imageMatchesFilter(const ImageDetails& imageDetails);
std::unique_ptr<PathTraverser>& pathTraverser; std::unique_ptr<PathTraverser>& pathTraverser;
bool debugMode = false; bool debugMode = false;
}; };
@@ -30,7 +30,7 @@ class RandomImageSelector : public ImageSelector
public: public:
RandomImageSelector(std::unique_ptr<PathTraverser>& pathTraverser); RandomImageSelector(std::unique_ptr<PathTraverser>& pathTraverser);
virtual ~RandomImageSelector(); virtual ~RandomImageSelector();
virtual const ImageDetails_t getNextImage(const ImageDisplayOptions_t &baseOptions); virtual const ImageDetails getNextImage(const ImageDisplayOptions &baseOptions);
private: private:
unsigned int selectRandom(const QStringList& images) const; unsigned int selectRandom(const QStringList& images) const;
@@ -41,7 +41,7 @@ class ShuffleImageSelector : public ImageSelector
public: public:
ShuffleImageSelector(std::unique_ptr<PathTraverser>& pathTraverser); ShuffleImageSelector(std::unique_ptr<PathTraverser>& pathTraverser);
virtual ~ShuffleImageSelector(); virtual ~ShuffleImageSelector();
virtual const ImageDetails_t getNextImage(const ImageDisplayOptions_t &baseOptions); virtual const ImageDetails getNextImage(const ImageDisplayOptions &baseOptions);
private: private:
void reloadImagesIfNoneLeft(); void reloadImagesIfNoneLeft();
@@ -54,7 +54,7 @@ class SortedImageSelector : public ImageSelector
public: public:
SortedImageSelector(std::unique_ptr<PathTraverser>& pathTraverser); SortedImageSelector(std::unique_ptr<PathTraverser>& pathTraverser);
virtual ~SortedImageSelector(); virtual ~SortedImageSelector();
virtual const ImageDetails_t getNextImage(const ImageDisplayOptions_t &baseOptions); virtual const ImageDetails getNextImage(const ImageDisplayOptions &baseOptions);
private: private:
void reloadImagesIfEmpty(); void reloadImagesIfEmpty();

View File

@@ -4,24 +4,24 @@
#include <string> #include <string>
// possible aspect ratios of an image // possible aspect ratios of an image
enum EImageAspect { EImageAspect_Landscape = 0, EImageAspect_Portrait, EImageAspect_Any, EImageAspect_Monitor /* match monitors aspect */ }; enum ImageAspect { ImageAspect_Landscape = 0, ImageAspect_Portrait, ImageAspect_Any, ImageAspect_Monitor /* match monitors aspect */ };
// options to consider when displaying an image // options to consider when displaying an image
struct ImageDisplayOptions_t struct ImageDisplayOptions
{ {
EImageAspect onlyAspect = EImageAspect_Any; ImageAspect onlyAspect = ImageAspect_Any;
bool fitAspectAxisToWindow = false; bool fitAspectAxisToWindow = false;
}; };
// details of a particular image // details of a particular image
struct ImageDetails_t struct ImageDetails
{ {
int width = 0; int width = 0;
int height = 0; int height = 0;
int rotation = 0; int rotation = 0;
EImageAspect aspect = EImageAspect_Any; ImageAspect aspect = ImageAspect_Any;
std::string filename; std::string filename;
ImageDisplayOptions_t options; ImageDisplayOptions options;
}; };

View File

@@ -21,7 +21,7 @@ ImageSwitcher::ImageSwitcher(MainWindow& w, unsigned int timeout, std::unique_pt
void ImageSwitcher::updateImage() void ImageSwitcher::updateImage()
{ {
ImageDetails_t imageDetails = selector->getNextImage(window.getBaseOptions()); ImageDetails imageDetails = selector->getNextImage(window.getBaseOptions());
if (imageDetails.filename == "") if (imageDetails.filename == "")
{ {
window.warn("No image found."); window.warn("No image found.");

View File

@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
bool shuffle = false; bool shuffle = false;
bool sorted = false; bool sorted = false;
bool debugMode = false; bool debugMode = false;
ImageDisplayOptions_t baseDisplayOptions; ImageDisplayOptions baseDisplayOptions;
std::string valid_aspects = "alpm"; // all, landscape, portait std::string valid_aspects = "alpm"; // all, landscape, portait
std::string overlay = ""; std::string overlay = "";
std::string imageList = ""; // comma delimited list of images to show std::string imageList = ""; // comma delimited list of images to show
@@ -59,24 +59,24 @@ int main(int argc, char *argv[])
if ( valid_aspects.find(optarg[0]) == std::string::npos ) if ( valid_aspects.find(optarg[0]) == std::string::npos )
{ {
std::cout << "Invalid Aspect option, defaulting to all" << std::endl; std::cout << "Invalid Aspect option, defaulting to all" << std::endl;
baseDisplayOptions.onlyAspect = EImageAspect_Any; baseDisplayOptions.onlyAspect = ImageAspect_Any;
} }
else else
{ {
switch(optarg[0]) switch(optarg[0])
{ {
case 'l': case 'l':
baseDisplayOptions.onlyAspect = EImageAspect_Landscape; baseDisplayOptions.onlyAspect = ImageAspect_Landscape;
break; break;
case 'p': case 'p':
baseDisplayOptions.onlyAspect = EImageAspect_Portrait; baseDisplayOptions.onlyAspect = ImageAspect_Portrait;
break; break;
case 'm': case 'm':
baseDisplayOptions.onlyAspect = EImageAspect_Monitor; baseDisplayOptions.onlyAspect = ImageAspect_Monitor;
break; break;
default: default:
case 'a': case 'a':
baseDisplayOptions.onlyAspect = EImageAspect_Any; baseDisplayOptions.onlyAspect = ImageAspect_Any;
break; break;
} }
} }

View File

@@ -113,7 +113,7 @@ void MainWindow::resizeEvent(QResizeEvent* event)
bool isLandscape = screenSize.width() > screenSize.height(); bool isLandscape = screenSize.width() > screenSize.height();
if (imageAspectMatchesMonitor) if (imageAspectMatchesMonitor)
{ {
baseImageOptions.onlyAspect = isLandscape ? EImageAspect_Landscape : EImageAspect_Portrait; baseImageOptions.onlyAspect = isLandscape ? ImageAspect_Landscape : ImageAspect_Portrait;
} }
if(debugMode) if(debugMode)
{ {
@@ -143,7 +143,7 @@ void MainWindow::checkWindowSize()
} }
void MainWindow::setImage(const ImageDetails_t &imageDetails) void MainWindow::setImage(const ImageDetails &imageDetails)
{ {
currentImage = imageDetails; currentImage = imageDetails;
updateImage(false); updateImage(false);
@@ -268,13 +268,13 @@ QPixmap MainWindow::getScaledPixmap(const QPixmap& p)
{ {
if (currentImage.options.fitAspectAxisToWindow) if (currentImage.options.fitAspectAxisToWindow)
{ {
if (currentImage.aspect == EImageAspect_Portrait) if (currentImage.aspect == ImageAspect_Portrait)
{ {
// potrait mode, make height of image fit screen and crop top/bottom // potrait mode, make height of image fit screen and crop top/bottom
QPixmap pTemp = p.scaledToHeight(height(), Qt::SmoothTransformation); QPixmap pTemp = p.scaledToHeight(height(), Qt::SmoothTransformation);
return pTemp.copy(0,0,width(),height()); return pTemp.copy(0,0,width(),height());
} }
else if (currentImage.aspect == EImageAspect_Landscape) else if (currentImage.aspect == ImageAspect_Landscape)
{ {
// landscape mode, make width of image fit screen and crop top/bottom // landscape mode, make width of image fit screen and crop top/bottom
QPixmap pTemp = p.scaledToWidth(width(), Qt::SmoothTransformation); QPixmap pTemp = p.scaledToWidth(width(), Qt::SmoothTransformation);
@@ -339,12 +339,27 @@ void MainWindow::warn(std::string text)
label->setText(text.c_str()); label->setText(text.c_str());
} }
void MainWindow::setBaseOptions(const ImageDisplayOptions_t &baseOptionsIn) void MainWindow::setBaseOptions(const ImageDisplayOptions &baseOptionsIn)
{ {
baseImageOptions = baseOptionsIn; baseImageOptions = baseOptionsIn;
if(baseImageOptions.onlyAspect == EImageAspect_Monitor) if(baseImageOptions.onlyAspect == ImageAspect_Monitor)
{ {
imageAspectMatchesMonitor = true; imageAspectMatchesMonitor = true;
baseImageOptions.onlyAspect = width() >= height() ? EImageAspect_Landscape : EImageAspect_Portrait; baseImageOptions.onlyAspect = width() >= height() ? ImageAspect_Landscape : ImageAspect_Portrait;
} }
} }
void MainWindow::setImageSwitcher(ImageSwitcher *switcherIn)
{
switcher = switcherIn;
}
void MainWindow::setDebugMode(bool debugModeIn)
{
debugMode = debugModeIn;
}
const ImageDisplayOptions &MainWindow::getBaseOptions()
{
return baseImageOptions;
}

View File

@@ -24,15 +24,15 @@ public:
bool event(QEvent* event) override; bool event(QEvent* event) override;
void resizeEvent(QResizeEvent* event) override; void resizeEvent(QResizeEvent* event) override;
~MainWindow(); ~MainWindow();
void setImage(const ImageDetails_t &imageDetails); void setImage(const ImageDetails &imageDetails);
void setBlurRadius(unsigned int blurRadius); void setBlurRadius(unsigned int blurRadius);
void setBackgroundOpacity(unsigned int opacity); void setBackgroundOpacity(unsigned int opacity);
void warn(std::string text); void warn(std::string text);
void setOverlay(Overlay* overlay); void setOverlay(Overlay* overlay);
void setDebugMode(bool debugModeIn) {debugMode = debugModeIn;} void setDebugMode(bool debugModeIn);
void setBaseOptions(const ImageDisplayOptions_t &baseOptionsIn); void setBaseOptions(const ImageDisplayOptions &baseOptionsIn);
const ImageDisplayOptions_t &getBaseOptions() { return baseImageOptions; } const ImageDisplayOptions &getBaseOptions();
void setImageSwitcher(ImageSwitcher *switcherIn) { switcher = switcherIn; } void setImageSwitcher(ImageSwitcher *switcherIn);
public slots: public slots:
void checkWindowSize(); void checkWindowSize();
private: private:
@@ -40,9 +40,9 @@ private:
unsigned int blurRadius = 20; unsigned int blurRadius = 20;
unsigned int backgroundOpacity = 150; unsigned int backgroundOpacity = 150;
ImageDisplayOptions_t baseImageOptions; ImageDisplayOptions baseImageOptions;
bool imageAspectMatchesMonitor = false; bool imageAspectMatchesMonitor = false;
ImageDetails_t currentImage; ImageDetails currentImage;
bool debugMode = false; bool debugMode = false;
QSize lastScreenSize = {0,0}; QSize lastScreenSize = {0,0};

View File

@@ -19,6 +19,11 @@ Overlay::Overlay(const std::string overlayInput):
Overlay::~Overlay() {} Overlay::~Overlay() {}
void Overlay::setDebugMode(const bool debugModeIn)
{
debugMode = debugModeIn;
}
void Overlay::parseInput() { void Overlay::parseInput() {
QString str = QString(overlayInput.c_str()); QString str = QString(overlayInput.c_str());
QStringList corners = str.split(QLatin1Char(';')); QStringList corners = str.split(QLatin1Char(';'));

View File

@@ -27,7 +27,7 @@ class Overlay
int getMarginBottomRight(); int getMarginBottomRight();
int getFontsizeBottomRight(); int getFontsizeBottomRight();
void setDebugMode(const bool debugModeIn) { debugMode = debugModeIn; } void setDebugMode(const bool debugModeIn);
private: private:
const std::string overlayInput; const std::string overlayInput;

View File

@@ -25,8 +25,9 @@ QStringList PathTraverser::getImageFormats() const {
return imageFormats; return imageFormats;
} }
void PathTraverser::LoadOptionsForDirectory(const std::string &directoryPath, ImageDisplayOptions_t &options) const ImageDisplayOptions PathTraverser::LoadOptionsForDirectory(const std::string &directoryPath, const ImageDisplayOptions &baseOptions) const
{ {
ImageDisplayOptions options = baseOptions;
QDir directory(directoryPath.c_str()); QDir directory(directoryPath.c_str());
QString jsonFile = directory.filePath(QString("options.json")); QString jsonFile = directory.filePath(QString("options.json"));
if(directory.exists(jsonFile)) if(directory.exists(jsonFile))
@@ -52,6 +53,7 @@ void PathTraverser::LoadOptionsForDirectory(const std::string &directoryPath, Im
} }
} }
} }
return options;
} }
RecursivePathTraverser::RecursivePathTraverser(const std::string path,bool debugMode): RecursivePathTraverser::RecursivePathTraverser(const std::string path,bool debugMode):
@@ -78,10 +80,10 @@ const std::string RecursivePathTraverser::getImagePath(const std::string image)
return image; return image;
} }
void RecursivePathTraverser::UpdateOptionsForImage(const std::string& filename, ImageDisplayOptions_t& options) const ImageDisplayOptions RecursivePathTraverser::UpdateOptionsForImage(const std::string& filename, const ImageDisplayOptions& baseOptions) const
{ {
QDir d = QFileInfo(filename.c_str()).absoluteDir(); QDir d = QFileInfo(filename.c_str()).absoluteDir();
LoadOptionsForDirectory(d.absolutePath().toStdString(), options); return LoadOptionsForDirectory(d.absolutePath().toStdString(), baseOptions);
} }
DefaultPathTraverser::DefaultPathTraverser(const std::string path,bool debugMode): DefaultPathTraverser::DefaultPathTraverser(const std::string path,bool debugMode):
@@ -102,10 +104,10 @@ const std::string DefaultPathTraverser::getImagePath(const std::string image) co
return directory.filePath(QString(image.c_str())).toStdString(); return directory.filePath(QString(image.c_str())).toStdString();
} }
void DefaultPathTraverser::UpdateOptionsForImage(const std::string& filename, ImageDisplayOptions_t& options) const ImageDisplayOptions DefaultPathTraverser::UpdateOptionsForImage(const std::string& filename, const ImageDisplayOptions& baseOptions) const
{ {
UNUSED(filename); UNUSED(filename);
LoadOptionsForDirectory(directory.absolutePath().toStdString(), options); return LoadOptionsForDirectory(directory.absolutePath().toStdString(), baseOptions);
} }
ImageListPathTraverser::ImageListPathTraverser(const std::string &imageListString,bool debugMode): ImageListPathTraverser::ImageListPathTraverser(const std::string &imageListString,bool debugMode):
@@ -128,9 +130,10 @@ const std::string ImageListPathTraverser::getImagePath(const std::string image)
return image; return image;
} }
void ImageListPathTraverser::UpdateOptionsForImage(const std::string& filename, ImageDisplayOptions_t& options) const ImageDisplayOptions ImageListPathTraverser::UpdateOptionsForImage(const std::string& filename, const ImageDisplayOptions& baseOptions) const
{ {
// no per file options modification supported // no per file options modification supported
UNUSED(filename); UNUSED(filename);
UNUSED(options); UNUSED(baseOptions);
return ImageDisplayOptions();
} }

View File

@@ -16,13 +16,13 @@ class PathTraverser
virtual ~PathTraverser(); virtual ~PathTraverser();
virtual QStringList getImages() const = 0; virtual QStringList getImages() const = 0;
virtual const std::string getImagePath(const std::string image) const = 0; virtual const std::string getImagePath(const std::string image) const = 0;
virtual void UpdateOptionsForImage(const std::string& filename, ImageDisplayOptions_t& options) const = 0; virtual ImageDisplayOptions UpdateOptionsForImage(const std::string& filename, const ImageDisplayOptions& baseOptions) const = 0;
protected: protected:
const std::string path; const std::string path;
bool debugMode = false; bool debugMode = false;
QStringList getImageFormats() const; QStringList getImageFormats() const;
void LoadOptionsForDirectory(const std::string &directoryPath, ImageDisplayOptions_t &options) const; ImageDisplayOptions LoadOptionsForDirectory(const std::string &directoryPath, const ImageDisplayOptions &baseOptions) const;
}; };
class RecursivePathTraverser : public PathTraverser class RecursivePathTraverser : public PathTraverser
@@ -32,7 +32,7 @@ class RecursivePathTraverser : public PathTraverser
virtual ~RecursivePathTraverser(); virtual ~RecursivePathTraverser();
QStringList getImages() const; QStringList getImages() const;
virtual const std::string getImagePath(const std::string image) const; virtual const std::string getImagePath(const std::string image) const;
virtual void UpdateOptionsForImage(const std::string& filename, ImageDisplayOptions_t& options) const; virtual ImageDisplayOptions UpdateOptionsForImage(const std::string& filename, const ImageDisplayOptions& baseOptions) const;
}; };
class DefaultPathTraverser : public PathTraverser class DefaultPathTraverser : public PathTraverser
@@ -42,7 +42,7 @@ class DefaultPathTraverser : public PathTraverser
virtual ~DefaultPathTraverser(); virtual ~DefaultPathTraverser();
QStringList getImages() const; QStringList getImages() const;
virtual const std::string getImagePath(const std::string image) const; virtual const std::string getImagePath(const std::string image) const;
virtual void UpdateOptionsForImage(const std::string& filename, ImageDisplayOptions_t& options) const; virtual ImageDisplayOptions UpdateOptionsForImage(const std::string& filename, const ImageDisplayOptions& baseOptions) const;
private: private:
QDir directory; QDir directory;
}; };
@@ -54,7 +54,7 @@ class ImageListPathTraverser : public PathTraverser
virtual ~ImageListPathTraverser(); virtual ~ImageListPathTraverser();
QStringList getImages() const; QStringList getImages() const;
virtual const std::string getImagePath(const std::string image) const; virtual const std::string getImagePath(const std::string image) const;
virtual void UpdateOptionsForImage(const std::string& filename, ImageDisplayOptions_t& options) const; virtual ImageDisplayOptions UpdateOptionsForImage(const std::string& filename, const ImageDisplayOptions& options) const;
private: private:
QStringList imageList; QStringList imageList;
}; };