Commit 29e13621 authored by Stefan Brüns's avatar Stefan Brüns
Browse files

Avoid waiting for timeout when file fails to load

The `FileManager::fileError` signal is emitted when the file could not
be loaded. Instead of waiting for the 5 second timeout for each erroneous
file, immediately return.
parent 9a75d4dd
......@@ -17,6 +17,7 @@
// Marble
#include <MarbleModel.h>
#include <FileManager.h>
#include <GeoDataDocument.h>
#include <GeoPainter.h>
#include <GeoDataLatLonAltBox.h>
......@@ -46,6 +47,12 @@ GeoDataThumbnailer::GeoDataThumbnailer()
MarbleModel *const model = m_marbleMap.model();
connect(model->treeModel(), &GeoDataTreeModel::added, this, &GeoDataThumbnailer::onGeoDataObjectAdded);
connect(model->fileManager(), &FileManager::fileError, this,
[this](const QString& path, const QString& error) {
m_hadErrors = true;
......@@ -61,11 +68,12 @@ bool GeoDataThumbnailer::create(const QString &path, int width, int height, QIma
// load the document content
m_loadingCompleted = false;
m_hadErrors = false;
m_currentFilename = path;
if (! m_loadingCompleted) {
if ((!m_loadingCompleted) && (!m_hadErrors)) {
// loading is done async, so wait here for a while
// Using a QEventLoop here seems fine, thumbnailers are only used inside the
// thumbnail protocol slave, it seems
......@@ -52,6 +52,7 @@ private:
QString m_currentFilename;
bool m_loadingCompleted :1;
bool m_hadErrors :1;
QEventLoop m_eventLoop;
QTimer m_outtimer;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment