# HG changeset patch # User Chris Cannam # Date 1302790881 -3600 # Node ID 4c484636d5ec951730e60aff7b3c832804798ada # Parent bde4aa56862b70528c5a174c1487c721d7971501 Record and show any error that occurs during layer processing (e.g. spectrogram layer runs out of disc space for feature files) diff -r bde4aa56862b -r 4c484636d5ec layer/Layer.h --- a/layer/Layer.h Thu Apr 07 15:20:12 2011 +0100 +++ b/layer/Layer.h Thu Apr 14 15:21:21 2011 +0100 @@ -339,6 +339,13 @@ */ virtual int getCompletion(View *) const { return 100; } + /** + * Return an error string if any errors have occurred while + * loading or processing data for the given view. Return the + * empty string if no error has occurred. + */ + virtual QString getError(View *) const { return ""; } + virtual void setObjectName(const QString &name); /** diff -r bde4aa56862b -r 4c484636d5ec layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Thu Apr 07 15:20:12 2011 +0100 +++ b/layer/SpectrogramLayer.cpp Thu Apr 14 15:21:21 2011 +0100 @@ -2905,6 +2905,13 @@ return completion; } +QString +SpectrogramLayer::getError(View *v) const +{ + if (m_fftModels.find(v) == m_fftModels.end()) return ""; + return m_fftModels[v].first->getError(); +} + bool SpectrogramLayer::getValueExtents(float &min, float &max, bool &logarithmic, QString &unit) const diff -r bde4aa56862b -r 4c484636d5ec layer/SpectrogramLayer.h --- a/layer/SpectrogramLayer.h Thu Apr 07 15:20:12 2011 +0100 +++ b/layer/SpectrogramLayer.h Thu Apr 14 15:21:21 2011 +0100 @@ -200,6 +200,7 @@ float getFrequencyForY(const View *v, int y) const; virtual int getCompletion(View *v) const; + virtual QString getError(View *v) const; virtual bool getValueExtents(float &min, float &max, bool &logarithmic, QString &unit) const; diff -r bde4aa56862b -r 4c484636d5ec view/View.cpp --- a/view/View.cpp Thu Apr 07 15:20:12 2011 +0100 +++ b/view/View.cpp Thu Apr 14 15:21:21 2011 +0100 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -1436,6 +1437,12 @@ int completion = i->first->getCompletion(this); QString text = i->first->getPropertyContainerName(); + QString error = i->first->getError(this); + + if (error != "" && error != m_lastError) { + QMessageBox::critical(this, tr("Layer rendering error"), error); + m_lastError = error; + } Model *model = i->first->getModel(); RangeSummarisableTimeValueModel *wfm = diff -r bde4aa56862b -r 4c484636d5ec view/View.h --- a/view/View.h Thu Apr 07 15:20:12 2011 +0100 +++ b/view/View.h Thu Apr 14 15:21:21 2011 +0100 @@ -362,6 +362,8 @@ LayerList m_layers; // I don't own these, but see dtor note above bool m_haveSelectedLayer; + QString m_lastError; + // caches for use in getScrollableBackLayers, getNonScrollableFrontLayers mutable LayerList m_lastScrollableBackLayers; mutable LayerList m_lastNonScrollableBackLayers;