- 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:
@@ -19,6 +19,11 @@ ImageSelector::ImageSelector(std::unique_ptr<PathTraverser>& pathTraverser):
|
||||
|
||||
ImageSelector::~ImageSelector(){}
|
||||
|
||||
void ImageSelector::setDebugMode(bool debugModeIn)
|
||||
{
|
||||
debugMode = debugModeIn;
|
||||
}
|
||||
|
||||
int ReadExifTag(ExifData* exifData, ExifTag tag, bool shortRead = false)
|
||||
{
|
||||
int value = -1;
|
||||
@@ -39,8 +44,9 @@ int ReadExifTag(ExifData* exifData, ExifTag tag, bool shortRead = false)
|
||||
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 imageWidth = -1;
|
||||
int imageHeight = -1;
|
||||
@@ -99,16 +105,17 @@ void ImageSelector::populateImageDetails(const std::string&fileName, ImageDetail
|
||||
imageDetails.height = imageHeight;
|
||||
imageDetails.rotation = degrees;
|
||||
if (imageWidth > imageHeight) {
|
||||
imageDetails.aspect = EImageAspect_Landscape;
|
||||
imageDetails.aspect = ImageAspect_Landscape;
|
||||
} else if (imageHeight > imageWidth) {
|
||||
imageDetails.aspect = EImageAspect_Portrait;
|
||||
imageDetails.aspect = ImageAspect_Portrait;
|
||||
} else {
|
||||
imageDetails.aspect = EImageAspect_Any;
|
||||
imageDetails.aspect = ImageAspect_Any;
|
||||
}
|
||||
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())))
|
||||
{
|
||||
@@ -131,9 +138,9 @@ bool ImageSelector::imageMatchesFilter(const ImageDetails_t& imageDetails)
|
||||
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)
|
||||
{
|
||||
return true;
|
||||
@@ -150,18 +157,18 @@ RandomImageSelector::RandomImageSelector(std::unique_ptr<PathTraverser>& pathTra
|
||||
|
||||
RandomImageSelector::~RandomImageSelector(){}
|
||||
|
||||
const ImageDetails_t RandomImageSelector::getNextImage(const ImageDisplayOptions_t &baseOptions)
|
||||
const ImageDetails RandomImageSelector::getNextImage(const ImageDisplayOptions &baseOptions)
|
||||
{
|
||||
ImageDetails_t imageDetails;
|
||||
ImageDetails imageDetails;
|
||||
try
|
||||
{
|
||||
QStringList images = pathTraverser->getImages();
|
||||
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))
|
||||
{
|
||||
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)
|
||||
@@ -169,7 +176,7 @@ const ImageDetails_t RandomImageSelector::getNextImage(const ImageDisplayOptions
|
||||
std::cerr << "Error: " << err << 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;
|
||||
}
|
||||
|
||||
@@ -198,23 +205,23 @@ ShuffleImageSelector::~ShuffleImageSelector()
|
||||
{
|
||||
}
|
||||
|
||||
const ImageDetails_t ShuffleImageSelector::getNextImage(const ImageDisplayOptions_t &baseOptions)
|
||||
const ImageDetails ShuffleImageSelector::getNextImage(const ImageDisplayOptions &baseOptions)
|
||||
{
|
||||
reloadImagesIfNoneLeft();
|
||||
ImageDetails_t imageDetails;
|
||||
ImageDetails imageDetails;
|
||||
if (images.size() == 0)
|
||||
{
|
||||
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
|
||||
while(!imageMatchesFilter(imageDetails)) {
|
||||
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
|
||||
}
|
||||
std::cout << "updating image: " << imageDetails.filename << std::endl;
|
||||
pathTraverser->UpdateOptionsForImage(imageDetails.filename, imageDetails.options);
|
||||
imageDetails.options = pathTraverser->UpdateOptionsForImage(imageDetails.filename, imageDetails.options);
|
||||
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();
|
||||
ImageDetails_t imageDetails;
|
||||
ImageDetails imageDetails;
|
||||
if (images.size() == 0)
|
||||
{
|
||||
return imageDetails;
|
||||
}
|
||||
populateImageDetails(pathTraverser->getImagePath(images.takeFirst().toStdString()), imageDetails, baseOptions);
|
||||
imageDetails = populateImageDetails(pathTraverser->getImagePath(images.takeFirst().toStdString()), baseOptions);
|
||||
while(!imageMatchesFilter(imageDetails)) {
|
||||
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;
|
||||
pathTraverser->UpdateOptionsForImage(imageDetails.filename, imageDetails.options);
|
||||
imageDetails.options = pathTraverser->UpdateOptionsForImage(imageDetails.filename, imageDetails.options);
|
||||
return imageDetails;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@ class ImageSelector
|
||||
public:
|
||||
ImageSelector(std::unique_ptr<PathTraverser>& pathTraverser);
|
||||
virtual ~ImageSelector();
|
||||
virtual const ImageDetails_t getNextImage(const ImageDisplayOptions_t &baseOptions) = 0;
|
||||
void setDebugMode(bool debugModeIn) { debugMode = debugModeIn;}
|
||||
virtual const ImageDetails getNextImage(const ImageDisplayOptions &baseOptions) = 0;
|
||||
void setDebugMode(bool debugModeIn);
|
||||
|
||||
protected:
|
||||
void populateImageDetails(const std::string&filename, ImageDetails_t &imageDetails, const ImageDisplayOptions_t &baseOptions);
|
||||
bool imageValidForAspect(const ImageDetails_t& imageDetails);
|
||||
bool imageMatchesFilter(const ImageDetails_t& imageDetails);
|
||||
ImageDetails populateImageDetails(const std::string&filename, const ImageDisplayOptions &baseOptions);
|
||||
bool imageValidForAspect(const ImageDetails& imageDetails);
|
||||
bool imageMatchesFilter(const ImageDetails& imageDetails);
|
||||
std::unique_ptr<PathTraverser>& pathTraverser;
|
||||
bool debugMode = false;
|
||||
};
|
||||
@@ -30,7 +30,7 @@ class RandomImageSelector : public ImageSelector
|
||||
public:
|
||||
RandomImageSelector(std::unique_ptr<PathTraverser>& pathTraverser);
|
||||
virtual ~RandomImageSelector();
|
||||
virtual const ImageDetails_t getNextImage(const ImageDisplayOptions_t &baseOptions);
|
||||
virtual const ImageDetails getNextImage(const ImageDisplayOptions &baseOptions);
|
||||
|
||||
private:
|
||||
unsigned int selectRandom(const QStringList& images) const;
|
||||
@@ -41,7 +41,7 @@ class ShuffleImageSelector : public ImageSelector
|
||||
public:
|
||||
ShuffleImageSelector(std::unique_ptr<PathTraverser>& pathTraverser);
|
||||
virtual ~ShuffleImageSelector();
|
||||
virtual const ImageDetails_t getNextImage(const ImageDisplayOptions_t &baseOptions);
|
||||
virtual const ImageDetails getNextImage(const ImageDisplayOptions &baseOptions);
|
||||
|
||||
private:
|
||||
void reloadImagesIfNoneLeft();
|
||||
@@ -54,7 +54,7 @@ class SortedImageSelector : public ImageSelector
|
||||
public:
|
||||
SortedImageSelector(std::unique_ptr<PathTraverser>& pathTraverser);
|
||||
virtual ~SortedImageSelector();
|
||||
virtual const ImageDetails_t getNextImage(const ImageDisplayOptions_t &baseOptions);
|
||||
virtual const ImageDetails getNextImage(const ImageDisplayOptions &baseOptions);
|
||||
|
||||
private:
|
||||
void reloadImagesIfEmpty();
|
||||
|
||||
@@ -4,24 +4,24 @@
|
||||
#include <string>
|
||||
|
||||
// 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
|
||||
struct ImageDisplayOptions_t
|
||||
struct ImageDisplayOptions
|
||||
{
|
||||
EImageAspect onlyAspect = EImageAspect_Any;
|
||||
ImageAspect onlyAspect = ImageAspect_Any;
|
||||
bool fitAspectAxisToWindow = false;
|
||||
};
|
||||
|
||||
// details of a particular image
|
||||
struct ImageDetails_t
|
||||
struct ImageDetails
|
||||
{
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
int rotation = 0;
|
||||
EImageAspect aspect = EImageAspect_Any;
|
||||
ImageAspect aspect = ImageAspect_Any;
|
||||
std::string filename;
|
||||
ImageDisplayOptions_t options;
|
||||
ImageDisplayOptions options;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ ImageSwitcher::ImageSwitcher(MainWindow& w, unsigned int timeout, std::unique_pt
|
||||
|
||||
void ImageSwitcher::updateImage()
|
||||
{
|
||||
ImageDetails_t imageDetails = selector->getNextImage(window.getBaseOptions());
|
||||
ImageDetails imageDetails = selector->getNextImage(window.getBaseOptions());
|
||||
if (imageDetails.filename == "")
|
||||
{
|
||||
window.warn("No image found.");
|
||||
|
||||
12
src/main.cpp
12
src/main.cpp
@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
|
||||
bool shuffle = false;
|
||||
bool sorted = false;
|
||||
bool debugMode = false;
|
||||
ImageDisplayOptions_t baseDisplayOptions;
|
||||
ImageDisplayOptions baseDisplayOptions;
|
||||
std::string valid_aspects = "alpm"; // all, landscape, portait
|
||||
std::string overlay = "";
|
||||
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 )
|
||||
{
|
||||
std::cout << "Invalid Aspect option, defaulting to all" << std::endl;
|
||||
baseDisplayOptions.onlyAspect = EImageAspect_Any;
|
||||
baseDisplayOptions.onlyAspect = ImageAspect_Any;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(optarg[0])
|
||||
{
|
||||
case 'l':
|
||||
baseDisplayOptions.onlyAspect = EImageAspect_Landscape;
|
||||
baseDisplayOptions.onlyAspect = ImageAspect_Landscape;
|
||||
break;
|
||||
case 'p':
|
||||
baseDisplayOptions.onlyAspect = EImageAspect_Portrait;
|
||||
baseDisplayOptions.onlyAspect = ImageAspect_Portrait;
|
||||
break;
|
||||
case 'm':
|
||||
baseDisplayOptions.onlyAspect = EImageAspect_Monitor;
|
||||
baseDisplayOptions.onlyAspect = ImageAspect_Monitor;
|
||||
break;
|
||||
default:
|
||||
case 'a':
|
||||
baseDisplayOptions.onlyAspect = EImageAspect_Any;
|
||||
baseDisplayOptions.onlyAspect = ImageAspect_Any;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ void MainWindow::resizeEvent(QResizeEvent* event)
|
||||
bool isLandscape = screenSize.width() > screenSize.height();
|
||||
if (imageAspectMatchesMonitor)
|
||||
{
|
||||
baseImageOptions.onlyAspect = isLandscape ? EImageAspect_Landscape : EImageAspect_Portrait;
|
||||
baseImageOptions.onlyAspect = isLandscape ? ImageAspect_Landscape : ImageAspect_Portrait;
|
||||
}
|
||||
if(debugMode)
|
||||
{
|
||||
@@ -143,7 +143,7 @@ void MainWindow::checkWindowSize()
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::setImage(const ImageDetails_t &imageDetails)
|
||||
void MainWindow::setImage(const ImageDetails &imageDetails)
|
||||
{
|
||||
currentImage = imageDetails;
|
||||
updateImage(false);
|
||||
@@ -268,13 +268,13 @@ QPixmap MainWindow::getScaledPixmap(const QPixmap& p)
|
||||
{
|
||||
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
|
||||
QPixmap pTemp = p.scaledToHeight(height(), Qt::SmoothTransformation);
|
||||
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
|
||||
QPixmap pTemp = p.scaledToWidth(width(), Qt::SmoothTransformation);
|
||||
@@ -339,12 +339,27 @@ void MainWindow::warn(std::string text)
|
||||
label->setText(text.c_str());
|
||||
}
|
||||
|
||||
void MainWindow::setBaseOptions(const ImageDisplayOptions_t &baseOptionsIn)
|
||||
void MainWindow::setBaseOptions(const ImageDisplayOptions &baseOptionsIn)
|
||||
{
|
||||
baseImageOptions = baseOptionsIn;
|
||||
if(baseImageOptions.onlyAspect == EImageAspect_Monitor)
|
||||
if(baseImageOptions.onlyAspect == ImageAspect_Monitor)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -24,15 +24,15 @@ public:
|
||||
bool event(QEvent* event) override;
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
~MainWindow();
|
||||
void setImage(const ImageDetails_t &imageDetails);
|
||||
void setImage(const ImageDetails &imageDetails);
|
||||
void setBlurRadius(unsigned int blurRadius);
|
||||
void setBackgroundOpacity(unsigned int opacity);
|
||||
void warn(std::string text);
|
||||
void setOverlay(Overlay* overlay);
|
||||
void setDebugMode(bool debugModeIn) {debugMode = debugModeIn;}
|
||||
void setBaseOptions(const ImageDisplayOptions_t &baseOptionsIn);
|
||||
const ImageDisplayOptions_t &getBaseOptions() { return baseImageOptions; }
|
||||
void setImageSwitcher(ImageSwitcher *switcherIn) { switcher = switcherIn; }
|
||||
void setDebugMode(bool debugModeIn);
|
||||
void setBaseOptions(const ImageDisplayOptions &baseOptionsIn);
|
||||
const ImageDisplayOptions &getBaseOptions();
|
||||
void setImageSwitcher(ImageSwitcher *switcherIn);
|
||||
public slots:
|
||||
void checkWindowSize();
|
||||
private:
|
||||
@@ -40,9 +40,9 @@ private:
|
||||
|
||||
unsigned int blurRadius = 20;
|
||||
unsigned int backgroundOpacity = 150;
|
||||
ImageDisplayOptions_t baseImageOptions;
|
||||
ImageDisplayOptions baseImageOptions;
|
||||
bool imageAspectMatchesMonitor = false;
|
||||
ImageDetails_t currentImage;
|
||||
ImageDetails currentImage;
|
||||
bool debugMode = false;
|
||||
QSize lastScreenSize = {0,0};
|
||||
|
||||
|
||||
@@ -19,6 +19,11 @@ 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(';'));
|
||||
|
||||
@@ -27,7 +27,7 @@ class Overlay
|
||||
int getMarginBottomRight();
|
||||
int getFontsizeBottomRight();
|
||||
|
||||
void setDebugMode(const bool debugModeIn) { debugMode = debugModeIn; }
|
||||
void setDebugMode(const bool debugModeIn);
|
||||
|
||||
private:
|
||||
const std::string overlayInput;
|
||||
|
||||
@@ -25,8 +25,9 @@ QStringList PathTraverser::getImageFormats() const {
|
||||
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());
|
||||
QString jsonFile = directory.filePath(QString("options.json"));
|
||||
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):
|
||||
@@ -78,10 +80,10 @@ const std::string RecursivePathTraverser::getImagePath(const std::string 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();
|
||||
LoadOptionsForDirectory(d.absolutePath().toStdString(), options);
|
||||
return LoadOptionsForDirectory(d.absolutePath().toStdString(), baseOptions);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
void DefaultPathTraverser::UpdateOptionsForImage(const std::string& filename, ImageDisplayOptions_t& options) const
|
||||
ImageDisplayOptions DefaultPathTraverser::UpdateOptionsForImage(const std::string& filename, const ImageDisplayOptions& baseOptions) const
|
||||
{
|
||||
UNUSED(filename);
|
||||
LoadOptionsForDirectory(directory.absolutePath().toStdString(), options);
|
||||
return LoadOptionsForDirectory(directory.absolutePath().toStdString(), baseOptions);
|
||||
}
|
||||
|
||||
ImageListPathTraverser::ImageListPathTraverser(const std::string &imageListString,bool debugMode):
|
||||
@@ -128,9 +130,10 @@ const std::string ImageListPathTraverser::getImagePath(const std::string 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
|
||||
UNUSED(filename);
|
||||
UNUSED(options);
|
||||
UNUSED(baseOptions);
|
||||
return ImageDisplayOptions();
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ class PathTraverser
|
||||
virtual ~PathTraverser();
|
||||
virtual QStringList getImages() 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:
|
||||
const std::string path;
|
||||
bool debugMode = false;
|
||||
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
|
||||
@@ -32,7 +32,7 @@ class RecursivePathTraverser : public PathTraverser
|
||||
virtual ~RecursivePathTraverser();
|
||||
QStringList getImages() 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
|
||||
@@ -42,7 +42,7 @@ class DefaultPathTraverser : public PathTraverser
|
||||
virtual ~DefaultPathTraverser();
|
||||
QStringList getImages() 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:
|
||||
QDir directory;
|
||||
};
|
||||
@@ -54,7 +54,7 @@ class ImageListPathTraverser : public PathTraverser
|
||||
virtual ~ImageListPathTraverser();
|
||||
QStringList getImages() 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:
|
||||
QStringList imageList;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user