# HG changeset patch # User Chris Cannam # Date 1201172639 0 # Node ID b1a68403714bae529a9ab909cc55de3908e2e33b # Parent 58bfaaed07ed0e1c5fdb108133d5a31631fe1d75 * Further model lifecycle fixes diff -r 58bfaaed07ed -r b1a68403714b framework/Document.cpp --- a/framework/Document.cpp Wed Jan 23 18:09:50 2008 +0000 +++ b/framework/Document.cpp Thu Jan 24 11:03:59 2008 +0000 @@ -79,8 +79,8 @@ std::cerr << "Document::~Document: WARNING: Main model is also" << " in models list!" << std::endl; } else if (model) { + model->aboutToDelete(); emit modelAboutToBeDeleted(model); - model->aboutToDelete(); delete model; } m_models.erase(m_models.begin()); @@ -92,8 +92,8 @@ << std::endl; #endif if (m_mainModel) { + m_mainModel->aboutToDelete(); emit modelAboutToBeDeleted(m_mainModel); - m_mainModel->aboutToDelete(); } emit mainModelChanged(0); @@ -377,8 +377,8 @@ } if (oldMainModel) { + oldMainModel->aboutToDelete(); emit modelAboutToBeDeleted(oldMainModel); - oldMainModel->aboutToDelete(); } emit mainModelChanged(m_mainModel); @@ -509,8 +509,8 @@ << "their source fields appropriately" << std::endl; } + model->aboutToDelete(); emit modelAboutToBeDeleted(model); - model->aboutToDelete(); m_models.erase(model); delete model; } diff -r 58bfaaed07ed -r b1a68403714b framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Wed Jan 23 18:09:50 2008 +0000 +++ b/framework/MainWindowBase.cpp Thu Jan 24 11:03:59 2008 +0000 @@ -1088,6 +1088,12 @@ } SVFileReader reader(m_document, callback, source.getLocation()); + connect + (&reader, SIGNAL(modelRegenerationFailed(QString, QString, QString)), + this, SLOT(modelRegenerationFailed(QString, QString, QString))); + connect + (&reader, SIGNAL(modelRegenerationWarning(QString, QString, QString)), + this, SLOT(modelRegenerationWarning(QString, QString, QString))); reader.setCurrentPane(pane); QXmlInputSource inputSource(&file); @@ -1222,6 +1228,12 @@ m_viewManager->clearSelections(); SVFileReader reader(m_document, callback, source.getLocation()); + connect + (&reader, SIGNAL(modelRegenerationFailed(QString, QString, QString)), + this, SLOT(modelRegenerationFailed(QString, QString, QString))); + connect + (&reader, SIGNAL(modelRegenerationWarning(QString, QString, QString)), + this, SLOT(modelRegenerationWarning(QString, QString, QString))); QXmlInputSource inputSource(&bzFile); reader.parse(inputSource); diff -r 58bfaaed07ed -r b1a68403714b framework/SVFileReader.cpp --- a/framework/SVFileReader.cpp Wed Jan 23 18:09:50 2008 +0000 +++ b/framework/SVFileReader.cpp Thu Jan 24 11:03:59 2008 +0000 @@ -308,7 +308,15 @@ ModelTransformer::Input(m_currentTransformSource, m_currentTransformChannel), message); - //!!! do something with message + if (!m_currentDerivedModel) { + emit modelRegenerationFailed(tr("(derived model in SV-XML)"), + m_currentTransform.getIdentifier(), + message); + } else if (message != "") { + emit modelRegenerationWarning(tr("(derived model in SV-XML)"), + m_currentTransform.getIdentifier(), + message); + } } } else { m_document->addDerivedModel diff -r 58bfaaed07ed -r b1a68403714b framework/SVFileReader.h --- a/framework/SVFileReader.h Wed Jan 23 18:09:50 2008 +0000 +++ b/framework/SVFileReader.h Thu Jan 24 11:03:59 2008 +0000 @@ -161,8 +161,10 @@ */ -class SVFileReader : public QXmlDefaultHandler +class SVFileReader : public QObject, QXmlDefaultHandler { + Q_OBJECT + public: SVFileReader(Document *document, SVFileReaderPaneCallback &callback, @@ -192,6 +194,12 @@ bool error(const QXmlParseException &exception); bool fatalError(const QXmlParseException &exception); +signals: + void modelRegenerationFailed(QString layerName, QString transformName, + QString message); + void modelRegenerationWarning(QString layerName, QString transformName, + QString message); + protected: bool readWindow(const QXmlAttributes &); bool readModel(const QXmlAttributes &);