[cmake-commits] clinton committed CMakeSetupDialog.cxx 1.13 1.14 CMakeSetupDialog.h 1.11 1.12 CMakeSetupDialog.ui 1.8 1.9 QCMakeCacheView.cxx 1.9 1.10 QCMakeCacheView.h 1.9 1.10

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Nov 7 10:09:05 EST 2007


Update of /cvsroot/CMake/CMake/Source/QtDialog
In directory public:/mounts/ram/cvs-serv29714

Modified Files:
	CMakeSetupDialog.cxx CMakeSetupDialog.h CMakeSetupDialog.ui 
	QCMakeCacheView.cxx QCMakeCacheView.h 
Log Message:

BUG:  Fix behavior of CMakeSetupDialog::set{Binary|Source}Directory
      so they work right when called externally.
      Disable the generate button when one hits configure again.
ENH:  Some UI tweaks for spacing.
      Allow viewing cache values while configure/generate (but not edit).



Index: CMakeSetupDialog.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- CMakeSetupDialog.h	7 Nov 2007 02:27:45 -0000	1.11
+++ CMakeSetupDialog.h	7 Nov 2007 15:09:02 -0000	1.12
@@ -66,6 +66,8 @@
   void addBinaryPath(const QString&);
   QStringList loadBuildPaths();
   void saveBuildPaths(const QStringList&);
+  void onBinaryDirectoryChanged(const QString& dir);
+  void onSourceDirectoryChanged(const QString& dir);
 
 protected:
   void closeEvent(QCloseEvent*);

Index: CMakeSetupDialog.ui
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.ui,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- CMakeSetupDialog.ui	7 Nov 2007 00:25:43 -0000	1.8
+++ CMakeSetupDialog.ui	7 Nov 2007 15:09:02 -0000	1.9
@@ -68,6 +68,22 @@
       </widget>
      </item>
      <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Minimum</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
       <widget class="QLabel" name="label_4" >
        <property name="sizePolicy" >
         <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >

Index: QCMakeCacheView.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMakeCacheView.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- QCMakeCacheView.h	7 Nov 2007 00:25:43 -0000	1.9
+++ QCMakeCacheView.h	7 Nov 2007 15:09:02 -0000	1.10
@@ -65,6 +65,7 @@
 public slots:
   void setProperties(const QCMakeCachePropertyList& props);
   void clear();
+  void setEditEnabled(bool);
 
 public:
   // satisfy [pure] virtuals
@@ -80,11 +81,15 @@
   bool modifiedValues() const;
   // get the properties
   QCMakeCachePropertyList properties() const;
+  
+  // editing enabled
+  bool editEnabled() const;
 
 protected:
   QCMakeCachePropertyList Properties;
   int NewCount;
   bool ModifiedValues;
+  bool EditEnabled;
 };
 
 /// Qt delegate class for interaction (or other customization) 

Index: QCMakeCacheView.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMakeCacheView.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- QCMakeCacheView.cxx	7 Nov 2007 00:25:43 -0000	1.9
+++ QCMakeCacheView.cxx	7 Nov 2007 15:09:02 -0000	1.10
@@ -124,7 +124,8 @@
 }
 
 QCMakeCacheModel::QCMakeCacheModel(QObject* p)
-  : QAbstractTableModel(p), NewCount(0), ModifiedValues(false)
+  : QAbstractTableModel(p),
+    NewCount(0), ModifiedValues(false), EditEnabled(true)
 {
 }
 
@@ -173,6 +174,16 @@
   return this->Properties;
 }
 
+void QCMakeCacheModel::setEditEnabled(bool e)
+{
+  this->EditEnabled = e;
+}
+
+bool QCMakeCacheModel::editEnabled() const
+{
+  return this->EditEnabled;
+}
+
 int QCMakeCacheModel::columnCount (const QModelIndex& /*p*/ ) const
 {
   return 2;
@@ -250,7 +261,7 @@
 {
   Qt::ItemFlags f = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
   // all column 1's are editable
-  if(idx.column() == 1)
+  if(idx.column() == 1 && this->EditEnabled)
     {
     f |= Qt::ItemIsEditable;
     // booleans are editable in place

Index: CMakeSetupDialog.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- CMakeSetupDialog.cxx	7 Nov 2007 03:27:09 -0000	1.13
+++ CMakeSetupDialog.cxx	7 Nov 2007 15:09:02 -0000	1.14
@@ -162,10 +162,9 @@
                    this, SLOT(doBinaryBrowse()));
   
   QObject::connect(this->BinaryDirectory, SIGNAL(editTextChanged(QString)),
-                   this, SLOT(setBinaryDirectory(QString)));
+                   this, SLOT(onBinaryDirectoryChanged(QString)));
   QObject::connect(this->SourceDirectory, SIGNAL(textChanged(QString)),
-                   this->CMakeThread->cmakeInstance(),
-                   SLOT(setSourceDirectory(QString)));
+                   this, SLOT(onSourceDirectoryChanged(QString)));
 
   QObject::connect(this->CMakeThread->cmakeInstance(),
                    SIGNAL(sourceDirChanged(QString)),
@@ -207,7 +206,20 @@
 
   // get the saved binary directories
   QStringList buildPaths = this->loadBuildPaths();
+  this->BinaryDirectory->blockSignals(true);
   this->BinaryDirectory->addItems(buildPaths);
+  this->BinaryDirectory->blockSignals(false);
+  
+  if(!this->SourceDirectory->text().isEmpty() ||
+     !this->BinaryDirectory->lineEdit()->text().isEmpty())
+    {
+    this->onSourceDirectoryChanged(this->SourceDirectory->text());
+    this->onBinaryDirectoryChanged(this->BinaryDirectory->lineEdit()->text());
+    }
+  else
+    {
+    this->onBinaryDirectoryChanged(this->BinaryDirectory->lineEdit()->text());
+    }
 }
 
 CMakeSetupDialog::~CMakeSetupDialog()
@@ -251,9 +263,11 @@
 
   // remember path
   this->addBinaryPath(dir.absolutePath());
-
+    
   this->InterruptButton->setEnabled(true);
   this->setEnabledState(false);
+  this->setGenerateEnabled(false);
+
   this->Output->clear();
   QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
     "setProperties", Qt::QueuedConnection, 
@@ -406,9 +420,19 @@
 
 void CMakeSetupDialog::setBinaryDirectory(const QString& dir)
 {
+  this->BinaryDirectory->setEditText(dir);
+}
+
+void CMakeSetupDialog::onSourceDirectoryChanged(const QString& dir)
+{
+  QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
+    "setSourceDirectory", Qt::QueuedConnection, Q_ARG(QString, dir));
+}
+
+void CMakeSetupDialog::onBinaryDirectoryChanged(const QString& dir)
+{
   this->CacheValues->cacheModel()->clear();
   this->Output->clear();
-  this->BinaryDirectory->setEditText(dir);
   QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
     "setBinaryDirectory", Qt::QueuedConnection, Q_ARG(QString, dir));
 }
@@ -441,7 +465,7 @@
 void CMakeSetupDialog::setEnabledState(bool enabled)
 {
   // disable parts of the GUI during configure/generate
-  this->CacheValues->setEnabled(enabled);
+  this->CacheValues->cacheModel()->setEditEnabled(enabled);
   this->SourceDirectory->setEnabled(enabled);
   this->BrowseSourceDirectoryButton->setEnabled(enabled);
   this->BinaryDirectory->setEnabled(enabled);



More information about the Cmake-commits mailing list