void MainWindow::loadMultipleDropped(QList<QUrl> urls) { //test if image formats are supported bool containedInvalidFormat = false; bool loadedFirstValidImage = false; for(int i = 0; i < urls.size(); i++) { QFileInfo fileInfo(QFileInfo(urls.at(i).toLocalFile())); QString suffix = fileInfo.suffix().toLower(); // The supportedImageformats list is of the form "*.jpg", "*.png", ... if(supportedImageformats.contains("*." + suffix, Qt::CaseInsensitive)) { //image format is supported, add to queue addImageToQueue(urls.at(i)); //if it is the first valid image, load and preview it if(!loadedFirstValidImage) { load(urls.at(i)); loadedFirstValidImage = true; } } else if(fileInfo.isDir()) { loadAllFromDir(urls.at(i)); } else { containedInvalidFormat = true; } } if(containedInvalidFormat) QMessageBox::information(this, "Not All Images Loaded Into Queue", "Some images had unsupported formats and where not loaded into the queue!"); }
void MainWindow::loadMultipleDropped(QList<QUrl> urls) { //test if image formats are supported bool containedInvalidFormat = false; bool loadedFirstValidImage = false; for(int i = 0; i < urls.size(); i++) { QString suffix = QFileInfo(urls.at(i).fileName()).suffix().toLower(); QString supported = "png jpg jpeg tiff ppm bmp xpm tga"; if(supported.contains(suffix)) { //image format is supported, add to queue addImageToQueue(urls.at(i)); //if it is the first valid image, load and preview it if(!loadedFirstValidImage) { load(urls.at(i)); loadedFirstValidImage = true; } } else { containedInvalidFormat = true; } } if(containedInvalidFormat) QMessageBox::information(this, "Not All Images Loaded Into Queue", "Some images had unsupported formats and where not loaded into the queue!"); }
void MainWindow::loadSingleDropped(QUrl url) { if(load(url)) addImageToQueue(url); }
//add multiple images to queue void MainWindow::addImageToQueue(QList<QUrl> urls) { for(int i = 0; i < urls.size(); i++) { addImageToQueue(urls.at(i)); } }