| 121 | } |
| 122 | |
| 123 | void MainWindow::loadMultipleDropped(QList<QUrl> urls) { |
| 124 | //test if image formats are supported |
| 125 | bool containedInvalidFormat = false; |
| 126 | bool loadedFirstValidImage = false; |
| 127 | |
| 128 | for(int i = 0; i < urls.size(); i++) { |
| 129 | QFileInfo fileInfo(QFileInfo(urls.at(i).toLocalFile())); |
| 130 | QString suffix = fileInfo.suffix().toLower(); |
| 131 | |
| 132 | // The supportedImageformats list is of the form "*.jpg", "*.png", ... |
| 133 | if(supportedImageformats.contains("*." + suffix, Qt::CaseInsensitive)) { |
| 134 | //image format is supported, add to queue |
| 135 | addImageToQueue(urls.at(i)); |
| 136 | //if it is the first valid image, load and preview it |
| 137 | if(!loadedFirstValidImage) { |
| 138 | load(urls.at(i)); |
| 139 | loadedFirstValidImage = true; |
| 140 | } |
| 141 | } |
| 142 | else if(fileInfo.isDir()) { |
| 143 | loadAllFromDir(urls.at(i)); |
| 144 | } |
| 145 | else { |
| 146 | containedInvalidFormat = true; |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | if(containedInvalidFormat) |
| 151 | QMessageBox::information(this, "Not All Images Loaded Into Queue", |
| 152 | "Some images had unsupported formats and where not loaded into the queue!"); |
| 153 | } |
| 154 | |
| 155 | void MainWindow::loadAllFromDir(QUrl url) { |
| 156 | // Load all images in the directory |