Mercurial > hg > svgui
changeset 583:4c484636d5ec
Record and show any error that occurs during layer processing (e.g. spectrogram layer runs out of disc space for feature files)
author | Chris Cannam |
---|---|
date | Thu, 14 Apr 2011 15:21:21 +0100 |
parents | bde4aa56862b |
children | 1fe7951a61e8 1ae54a29e59e |
files | layer/Layer.h layer/SpectrogramLayer.cpp layer/SpectrogramLayer.h view/View.cpp view/View.h |
diffstat | 5 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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); /**
--- 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
--- 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;
--- 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 <QProgressDialog> #include <QTextStream> #include <QFont> +#include <QMessageBox> #include <iostream> #include <cassert> @@ -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 =
--- 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;