diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2012-01-02 18:07:43 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2012-01-02 18:07:43 (GMT) |
commit | 131eed660716a2a8b52a6956f8e8a136425c404e (patch) | |
tree | 99ba06a0196fc4bc6e8eb84b1ff75fc984e89b92 /Source/QtDialog | |
parent | 40aedcbbaeddcb7e088c56e30f4252171e920baa (diff) | |
download | CMake-131eed660716a2a8b52a6956f8e8a136425c404e.zip CMake-131eed660716a2a8b52a6956f8e8a136425c404e.tar.gz CMake-131eed660716a2a8b52a6956f8e8a136425c404e.tar.bz2 |
cmake-gui: Improve interrupt granularity to fix bug 12649.
Instead of enabling interrupt only when a progress or message callback is called, add a new callback specifically for
interrupt. This new callback is called from GetFatalErrorOccured() so cmake-gui can immediately report interrupt status
instead of calling queuing a call to cmSystemTools::SetFatalErrorOccured() and waiting for the progress or message
callback to be called to process that queued call.
Diffstat (limited to 'Source/QtDialog')
-rw-r--r-- | Source/QtDialog/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 3 | ||||
-rw-r--r-- | Source/QtDialog/QCMake.cxx | 13 | ||||
-rw-r--r-- | Source/QtDialog/QCMake.h | 5 |
4 files changed, 19 insertions, 6 deletions
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 4785188..056e48e 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -10,11 +10,11 @@ # See the License for more information. #============================================================================= PROJECT(QtDialog) -SET(QT_MIN_VERSION "4.3.0") +SET(QT_MIN_VERSION "4.4.0") FIND_PACKAGE(Qt4 REQUIRED) IF(NOT QT4_FOUND) - MESSAGE(SEND_ERROR "Failed to find Qt 4.3 or greater.") + MESSAGE(SEND_ERROR "Failed to find Qt 4.4 or greater.") ELSE(NOT QT4_FOUND) INCLUDE(${QT_USE_FILE}) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 338eaff..45b4cd3 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -554,8 +554,7 @@ void CMakeSetupDialog::doHelp() void CMakeSetupDialog::doInterrupt() { this->enterState(Interrupting); - QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), - "interrupt", Qt::QueuedConnection); + this->CMakeThread->cmakeInstance()->interrupt(); } void CMakeSetupDialog::doSourceBrowse() diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index a40a175..73050f3 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -63,6 +63,8 @@ QCMake::QCMake(QObject* p) #endif this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this); + cmSystemTools::SetInterruptCallback(QCMake::interruptCallback, this); + std::vector<std::string> generators; this->CMakeInstance->GetRegisteredGenerators(generators); std::vector<std::string>::iterator iter; @@ -170,6 +172,7 @@ void QCMake::configure() this->CMakeInstance->SetWarnUnused(this->WarnUnusedMode); this->CMakeInstance->PreLoadCMakeFiles(); + InterruptFlag = 0; cmSystemTools::ResetErrorOccuredFlag(); int err = this->CMakeInstance->Configure(); @@ -188,7 +191,9 @@ void QCMake::generate() UINT lastErrorMode = SetErrorMode(0); #endif + InterruptFlag = 0; cmSystemTools::ResetErrorOccuredFlag(); + int err = this->CMakeInstance->Generate(); #ifdef Q_OS_WIN @@ -337,7 +342,13 @@ QCMakePropertyList QCMake::properties() const void QCMake::interrupt() { - cmSystemTools::SetFatalErrorOccured(); + this->InterruptFlag.ref(); +} + +bool QCMake::interruptCallback(void* cd) +{ + QCMake* self = reinterpret_cast<QCMake*>(cd); + return self->InterruptFlag; } void QCMake::progressCallback(const char* msg, float percent, void* cd) diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index 0d10823..0d68586 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -23,6 +23,7 @@ #include <QList> #include <QStringList> #include <QMetaType> +#include <QAtomicInt> class cmake; @@ -78,7 +79,7 @@ public slots: void generate(); /// set the property values void setProperties(const QCMakePropertyList&); - /// interrupt the configure or generate process + /// interrupt the configure or generate process (if connecting, make a direct connection) void interrupt(); /// delete the cache in binary directory void deleteCache(); @@ -133,6 +134,7 @@ signals: protected: cmake* CMakeInstance; + static bool interruptCallback(void*); static void progressCallback(const char* msg, float percent, void* cd); static void errorCallback(const char* msg, const char* title, bool&, void* cd); @@ -145,6 +147,7 @@ protected: QString Generator; QStringList AvailableGenerators; QString CMakeExecutable; + QAtomicInt InterruptFlag; }; #endif // __QCMake_h |