Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Prevent thumbnail progress bar from showing idefinitely when no MPlay…
…er is installed.
  • Loading branch information
astifter committed Dec 10, 2013
1 parent 5d7e5dc commit 7f19e84
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
13 changes: 9 additions & 4 deletions ImageManager/AsyncLoader.cpp
Expand Up @@ -69,15 +69,20 @@ void ImageManager::AsyncLoader::init()
}
}

void ImageManager::AsyncLoader::load( ImageRequest* request )
bool ImageManager::AsyncLoader::load( ImageRequest* request )
{
// silently ignore images not (currently) on disk:
if ( ! request->fileSystemFileName().exists() )
return;
if ( Utilities::isVideo( request->fileSystemFileName() ) )
return false;

if ( Utilities::isVideo( request->fileSystemFileName() ) ) {
if ( MainWindow::FeatureDialog::mplayerBinary().isNull() )
return false;
loadVideo( request );
else
} else {
loadImage( request );
}
return true;
}

void ImageManager::AsyncLoader::loadVideo( ImageRequest* request)
Expand Down
2 changes: 1 addition & 1 deletion ImageManager/AsyncLoader.h
Expand Up @@ -42,7 +42,7 @@ class AsyncLoader :public QObject {

// Request to load an image. The Manager takes over the ownership of
// the request (and may delete it anytime).
void load( ImageRequest* request );
bool load( ImageRequest* request );

// Stop loading all images requested by the given client.
void stop( ImageClientInterface*, StopAction action = StopAll );
Expand Down
9 changes: 6 additions & 3 deletions ImageManager/ThumbnailBuilder.cpp
Expand Up @@ -104,16 +104,19 @@ void ImageManager::ThumbnailBuilder::doThumbnailBuild()
if ( info->isNull())
continue;

++numberOfThumbnailsToBuild;
ImageManager::ImageRequest* request
= new ImageManager::PreloadRequest( fileName,
ThumbnailView::CellGeometry::preferredIconSize(), info->angle(),
this );
request->setIsThumbnailRequest(true);
request->setPriority( ImageManager::BuildThumbnails );
ImageManager::AsyncLoader::instance()->load( request );
if (ImageManager::AsyncLoader::instance()->load( request ))
++numberOfThumbnailsToBuild;
}
m_statusBar->startProgress( i18n("Building thumbnails"), qMax( numberOfThumbnailsToBuild - 1, 1 ) );
if (numberOfThumbnailsToBuild == 0)
m_statusBar->setProgressBarVisible(false);
else
m_statusBar->startProgress( i18n("Building thumbnails"), qMax( numberOfThumbnailsToBuild - 1, 1 ) );
m_count = 0;
}

Expand Down

0 comments on commit 7f19e84

Please sign in to comment.