diff options
author | Sarah Smith <sarah.j.smith@nokia.com> | 2011-06-30 16:39:33 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-06 03:05:35 +0200 |
commit | e43fd2367f692a8077810be86acfd2256935e016 (patch) | |
tree | 9f2b3db600ca25f0c4b70c7b1fcc42ff0b784dd6 /demos | |
parent | 4978d9b879551c2fa27b3e97b5eeb170ea610bae (diff) |
Fix windows bugs.
QTBUG-19382 and QTBUG-19275.
If a Pictures directory exists and contains files but they could not be
loaded, don't hang in the image loader.
Change-Id: Ib0672af8e37bcbba473bae68558e959e0111e029
Reviewed-on: http://codereview.qt.nokia.com/1105
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Sarah Jane Smith
Diffstat (limited to 'demos')
-rw-r--r-- | demos/qt3d/photobrowser3d/filescanner.cpp | 2 | ||||
-rw-r--r-- | demos/qt3d/photobrowser3d/photobrowser3dview.cpp | 16 |
2 files changed, 14 insertions, 4 deletions
diff --git a/demos/qt3d/photobrowser3d/filescanner.cpp b/demos/qt3d/photobrowser3d/filescanner.cpp index 4010ebdab..b6ba59d3d 100644 --- a/demos/qt3d/photobrowser3d/filescanner.cpp +++ b/demos/qt3d/photobrowser3d/filescanner.cpp @@ -109,7 +109,7 @@ void FileScanner::scan() { // small optimization: if the file has a suffix, check if that // is known as an image format before sending to loader - QString ext = u.suffix(); + QString ext = u.suffix().toLower(); if (ext.isEmpty() || QImageReader::supportedImageFormats().contains(ext.toLocal8Bit())) { diff --git a/demos/qt3d/photobrowser3d/photobrowser3dview.cpp b/demos/qt3d/photobrowser3d/photobrowser3dview.cpp index d81a77b68..7f5f42ad4 100644 --- a/demos/qt3d/photobrowser3d/photobrowser3dview.cpp +++ b/demos/qt3d/photobrowser3d/photobrowser3dview.cpp @@ -195,8 +195,20 @@ void PhotoBrowser3DView::initialise() url.setScheme("file"); url.setPath(path); + bool atLeastOneImageFound = false; QFileInfo fi(path); - if (!fi.exists() || !fi.isDir()) + if (fi.exists() && fi.isDir()) + { + QDir pics(path); + QStringList entries = pics.entryList(QDir::Files); + for (int i = 0; i < entries.size() && !atLeastOneImageFound; ++i) + { + QImage im(pics.filePath(entries.at(i))); + if (!im.isNull()) + atLeastOneImageFound = true; + } + } + if (!atLeastOneImageFound) { qWarning("No pictures directory found at %s\n" "using test images", qPrintable(path)); @@ -327,11 +339,9 @@ void PhotoBrowser3DView::closeEvent(QCloseEvent *e) // set this flag to indicate that when the image manager stops done event // should be signalled to the state machine, resulting in close m_closing = true; - fprintf(stderr, "Closing down........"); } else { - fprintf(stderr, " done\n"); e->accept(); } } |