From 622dfa78f750a30b39da3f28a6f46ba7f12c3bd0 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Mon, 30 Aug 2010 08:49:01 +0200 Subject: [PATCH] some bugfixes, nicer importer XML output --- src/converter/converter.cpp | 8 ++++++-- src/qtgui/mainwindow.cpp | 7 +++++-- src/qtgui/mainwindow.h | 1 + src/qtgui/previewsettingsdlg.cpp | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/converter/converter.cpp b/src/converter/converter.cpp index 65351c09..724b6a4b 100644 --- a/src/converter/converter.cpp +++ b/src/converter/converter.cpp @@ -96,6 +96,8 @@ bool cleanupPass(DOMNode *node, const std::set &removals) { XMLString::release(&value); } XMLString::release(&nodeName); + } else if (node->getNodeType() == DOMNode::TEXT_NODE) { + return true; } DOMNode *child = node->getFirstChild(); while (child) { @@ -181,7 +183,8 @@ void GeometryConverter::convert(const std::string &inputFile, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc = parser->parse(wrapper); XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *adj = parser->parseURI(adjustmentFile.c_str()); - std::set removals; + std::set removals, emptyList; + cleanupPass(adj, emptyList); findRemovals(adj, removals); cleanupPass(doc, removals); @@ -212,7 +215,8 @@ void GeometryConverter::convert(const std::string &inputFile, } for (DOMNode *child = adjRoot->getFirstChild(); child != 0; child=child->getNextSibling()) - docRoot->insertBefore(doc->importNode(child, true), insertBeforeNode); + if (child->getNodeType() == DOMNode::ELEMENT_NODE) + docRoot->insertBefore(doc->importNode(child, true), insertBeforeNode); DOMLSSerializer *serializer = impl->createLSSerializer(); DOMConfiguration *serConf(serializer->getDomConfig()); diff --git a/src/qtgui/mainwindow.cpp b/src/qtgui/mainwindow.cpp index 345c2edd..35ec6cf8 100644 --- a/src/qtgui/mainwindow.cpp +++ b/src/qtgui/mainwindow.cpp @@ -64,7 +64,8 @@ private: static int localWorkerCtr = 0, remoteWorkerCtr = 0; MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), ui(new Ui::MainWindow), m_activeWindowHack(false) { + QMainWindow(parent), ui(new Ui::MainWindow), + m_networkReply(NULL), m_activeWindowHack(false) { Logger *logger = Thread::getThread()->getLogger(); #if defined(__OSX__) @@ -289,6 +290,8 @@ MainWindow::~MainWindow() { ServerConnection &c = m_connections[i]; scheduler->unregisterWorker(c.worker); } + if (m_networkReply) + m_networkReply->abort(); #if defined(__OSX__) delete ui->menuBar; #endif @@ -381,7 +384,7 @@ void MainWindow::adjustSize() { void MainWindow::checkForUpdates(bool notifyIfNone) { m_notifyIfNoUpdates = notifyIfNone; - m_networkManager->get(QNetworkRequest(QUrl("http://www.mitsuba-renderer.org/version"))); + m_networkReply = m_networkManager->get(QNetworkRequest(QUrl("http://www.mitsuba-renderer.org/version"))); } void MainWindow::onNetworkFinished(QNetworkReply *reply) { diff --git a/src/qtgui/mainwindow.h b/src/qtgui/mainwindow.h index 9e0c2819..3cea76d9 100644 --- a/src/qtgui/mainwindow.h +++ b/src/qtgui/mainwindow.h @@ -145,6 +145,7 @@ private: ServerWidget *m_serverWidget; ref m_consoleAppender; QNetworkAccessManager *m_networkManager; + QNetworkReply *m_networkReply; QProgressBar *m_progress; QLabel *m_progressLabel; QWidget *m_progressWidget; diff --git a/src/qtgui/previewsettingsdlg.cpp b/src/qtgui/previewsettingsdlg.cpp index f233c716..e96c3c63 100644 --- a/src/qtgui/previewsettingsdlg.cpp +++ b/src/qtgui/previewsettingsdlg.cpp @@ -62,9 +62,9 @@ PreviewSettingsDialog::PreviewSettingsDialog(QWidget *parent, SceneContext *ctx, cap->isSupported(RendererCapabilities::EGeometryShaders))); ui->previewMethodCombo->setCurrentIndex(ctx->previewMethod); ui->toneMappingMethodCombo->setCurrentIndex(ctx->toneMappingMethod); + m_ignoreEvent = false; ui->exposureSlider->setValue((int) ((ctx->toneMappingMethod == EGamma ? ctx->exposure : ctx->reinhardBurn)*100)); - m_ignoreEvent = false; ui->keySlider->setValue((int) ((ctx->reinhardKey-REINHARD_MIN)/REINHARD_RANGE * 100)); ui->diffuseReceiversBox->setEnabled(ui->diffuseSourcesBox->isChecked());