- Add support for per folder image display options. The file called options.json contains json keys to control image options when displaying files in this folder. Currently a singled option, fitAspectAxisToWindow, is supported
- Remove duplicated image rotation reading code, have the image selector logic just pass this up via the per image options
This commit is contained in:
@@ -8,28 +8,36 @@
|
||||
class MainWindow;
|
||||
class PathTraverser;
|
||||
|
||||
struct ImageOptions_t
|
||||
{
|
||||
char aspect;
|
||||
bool fitAspectAxisToWindow;
|
||||
int rotation;
|
||||
};
|
||||
|
||||
class ImageSelector
|
||||
{
|
||||
public:
|
||||
ImageSelector(std::unique_ptr<PathTraverser>& pathTraverser, char aspectIn);
|
||||
ImageSelector(std::unique_ptr<PathTraverser>& pathTraverser, char aspectIn, bool fitAspectAxisToWindow);
|
||||
virtual ~ImageSelector();
|
||||
virtual std::string getNextImage() = 0;
|
||||
virtual const std::string getNextImage(ImageOptions_t &options) = 0;
|
||||
void setDebugMode(bool debugModeIn) { debugMode = debugModeIn;}
|
||||
|
||||
protected:
|
||||
int getImageRotation(const std::string &fileName);
|
||||
bool imageValidForAspect(const std::string &fileName);
|
||||
bool imageValidForAspect(const std::string &fileName, const int rotation);
|
||||
std::unique_ptr<PathTraverser>& pathTraverser;
|
||||
char aspect;
|
||||
bool fitAspectAxisToWindow = false;
|
||||
bool debugMode = false;
|
||||
};
|
||||
|
||||
class RandomImageSelector : public ImageSelector
|
||||
{
|
||||
public:
|
||||
RandomImageSelector(std::unique_ptr<PathTraverser>& pathTraverser, char aspect);
|
||||
RandomImageSelector(std::unique_ptr<PathTraverser>& pathTraverser, char aspect, bool fitAspectAxisToWindow);
|
||||
virtual ~RandomImageSelector();
|
||||
virtual std::string getNextImage();
|
||||
virtual const std::string getNextImage(ImageOptions_t &options);
|
||||
|
||||
private:
|
||||
unsigned int selectRandom(const QStringList& images) const;
|
||||
@@ -38,9 +46,9 @@ private:
|
||||
class ShuffleImageSelector : public ImageSelector
|
||||
{
|
||||
public:
|
||||
ShuffleImageSelector(std::unique_ptr<PathTraverser>& pathTraverser, char aspect);
|
||||
ShuffleImageSelector(std::unique_ptr<PathTraverser>& pathTraverser, char aspect, bool fitAspectAxisToWindow);
|
||||
virtual ~ShuffleImageSelector();
|
||||
virtual std::string getNextImage();
|
||||
virtual const std::string getNextImage(ImageOptions_t &options);
|
||||
|
||||
private:
|
||||
int current_image_shuffle;
|
||||
@@ -50,9 +58,9 @@ private:
|
||||
class SortedImageSelector : public ImageSelector
|
||||
{
|
||||
public:
|
||||
SortedImageSelector(std::unique_ptr<PathTraverser>& pathTraverser, char aspect);
|
||||
SortedImageSelector(std::unique_ptr<PathTraverser>& pathTraverser, char aspect, bool fitAspectAxisToWindow);
|
||||
virtual ~SortedImageSelector();
|
||||
virtual std::string getNextImage();
|
||||
virtual const std::string getNextImage(ImageOptions_t &options);
|
||||
|
||||
private:
|
||||
QStringList images;
|
||||
|
||||
Reference in New Issue
Block a user