[cmake-commits] clinton committed CMakeSetupDialog.cxx 1.5 1.6 CMakeSetupDialog.h 1.6 1.7 CMakeSetupDialog.ui 1.3 1.4 QCMakeCacheView.cxx 1.6 1.7 QCMakeCacheView.h 1.7 1.8

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Nov 5 19:26:20 EST 2007


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

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

ENH:  Replace prompt for generator with combobox in UI.
ENH:  Make "Show Advanced" toggle work.
ENH:  Add regex search capabilities.
ENH:  Read existing registry entries from MFC CMakeSetup.exe (will save later).



Index: CMakeSetupDialog.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CMakeSetupDialog.h	5 Nov 2007 18:20:54 -0000	1.6
+++ CMakeSetupDialog.h	6 Nov 2007 00:26:18 -0000	1.7
@@ -52,7 +52,7 @@
   void setBinaryDirectory(const QString& dir);
   void showProgress(const QString& msg, float percent);
   void setEnabledState(bool);
-  void promptForGenerator();
+  //void promptForGenerator();
 
 protected:
   void closeEvent(QCloseEvent*);

Index: CMakeSetupDialog.ui
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.ui,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CMakeSetupDialog.ui	3 Nov 2007 23:48:59 -0000	1.3
+++ CMakeSetupDialog.ui	6 Nov 2007 00:26:18 -0000	1.4
@@ -5,145 +5,184 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>673</width>
-    <height>460</height>
+    <width>693</width>
+    <height>582</height>
    </rect>
   </property>
   <layout class="QGridLayout" >
    <item row="0" column="0" >
-    <widget class="QFrame" name="frame" >
-     <property name="frameShape" >
-      <enum>QFrame::NoFrame</enum>
-     </property>
-     <property name="frameShadow" >
-      <enum>QFrame::Raised</enum>
+    <layout class="QGridLayout" >
+     <item row="0" column="0" >
+      <widget class="QLabel" name="label" >
+       <property name="text" >
+        <string>Where is the source code:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1" >
+      <widget class="QLineEdit" name="SourceDirectory" />
+     </item>
+     <item row="0" column="2" >
+      <widget class="QPushButton" name="BrowseSourceDirectoryButton" >
+       <property name="text" >
+        <string>Browse...</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="0" >
+      <widget class="QLabel" name="label_2" >
+       <property name="text" >
+        <string>Where to build the binaries:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1" >
+      <widget class="QComboBox" name="BinaryDirectory" >
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="editable" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="2" >
+      <widget class="QPushButton" name="BrowseBinaryDirectoryButton" >
+       <property name="text" >
+        <string>Browse...</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item row="1" column="0" >
+    <layout class="QHBoxLayout" >
+     <item>
+      <widget class="QLabel" name="label_4" >
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text" >
+        <string>Search:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="Search" >
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QCheckBox" name="Advanced" >
+       <property name="text" >
+        <string>Show Advanced</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_3" >
+       <property name="text" >
+        <string>Build For:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QComboBox" name="Generators" />
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>141</width>
+         <height>23</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="2" column="0" >
+    <widget class="QSplitter" name="Splitter" >
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
      </property>
-     <layout class="QVBoxLayout" >
-      <property name="leftMargin" >
-       <number>0</number>
+     <widget class="QCMakeCacheView" name="CacheValues" >
+      <property name="alternatingRowColors" >
+       <bool>true</bool>
       </property>
-      <property name="topMargin" >
-       <number>0</number>
+      <property name="selectionBehavior" >
+       <enum>QAbstractItemView::SelectRows</enum>
       </property>
-      <property name="rightMargin" >
-       <number>0</number>
+     </widget>
+     <widget class="QTextEdit" name="Output" >
+      <property name="lineWrapMode" >
+       <enum>QTextEdit::NoWrap</enum>
       </property>
-      <property name="bottomMargin" >
-       <number>0</number>
+      <property name="readOnly" >
+       <bool>true</bool>
       </property>
-      <item>
-       <layout class="QGridLayout" >
-        <item row="0" column="0" >
-         <widget class="QLabel" name="label" >
-          <property name="text" >
-           <string>Where is the source code:</string>
-          </property>
-         </widget>
-        </item>
-        <item row="0" column="1" >
-         <widget class="QLineEdit" name="SourceDirectory" />
-        </item>
-        <item row="0" column="2" >
-         <widget class="QPushButton" name="BrowseSourceDirectoryButton" >
-          <property name="text" >
-           <string>Browse...</string>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="0" >
-         <widget class="QLabel" name="label_2" >
-          <property name="text" >
-           <string>Where to build the binaries:</string>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="1" >
-         <widget class="QComboBox" name="BinaryDirectory" >
-          <property name="editable" >
-           <bool>true</bool>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="2" >
-         <widget class="QPushButton" name="BrowseBinaryDirectoryButton" >
-          <property name="text" >
-           <string>Browse...</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <widget class="QSplitter" name="Splitter" >
-        <property name="orientation" >
-         <enum>Qt::Vertical</enum>
-        </property>
-        <widget class="QCMakeCacheView" name="CacheValues" >
-         <property name="alternatingRowColors" >
-          <bool>true</bool>
-         </property>
-         <property name="selectionBehavior" >
-          <enum>QAbstractItemView::SelectRows</enum>
-         </property>
-        </widget>
-        <widget class="QTextEdit" name="Output" >
-         <property name="lineWrapMode" >
-          <enum>QTextEdit::NoWrap</enum>
-         </property>
-         <property name="readOnly" >
-          <bool>true</bool>
-         </property>
-        </widget>
-       </widget>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" >
-        <item>
-         <widget class="QPushButton" name="ConfigureButton" >
-          <property name="text" >
-           <string>Configure</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="GenerateButton" >
-          <property name="text" >
-           <string>Ok</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="CancelButton" >
-          <property name="text" >
-           <string>Cancel</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="HelpButton" >
-          <property name="text" >
-           <string>Help</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <spacer>
-          <property name="orientation" >
-           <enum>Qt::Horizontal</enum>
-          </property>
-          <property name="sizeHint" >
-           <size>
-            <width>40</width>
-            <height>20</height>
-           </size>
-          </property>
-         </spacer>
-        </item>
-       </layout>
-      </item>
-     </layout>
+     </widget>
     </widget>
    </item>
+   <item row="3" column="0" >
+    <layout class="QHBoxLayout" >
+     <item>
+      <widget class="QPushButton" name="ConfigureButton" >
+       <property name="text" >
+        <string>Configure</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="GenerateButton" >
+       <property name="text" >
+        <string>Generate</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="CancelButton" >
+       <property name="text" >
+        <string>Cancel</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="HelpButton" >
+       <property name="text" >
+        <string>Help</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
   </layout>
  </widget>
  <customwidgets>

Index: QCMakeCacheView.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMakeCacheView.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- QCMakeCacheView.h	5 Nov 2007 18:20:54 -0000	1.7
+++ QCMakeCacheView.h	6 Nov 2007 00:26:18 -0000	1.8
@@ -24,6 +24,7 @@
 #include <QCheckBox>
 #include <QLineEdit>
 #include <QItemDelegate>
+#include <QSortFilterProxyModel>
 
 class QCMakeCacheModel;
 
@@ -36,11 +37,19 @@
   QCMakeCacheView(QWidget* p);
 
   QCMakeCacheModel* cacheModel() const;
+  bool showAdvanced() const;
+
+public slots:
+  void setShowAdvanced(bool);
+  void setSearchFilter(const QString&);
 
 protected:
   QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers);
   void showEvent(QShowEvent* e);
   bool Init;
+  QCMakeCacheModel* CacheModel;
+  QSortFilterProxyModel* AdvancedFilter;
+  QSortFilterProxyModel* SearchFilter;
 };
 
 /// Qt model class for cache properties

Index: QCMakeCacheView.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMakeCacheView.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- QCMakeCacheView.cxx	5 Nov 2007 18:20:54 -0000	1.6
+++ QCMakeCacheView.cxx	6 Nov 2007 00:26:18 -0000	1.7
@@ -26,12 +26,20 @@
 #include <QStyle>
 #include <QKeyEvent>
 
+static QRegExp AdvancedRegExp[2] = { QRegExp("(false)"), QRegExp("(true|false)") };
+
 QCMakeCacheView::QCMakeCacheView(QWidget* p)
   : QTableView(p), Init(false)
 {
-  // hook up our model
-  QCMakeCacheModel* m = new QCMakeCacheModel(this);
-  this->setModel(m);
+  // hook up our model and search/filter proxies
+  this->CacheModel = new QCMakeCacheModel(this);
+  this->AdvancedFilter = new QSortFilterProxyModel(this);
+  this->AdvancedFilter->setSourceModel(this->CacheModel);
+  this->AdvancedFilter->setFilterRole(QCMakeCacheModel::AdvancedRole);
+  this->AdvancedFilter->setFilterRegExp(AdvancedRegExp[0]);
+  this->SearchFilter = new QSortFilterProxyModel(this);
+  this->SearchFilter->setSourceModel(this->AdvancedFilter);
+  this->setModel(this->SearchFilter);
 
   // our delegate for creating our editors
   QCMakeCacheModelDelegate* delegate = new QCMakeCacheModelDelegate(this);
@@ -61,7 +69,7 @@
   
 QCMakeCacheModel* QCMakeCacheView::cacheModel() const
 {
-  return qobject_cast<QCMakeCacheModel*>(this->model());
+  return this->CacheModel;
 }
 
 QModelIndex QCMakeCacheView::moveCursor(CursorAction act, 
@@ -97,6 +105,22 @@
     }
   return QTableView::moveCursor(act, mod);
 }
+  
+void QCMakeCacheView::setShowAdvanced(bool s)
+{
+  this->AdvancedFilter->setFilterRegExp(
+    s ? AdvancedRegExp[1] : AdvancedRegExp[0]);
+}
+
+bool QCMakeCacheView::showAdvanced() const
+{
+  return this->AdvancedFilter->filterRegExp() == AdvancedRegExp[1];
+}
+
+void QCMakeCacheView::setSearchFilter(const QString& s)
+{
+  this->SearchFilter->setFilterRegExp(s);
+}
 
 QCMakeCacheModel::QCMakeCacheModel(QObject* p)
   : QAbstractTableModel(p), NewCount(0), IsDirty(false)

Index: CMakeSetupDialog.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CMakeSetupDialog.cxx	5 Nov 2007 18:20:54 -0000	1.5
+++ CMakeSetupDialog.cxx	6 Nov 2007 00:26:18 -0000	1.6
@@ -25,6 +25,7 @@
 #include <QDialogButtonBox>
 #include <QCloseEvent>
 #include <QCoreApplication>
+#include <QSettings>
 
 #include "QCMake.h"
 #include "QCMakeCacheView.h"
@@ -62,7 +63,12 @@
 CMakeSetupDialog::CMakeSetupDialog()
 {
   // create the GUI
-  this->resize(700, 500);
+  QSettings settings;
+  settings.beginGroup("Settings/StartPath");
+  int h = settings.value("Height", 500).toInt();
+  int w = settings.value("Width", 700).toInt();
+  this->resize(w, h);
+
   QWidget* cont = new QWidget(this);
   this->setupUi(cont);
   this->Splitter->setStretchFactor(0, 2);
@@ -76,6 +82,8 @@
     this->style()->standardPixmap(QStyle::SP_DialogCancelButton));
   this->statusBar()->addPermanentWidget(this->InterruptButton);
   this->statusBar()->addPermanentWidget(this->ProgressBar);
+
+
   
   // start the cmake worker thread
   this->CMakeThread = new QCMakeThread(this);
@@ -142,10 +150,44 @@
   
   QObject::connect(this->HelpButton, SIGNAL(clicked(bool)),
                    this, SLOT(doHelp()));
+
+  QObject::connect(this->Advanced, SIGNAL(clicked(bool)), 
+                   this->CacheValues, SLOT(setShowAdvanced(bool)));
+  QObject::connect(this->Search, SIGNAL(textChanged(QString)), 
+                   this->CacheValues, SLOT(setSearchFilter(QString)));
+
+  QStringList gens = this->CMakeThread->cmakeInstance()->availableGenerators();
+  this->Generators->addItems(gens);
+
+  // get the saved binary directories
+  QSettings settings;
+  settings.beginGroup("Settings/StartPath");
+  QStringList buildPaths;
+  for(int i=0; i<10; i++)
+    {
+    QString p = settings.value(QString("WhereBuild%1").arg(i)).toString();
+    if(!p.isEmpty())
+      {
+      buildPaths.append(p);
+      }
+    }
+  this->BinaryDirectory->addItems(buildPaths);
+
+  QString lastGen = settings.value("LastGenerator").toString();
+  int idx = this->Generators->findText(lastGen);
+  if(idx != -1)
+    {
+    this->Generators->setCurrentIndex(idx);
+    }
 }
 
 CMakeSetupDialog::~CMakeSetupDialog()
 {
+  QSettings settings;
+  settings.beginGroup("Settings/StartPath");
+  settings.setValue("Height", this->height());
+  settings.setValue("Width", this->width());
+
   // wait for thread to stop
   this->CMakeThread->quit();
   this->CMakeThread->wait();
@@ -171,11 +213,14 @@
     dir.mkpath(".");
     }
 
+  /*
   // prompt for generator if one doesn't exist
   if(this->CMakeThread->cmakeInstance()->generator().isEmpty())
     {
     this->promptForGenerator();
     }
+    */
+  this->CMakeThread->cmakeInstance()->setGenerator(this->Generators->currentText());
 
   this->InterruptButton->setEnabled(true);
   this->setEnabledState(false);
@@ -360,6 +405,7 @@
   this->CancelButton->setEnabled(enabled);
 }
 
+/*
 void CMakeSetupDialog::promptForGenerator()
 {
   QStringList gens = this->CMakeThread->cmakeInstance()->availableGenerators();
@@ -382,4 +428,5 @@
   dialog.exec();
   this->CMakeThread->cmakeInstance()->setGenerator(combo->currentText());
 }
+*/
 



More information about the Cmake-commits mailing list