From 0b8837814afb82547d4c78d153db1fd7b1b34cfe Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Mon, 26 Oct 2009 13:18:15 -0400 Subject: ENH: Move SetErrorMode around calls to generate and configure instead of setting it for the whole application. --- Source/QtDialog/CMakeSetup.cxx | 9 --------- Source/QtDialog/QCMake.cxx | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 7bc6f72..f19a36d 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -16,11 +16,6 @@ #include #include #include "QMacInstallDialog.h" - -#ifdef Q_OS_WIN -#include "windows.h" // for SetErrorMode -#endif - #include "CMakeSetupDialog.h" #include "cmDocumentation.h" #include "cmake.h" @@ -103,10 +98,6 @@ int main(int argc, char** argv) } QApplication app(argc, argv); -#ifdef Q_OS_WIN - // QApplication changes error mode, let's put it back - SetErrorMode(0); -#endif // clean out standard Qt paths for plugins, which we don't use anyway // when creating Mac bundles, it potentially causes problems diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 3bd64f0..dc31fad 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -20,6 +20,10 @@ #include "cmSystemTools.h" #include "cmExternalMakefileProjectGenerator.h" +#ifdef Q_OS_WIN +#include "qt_windows.h" // For SetErrorMode +#endif + QCMake::QCMake(QObject* p) : QObject(p) { @@ -148,6 +152,10 @@ void QCMake::setGenerator(const QString& gen) void QCMake::configure() { +#ifdef Q_OS_WIN + UINT lastErrorMode = SetErrorMode(0); +#endif + this->CMakeInstance->SetHomeDirectory(this->SourceDirectory.toAscii().data()); this->CMakeInstance->SetStartDirectory(this->SourceDirectory.toAscii().data()); this->CMakeInstance->SetHomeOutputDirectory(this->BinaryDirectory.toAscii().data()); @@ -162,14 +170,27 @@ void QCMake::configure() int err = this->CMakeInstance->Configure(); +#ifdef Q_OS_WIN + SetErrorMode(lastErrorMode); +#endif + emit this->propertiesChanged(this->properties()); emit this->configureDone(err); } void QCMake::generate() { +#ifdef Q_OS_WIN + UINT lastErrorMode = SetErrorMode(0); +#endif + cmSystemTools::ResetErrorOccuredFlag(); int err = this->CMakeInstance->Generate(); + +#ifdef Q_OS_WIN + SetErrorMode(lastErrorMode); +#endif + emit this->generateDone(err); } -- cgit v0.12