[Cmake-commits] CMake branch, next, updated. v2.8.3-1019-gbed32ff

Clinton Stimpson clinton at elemtech.com
Fri Dec 17 21:09:45 EST 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  bed32ffa8ec0e0d519b972b568a3d796ded65fbf (commit)
       via  3f158c6dfab7420696498ed4386761d847b6e943 (commit)
      from  cbb99bd678edb768864f8b50671ec7a33d7b7c14 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bed32ffa8ec0e0d519b972b568a3d796ded65fbf
commit bed32ffa8ec0e0d519b972b568a3d796ded65fbf
Merge: cbb99bd 3f158c6
Author:     Clinton Stimpson <clinton at elemtech.com>
AuthorDate: Fri Dec 17 21:09:34 2010 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Dec 17 21:09:34 2010 -0500

    Merge topic 'always_enable_generate' into next
    
    3f158c6 cmake-gui: always enable generate button.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f158c6dfab7420696498ed4386761d847b6e943
commit 3f158c6dfab7420696498ed4386761d847b6e943
Author:     Clinton Stimpson <clinton at elemtech.com>
AuthorDate: Fri Dec 17 19:04:57 2010 -0700
Commit:     Clinton Stimpson <clinton at elemtech.com>
CommitDate: Fri Dec 17 19:04:57 2010 -0700

    cmake-gui: always enable generate button.

diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 29fcfc0..408dbac 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -55,7 +55,7 @@ void QCMakeThread::run()
 }
 
 CMakeSetupDialog::CMakeSetupDialog()
-  : ExitAfterGenerate(true), CacheModified(false), CurrentState(Interrupting)
+  : ExitAfterGenerate(true), CacheModified(false), ConfigureNeeded(true), CurrentState(Interrupting)
 {
   QString title = QString(tr("CMake %1"));
   title = title.arg(cmVersion::GetCMakeVersion());
@@ -167,6 +167,9 @@ CMakeSetupDialog::CMakeSetupDialog()
   this->CMakeThread->start();
 
   this->enterState(ReadyConfigure);
+
+  ProgressOffset = 0.0;
+  ProgressFactor = 1.0;
 }
 
 void CMakeSetupDialog::initialize()
@@ -179,12 +182,11 @@ void CMakeSetupDialog::initialize()
 
   QObject::connect(this->ConfigureButton, SIGNAL(clicked(bool)),
                    this, SLOT(doConfigure()));
-  QObject::connect(this->CMakeThread->cmakeInstance(),
-                   SIGNAL(configureDone(int)),
-                   this, SLOT(finishConfigure(int)));
-  QObject::connect(this->CMakeThread->cmakeInstance(),
-                   SIGNAL(generateDone(int)),
-                   this, SLOT(finishGenerate(int)));
+
+  QObject::connect(this->CMakeThread->cmakeInstance(), SIGNAL(configureDone(int)),
+                   this, SLOT(exitLoop(int)));
+  QObject::connect(this->CMakeThread->cmakeInstance(), SIGNAL(generateDone(int)),
+                   this, SLOT(exitLoop(int)));
 
   QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)),
                    this, SLOT(doGenerate()));
@@ -270,15 +272,8 @@ CMakeSetupDialog::~CMakeSetupDialog()
   this->CMakeThread->wait(2000);
 }
 
-void CMakeSetupDialog::doConfigure()
+bool CMakeSetupDialog::prepareConfigure()
 {
-  if(this->CurrentState == Configuring)
-    {
-    // stop configure
-    doInterrupt();
-    return;
-    }
-
   // make sure build directory exists
   QString bindir = this->CMakeThread->cmakeInstance()->binaryDirectory();
   QDir dir(bindir);
@@ -295,7 +290,7 @@ void CMakeSetupDialog::doConfigure()
                                    QMessageBox::Yes | QMessageBox::No);
     if(btn == QMessageBox::No)
       {
-      return;
+      return false;
       }
     if(!dir.mkpath("."))
       {
@@ -303,7 +298,7 @@ void CMakeSetupDialog::doConfigure()
         QString(tr("Failed to create directory %1")).arg(dir.path()),
         QMessageBox::Ok);
 
-      return;
+      return false;
       }
     }
 
@@ -312,27 +307,45 @@ void CMakeSetupDialog::doConfigure()
     {
     if(!this->setupFirstConfigure())
       {
-      return;
+      return false;
       }
     }
 
   // remember path
   this->addBinaryPath(dir.absolutePath());
 
-  this->enterState(Configuring);
+  return true;
+}
 
-  this->CacheValues->selectionModel()->clear();
-  QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
-    "setProperties", Qt::QueuedConnection,
-    Q_ARG(QCMakePropertyList,
-      this->CacheValues->cacheModel()->properties()));
-  QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
-    "configure", Qt::QueuedConnection);
+void CMakeSetupDialog::exitLoop(int err)
+{
+  this->LocalLoop.exit(err);
 }
 
-void CMakeSetupDialog::finishConfigure(int err)
+void CMakeSetupDialog::doConfigure()
 {
-  if(0 == err && !this->CacheValues->cacheModel()->newPropertyCount())
+  if(this->CurrentState == Configuring)
+    {
+    // stop configure
+    doInterrupt();
+    return;
+    }
+
+  if(!prepareConfigure())
+    {
+    return;
+    }
+
+  this->enterState(Configuring);
+
+  bool ret = doConfigureInternal();
+
+  if(ret)
+    {
+    this->ConfigureNeeded = false;
+    }
+
+  if(ret && !this->CacheValues->cacheModel()->newPropertyCount())
     {
     this->enterState(ReadyGenerate);
     }
@@ -341,6 +354,22 @@ void CMakeSetupDialog::finishConfigure(int err)
     this->enterState(ReadyConfigure);
     this->CacheValues->scrollToTop();
     }
+  this->ProgressBar->reset();
+}
+
+bool CMakeSetupDialog::doConfigureInternal()
+{
+  this->Output->clear();
+  this->CacheValues->selectionModel()->clear();
+
+  QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
+    "setProperties", Qt::QueuedConnection,
+    Q_ARG(QCMakePropertyList,
+      this->CacheValues->cacheModel()->properties()));
+  QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
+    "configure", Qt::QueuedConnection);
+
+  int err = this->LocalLoop.exec();
 
   if(err != 0)
     {
@@ -348,23 +377,31 @@ void CMakeSetupDialog::finishConfigure(int err)
       tr("Error in configuration process, project files may be invalid"),
       QMessageBox::Ok);
     }
+
+  return 0 == err;
 }
 
-void CMakeSetupDialog::finishGenerate(int err)
+void CMakeSetupDialog::doInstallForCommandLine()
 {
-  this->enterState(ReadyConfigure);
+  QMacInstallDialog setupdialog(0);
+  setupdialog.exec();
+}
+
+bool CMakeSetupDialog::doGenerateInternal()
+{
+  QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
+    "generate", Qt::QueuedConnection);
+
+  int err = this->LocalLoop.exec();
+
   if(err != 0)
     {
     QMessageBox::critical(this, tr("Error"),
       tr("Error in generation process, project files may be invalid"),
       QMessageBox::Ok);
     }
-}
 
-void CMakeSetupDialog::doInstallForCommandLine()
-{
-  QMacInstallDialog setupdialog(0);
-  setupdialog.exec();
+  return 0 == err;
 }
 
 void CMakeSetupDialog::doGenerate()
@@ -375,9 +412,43 @@ void CMakeSetupDialog::doGenerate()
     doInterrupt();
     return;
     }
+
+  // see if we need to configure
+  // we'll need to configure if:
+  //   the configure step hasn't been done yet
+  //   generate was the last step done
+  if(this->ConfigureNeeded)
+    {
+    if(!prepareConfigure())
+      {
+      return;
+      }
+    }
+
   this->enterState(Generating);
-  QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
-    "generate", Qt::QueuedConnection);
+
+  bool config_passed = true;
+  if(this->ConfigureNeeded)
+    {
+    this->CacheValues->cacheModel()->setShowNewProperties(false);
+    this->ProgressFactor = 0.5;
+    config_passed = doConfigureInternal();
+    this->ProgressOffset = 0.5;
+    }
+
+  if(config_passed)
+    {
+    doGenerateInternal();
+    }
+
+  this->ProgressOffset = 0.0;
+  this->ProgressFactor = 1.0;
+  this->CacheValues->cacheModel()->setShowNewProperties(true);
+
+  this->enterState(ReadyConfigure);
+  this->ProgressBar->reset();
+
+  this->ConfigureNeeded = true;
 }
 
 void CMakeSetupDialog::closeEvent(QCloseEvent* e)
@@ -542,6 +613,7 @@ void CMakeSetupDialog::setSourceDirectory(const QString& dir)
 
 void CMakeSetupDialog::showProgress(const QString& /*msg*/, float percent)
 {
+  percent = (percent * ProgressFactor) + ProgressOffset;
   this->ProgressBar->setValue(qRound(percent * 100));
 }
 
@@ -883,7 +955,6 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
     }
   else if(s == Configuring)
     {
-    this->Output->clear();
     this->setEnabledState(false);
     this->GenerateButton->setEnabled(false);
     this->GenerateAction->setEnabled(false);
@@ -899,17 +970,15 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
     }
   else if(s == ReadyConfigure)
     {
-    this->ProgressBar->reset();
     this->setEnabledState(true);
-    this->GenerateButton->setEnabled(false);
-    this->GenerateAction->setEnabled(false);
+    this->GenerateButton->setEnabled(true);
+    this->GenerateAction->setEnabled(true);
     this->ConfigureButton->setEnabled(true);
     this->ConfigureButton->setText(tr("&Configure"));
     this->GenerateButton->setText(tr("&Generate"));
     }
   else if(s == ReadyGenerate)
     {
-    this->ProgressBar->reset();
     this->setEnabledState(true);
     this->GenerateButton->setEnabled(true);
     this->GenerateAction->setEnabled(true);
diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h
index 0e3caec..1934795 100644
--- a/Source/QtDialog/CMakeSetupDialog.h
+++ b/Source/QtDialog/CMakeSetupDialog.h
@@ -16,6 +16,7 @@
 #include "QCMake.h"
 #include <QMainWindow>
 #include <QThread>
+#include <QEventLoop>
 #include "ui_CMakeSetupDialog.h"
 
 class QCMakeThread;
@@ -43,8 +44,6 @@ protected slots:
   void doHelp();
   void doAbout();
   void doInterrupt();
-  void finishConfigure(int error);
-  void finishGenerate(int error);
   void error(const QString& message);
   void message(const QString& message);
   
@@ -74,6 +73,10 @@ protected slots:
   void setGroupedView(bool);
   void showUserChanges();
   void setSearchFilter(const QString& str);
+  bool prepareConfigure();
+  bool doConfigureInternal();
+  bool doGenerateInternal();
+  void exitLoop(int);
 
 protected:
 
@@ -87,6 +90,7 @@ protected:
   QCMakeThread* CMakeThread;
   bool ExitAfterGenerate;
   bool CacheModified;
+  bool ConfigureNeeded;
   QAction* ReloadCacheAction;
   QAction* DeleteCacheAction;
   QAction* ExitAction;
@@ -99,6 +103,10 @@ protected:
   QTextCharFormat ErrorFormat;
   QTextCharFormat MessageFormat;
 
+  QEventLoop LocalLoop;
+
+  float ProgressOffset;
+  float ProgressFactor;
 };
 
 // QCMake instance on a thread
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index d90307a..562396d 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -200,6 +200,7 @@ QCMakeCacheModel::QCMakeCacheModel(QObject* p)
     NewPropertyCount(0),
     View(FlatView)
 {
+  this->ShowNewProperties = true;
   QStringList labels;
   labels << tr("Name") << tr("Value");
   this->setHorizontalHeaderLabels(labels);
@@ -214,6 +215,11 @@ static uint qHash(const QCMakeProperty& p)
   return qHash(p.Key);
 }
 
+void QCMakeCacheModel::setShowNewProperties(bool f)
+{
+  this->ShowNewProperties = f;
+}
+
 void QCMakeCacheModel::clear()
 {
   this->QStandardItemModel::clear();
@@ -226,13 +232,21 @@ void QCMakeCacheModel::clear()
 
 void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
 {
-  QSet<QCMakeProperty> newProps = props.toSet();
-  QSet<QCMakeProperty> newProps2 = newProps;
-  QSet<QCMakeProperty> oldProps = this->properties().toSet();
-  
-  oldProps.intersect(newProps);
-  newProps.subtract(oldProps);
-  newProps2.subtract(newProps);
+  QSet<QCMakeProperty> newProps, newProps2;
+
+  if(this->ShowNewProperties)
+    {
+    newProps = props.toSet();
+    newProps2 = newProps;
+    QSet<QCMakeProperty> oldProps = this->properties().toSet();
+    oldProps.intersect(newProps);
+    newProps.subtract(oldProps);
+    newProps2.subtract(newProps);
+    }
+  else
+    {
+    newProps2 = props.toSet();
+    }
 
   bool b = this->blockSignals(true);
 
diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h
index 401e07e..58bbd2d 100644
--- a/Source/QtDialog/QCMakeCacheView.h
+++ b/Source/QtDialog/QCMakeCacheView.h
@@ -78,6 +78,9 @@ public slots:
   // become new properties and be marked red.
   void setProperties(const QCMakePropertyList& props);
 
+  // set whether to show new properties in red
+  void setShowNewProperties(bool);
+
   // clear everything from the model
   void clear();
 
@@ -115,6 +118,7 @@ public:
 protected:
   bool EditEnabled;
   int NewPropertyCount;
+  bool ShowNewProperties;
   ViewType View;
 
   // set the data in the model for this property

-----------------------------------------------------------------------

Summary of changes:
 Source/QtDialog/CMakeSetupDialog.cxx |  153 ++++++++++++++++++++++++---------
 Source/QtDialog/CMakeSetupDialog.h   |   12 ++-
 Source/QtDialog/QCMakeCacheView.cxx  |   28 +++++--
 Source/QtDialog/QCMakeCacheView.h    |    4 +
 4 files changed, 146 insertions(+), 51 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list