- Implement aspect ratio checking for the shuffle and sorted image list modes
This commit is contained in:
@@ -158,9 +158,21 @@ std::string ShuffleImageSelector::getNextImage()
|
|||||||
}
|
}
|
||||||
std::string filename = pathTraverser->getImagePath(images.at(current_image_shuffle).toStdString());
|
std::string filename = pathTraverser->getImagePath(images.at(current_image_shuffle).toStdString());
|
||||||
if(!QFileInfo::exists(QString(filename.c_str())))
|
if(!QFileInfo::exists(QString(filename.c_str())))
|
||||||
|
{
|
||||||
|
if(debugMode)
|
||||||
{
|
{
|
||||||
std::cout << "file not found: " << filename << std::endl;
|
std::cout << "file not found: " << filename << std::endl;
|
||||||
current_image_shuffle = images.size();
|
}
|
||||||
|
current_image_shuffle = current_image_shuffle + 1; // ignore and move to next image
|
||||||
|
return getNextImage();
|
||||||
|
}
|
||||||
|
if (!imageValidForAspect(filename))
|
||||||
|
{
|
||||||
|
if(debugMode)
|
||||||
|
{
|
||||||
|
std::cout << "image has invalid aspect: " << filename << "(images left:" << (images.size()-current_image_shuffle) << ")" << std::endl;
|
||||||
|
}
|
||||||
|
current_image_shuffle = current_image_shuffle + 1; // ignore and move to next image
|
||||||
return getNextImage();
|
return getNextImage();
|
||||||
}
|
}
|
||||||
std::cout << "updating image: " << filename << std::endl;
|
std::cout << "updating image: " << filename << std::endl;
|
||||||
@@ -197,22 +209,37 @@ std::string SortedImageSelector::getNextImage()
|
|||||||
{
|
{
|
||||||
images = pathTraverser->getImages();
|
images = pathTraverser->getImages();
|
||||||
std::sort(images.begin(), images.end());
|
std::sort(images.begin(), images.end());
|
||||||
|
if(debugMode)
|
||||||
|
{
|
||||||
std::cout << "read " << images.size() << " images." << std::endl;
|
std::cout << "read " << images.size() << " images." << std::endl;
|
||||||
for (int i = 0;i <images.size();i++){
|
for (int i = 0;i <images.size();i++){
|
||||||
|
|
||||||
std::cout << images[i].toStdString() << std::endl;
|
std::cout << images[i].toStdString() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (images.size() == 0)
|
if (images.size() == 0)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
std::string filename = pathTraverser->getImagePath(images.takeFirst().toStdString());
|
std::string filename = pathTraverser->getImagePath(images.takeFirst().toStdString());
|
||||||
if(!QFileInfo::exists(QString(filename.c_str())))
|
if(!QFileInfo::exists(QString(filename.c_str())))
|
||||||
|
{
|
||||||
|
if(debugMode)
|
||||||
{
|
{
|
||||||
std::cout << "file not found: " << filename << std::endl;
|
std::cout << "file not found: " << filename << std::endl;
|
||||||
|
}
|
||||||
return getNextImage();
|
return getNextImage();
|
||||||
}
|
}
|
||||||
|
if (!imageValidForAspect(filename))
|
||||||
|
{
|
||||||
|
if(debugMode)
|
||||||
|
{
|
||||||
|
std::cout << "image has invalid aspect: " << filename << std::endl;
|
||||||
|
}
|
||||||
|
return getNextImage();
|
||||||
|
}
|
||||||
|
|
||||||
std::cout << "updating image: " << filename << std::endl;
|
std::cout << "updating image: " << filename << std::endl;
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user