[cmake-commits] clinton committed CMakeSetup.qrc 1.2 1.3 CMakeSetupDialog.cxx 1.18 1.19 CMakeSetupDialog.h 1.14 1.15 CMakeSetupDialog.ui 1.11 1.12 Delete16.png NONE 1.1 QCMakeCacheView.cxx 1.14 1.15 QCMakeCacheView.h 1.12 1.13

cmake-commits at cmake.org cmake-commits at cmake.org
Sat Nov 10 11:36:11 EST 2007


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

Modified Files:
	CMakeSetup.qrc CMakeSetupDialog.cxx CMakeSetupDialog.h 
	CMakeSetupDialog.ui QCMakeCacheView.cxx QCMakeCacheView.h 
Added Files:
	Delete16.png 
Log Message:

ENH:  Re-arrange UI a bit.
BUG:  Properly update when values that changed since the last configure.



Index: QCMakeCacheView.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMakeCacheView.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- QCMakeCacheView.cxx	9 Nov 2007 20:18:49 -0000	1.14
+++ QCMakeCacheView.cxx	10 Nov 2007 16:36:09 -0000	1.15
@@ -26,9 +26,6 @@
 #include <QStyle>
 #include <QKeyEvent>
 #include <QMenu>
-#include <QDialog>
-#include <QLabel>
-#include <QDialogButtonBox>
 #include <QDirModel>
 #include <QCompleter>
 
@@ -79,82 +76,7 @@
 {
   return this->CacheModel;
 }
-  
-void QCMakeCacheView::contextMenuEvent(QContextMenuEvent* /*e*/)
-{
-  QList<QModelIndex> idxs = this->selectionModel()->selectedRows();
-
-  if(idxs.count())
-    {
-    QMenu* menu = new QMenu(this);
-    QAction* deleteAction = NULL;
-    QAction* ignoreAction = NULL;
-    if(this->cacheModel()->editEnabled())
-      {
-      QString t = idxs.count() > 1 ? tr("Delete Cache Entries") : 
-                                     tr("Delete Cache Entry");
-      deleteAction = menu->addAction(t);
-      t = idxs.count() > 1 ? tr("Ignore Cache Entries") : 
-                             tr("Ignore Cache Entry");
-      ignoreAction = menu->addAction(t);
-      }
-    QAction* helpAction = menu->addAction(tr("Help For Cache Entry"));
-    QAction* which = menu->exec(QCursor::pos());
-    if(!which)
-      {
-      return;
-      }
-    
-    if(which == helpAction)
-      {
-      QModelIndex idx = this->selectionModel()->currentIndex();
-      idx = this->SearchFilter->mapToSource(idx);
-      idx = this->AdvancedFilter->mapToSource(idx);
-      idx = this->cacheModel()->index(idx.row(), 0);
-      QString msg = this->cacheModel()->data(idx, Qt::DisplayRole).toString() +
-                    "\n\n" +
-             this->cacheModel()->data(idx, QCMakeCacheModel::HelpRole).toString();
-      QDialog dialog;
-      dialog.setWindowTitle(tr("CMakeSetup Help"));
-      QVBoxLayout* l = new QVBoxLayout(&dialog);
-      QLabel* lab = new QLabel(&dialog);
-      l->addWidget(lab);
-      lab->setText(msg);
-      lab->setWordWrap(true);
-      QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok,
-                                                    Qt::Horizontal, &dialog);
-      QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
-      l->addWidget(btns);
-      dialog.exec();
-      }
-    else
-      {
-      QList<QPersistentModelIndex> pidxs;
-      foreach(QModelIndex i, idxs)
-        {
-        i = this->SearchFilter->mapToSource(i);
-        i = this->AdvancedFilter->mapToSource(i);
-        pidxs.append(i);
-        }
-      if(which == deleteAction)
-        {
-        foreach(QPersistentModelIndex j, pidxs)
-          {
-          this->cacheModel()->removeRows(j.row(), 1);
-          }
-        }
-      else if(which == ignoreAction)
-        {
-        foreach(QPersistentModelIndex j, pidxs)
-          {
-          j = this->cacheModel()->index(j.row(), 1);
-          this->cacheModel()->setData(j, "IGNORE", Qt::DisplayRole);
-          }
-        }
-      }
-    }
-}
-
+ 
 QModelIndex QCMakeCacheView::moveCursor(CursorAction act, 
   Qt::KeyboardModifiers mod)
 {
@@ -228,17 +150,19 @@
 void QCMakeCacheModel::setProperties(const QCMakeCachePropertyList& props)
 {
   QSet<QCMakeCacheProperty> newProps = props.toSet();
+  QSet<QCMakeCacheProperty> newProps2 = props.toSet();
   QSet<QCMakeCacheProperty> oldProps = this->Properties.toSet();
   
   oldProps.intersect(newProps);
   newProps.subtract(oldProps);
+  newProps2.subtract(newProps);
 
   this->NewCount = newProps.count();
   this->Properties.clear();
 
   this->Properties = newProps.toList();
   qSort(this->Properties);
-  QCMakeCachePropertyList tmp = oldProps.toList();
+  QCMakeCachePropertyList tmp = newProps2.toList();
   qSort(tmp);
   this->Properties += tmp;
   
@@ -384,17 +308,20 @@
   return idx;
 }
   
-bool QCMakeCacheModel::removeRows(int row, int, const QModelIndex&)
+bool QCMakeCacheModel::removeRows(int row, int num, const QModelIndex&)
 {
-  if(row < 0 || row >= this->Properties.count())
+  if(row < 0 || row+num > this->Properties.count())
     {
     return false;
     }
-  this->beginRemoveRows(QModelIndex(), row, row);
-  this->Properties.removeAt(row);
-  if(this->NewCount >= row+1)
+  this->beginRemoveRows(QModelIndex(), row, row+num-1);
+  for(int i=0; i<num; i++)
     {
-    this->NewCount--;
+    this->Properties.removeAt(row);
+    if(this->NewCount >= row+1)
+      {
+      this->NewCount--;
+      }
     }
   this->endRemoveRows();
   return true;

Index: CMakeSetupDialog.ui
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.ui,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- CMakeSetupDialog.ui	8 Nov 2007 15:17:37 -0000	1.11
+++ CMakeSetupDialog.ui	10 Nov 2007 16:36:09 -0000	1.12
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>705</width>
-    <height>495</height>
+    <width>707</width>
+    <height>582</height>
    </rect>
   </property>
   <layout class="QGridLayout" >
@@ -59,93 +59,186 @@
     </layout>
    </item>
    <item row="1" column="0" >
-    <layout class="QHBoxLayout" >
-     <item>
-      <widget class="QCheckBox" name="Advanced" >
-       <property name="text" >
-        <string>Show Advanced</string>
-       </property>
-      </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" >
-         <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="Expanding" >
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-      </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>61</width>
-         <height>23</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QLabel" name="Generator" >
-       <property name="text" >
-        <string>Current Generator:</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item row="2" column="0" >
     <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="selectionMode" >
-       <enum>QAbstractItemView::ExtendedSelection</enum>
+     <widget class="QFrame" name="frame" >
+      <property name="frameShape" >
+       <enum>QFrame::NoFrame</enum>
       </property>
-      <property name="selectionBehavior" >
-       <enum>QAbstractItemView::SelectRows</enum>
+      <property name="frameShadow" >
+       <enum>QFrame::Raised</enum>
       </property>
+      <layout class="QGridLayout" >
+       <property name="leftMargin" >
+        <number>0</number>
+       </property>
+       <property name="topMargin" >
+        <number>0</number>
+       </property>
+       <property name="rightMargin" >
+        <number>0</number>
+       </property>
+       <property name="bottomMargin" >
+        <number>0</number>
+       </property>
+       <item row="0" column="0" colspan="6" >
+        <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="Expanding" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="Advanced" >
+           <property name="text" >
+            <string>Show Advanced Entries</string>
+           </property>
+          </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>61</width>
+             <height>23</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QToolButton" name="RemoveEntry" >
+           <property name="toolTip" >
+            <string>Remove Selected Entries</string>
+           </property>
+           <property name="text" >
+            <string/>
+           </property>
+           <property name="icon" >
+            <iconset resource="CMakeSetup.qrc" >:/Icons/Delete16.png</iconset>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="1" column="0" colspan="6" >
+        <widget class="QCMakeCacheView" name="CacheValues" >
+         <property name="alternatingRowColors" >
+          <bool>true</bool>
+         </property>
+         <property name="selectionMode" >
+          <enum>QAbstractItemView::ExtendedSelection</enum>
+         </property>
+         <property name="selectionBehavior" >
+          <enum>QAbstractItemView::SelectRows</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="0" >
+        <widget class="QPushButton" name="ConfigureButton" >
+         <property name="text" >
+          <string>Configure</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="1" >
+        <widget class="QPushButton" name="GenerateButton" >
+         <property name="text" >
+          <string>Generate</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="2" >
+        <widget class="QLabel" name="Generator" >
+         <property name="text" >
+          <string>Current Generator:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="3" >
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType" >
+          <enum>QSizePolicy::Expanding</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>121</width>
+           <height>27</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="3" column="5" >
+        <widget class="QProgressBar" name="ProgressBar" >
+         <property name="minimum" >
+          <number>0</number>
+         </property>
+         <property name="maximum" >
+          <number>100</number>
+         </property>
+         <property name="value" >
+          <number>0</number>
+         </property>
+         <property name="textVisible" >
+          <bool>false</bool>
+         </property>
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="textDirection" >
+          <enum>QProgressBar::BottomToTop</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="4" >
+        <widget class="QToolButton" name="InterruptButton" >
+         <property name="text" >
+          <string>...</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="0" colspan="6" >
+        <widget class="QLabel" name="label_3" >
+         <property name="text" >
+          <string>Press Configure to update and display new values in red, then press Generate to generate selected build files.</string>
+         </property>
+         <property name="alignment" >
+          <set>Qt::AlignCenter</set>
+         </property>
+         <property name="wordWrap" >
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+      </layout>
      </widget>
      <widget class="QTextEdit" name="Output" >
       <property name="lineWrapMode" >
@@ -157,77 +250,6 @@
      </widget>
     </widget>
    </item>
-   <item row="4" 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="DeleteCacheButton" >
-       <property name="text" >
-        <string>Delete Cache</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>
-     <item>
-      <widget class="QToolButton" name="InterruptButton" >
-       <property name="enabled" >
-        <bool>false</bool>
-       </property>
-       <property name="text" >
-        <string>...</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QProgressBar" name="ProgressBar" >
-       <property name="value" >
-        <number>0</number>
-       </property>
-       <property name="textVisible" >
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item row="3" column="0" >
-    <widget class="QLabel" name="label_3" >
-     <property name="text" >
-      <string>Right click on a cache value for additional options (delete, ignore, and help).&lt;br>Press Configure to update and display new values in red, then press Generate to generate selected build files.</string>
-     </property>
-     <property name="alignment" >
-      <set>Qt::AlignCenter</set>
-     </property>
-     <property name="wordWrap" >
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
   </layout>
  </widget>
  <customwidgets>

Index: QCMakeCacheView.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMakeCacheView.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- QCMakeCacheView.h	9 Nov 2007 20:18:49 -0000	1.12
+++ QCMakeCacheView.h	10 Nov 2007 16:36:09 -0000	1.13
@@ -45,7 +45,6 @@
   void setSearchFilter(const QString&);
 
 protected:
-  void contextMenuEvent(QContextMenuEvent* e);
   QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers);
   void showEvent(QShowEvent* e);
   bool Init;

Index: CMakeSetup.qrc
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetup.qrc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CMakeSetup.qrc	3 Nov 2007 14:30:52 -0000	1.2
+++ CMakeSetup.qrc	10 Nov 2007 16:36:09 -0000	1.3
@@ -1,5 +1,6 @@
 <RCC>
     <qresource prefix="/Icons" >
         <file>CMakeSetup.png</file>
+        <file>Delete16.png</file>
     </qresource>
 </RCC>

Index: CMakeSetupDialog.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- CMakeSetupDialog.cxx	9 Nov 2007 20:18:49 -0000	1.18
+++ CMakeSetupDialog.cxx	10 Nov 2007 16:36:09 -0000	1.19
@@ -83,6 +83,8 @@
   this->ProgressBar->reset();
   this->InterruptButton->setIcon(
     this->style()->standardPixmap(QStyle::SP_DialogCancelButton));
+  this->InterruptButton->setEnabled(false);
+  this->RemoveEntry->setEnabled(false);
 
   QMenu* FileMenu = this->menuBar()->addMenu(tr("&File"));
   this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache"));
@@ -190,13 +192,15 @@
                    this, SLOT(updateGeneratorLabel(QString)));
   this->updateGeneratorLabel(QString());
   
-  QObject::connect(this->DeleteCacheButton, SIGNAL(clicked(bool)), 
-                   this, SLOT(doDeleteCache()));
-
   QObject::connect(this->CacheValues->cacheModel(),
                    SIGNAL(dataChanged(QModelIndex,QModelIndex)), 
                    this, SLOT(setCacheModified()));
-
+  
+  QObject::connect(this->CacheValues->selectionModel(),
+                   SIGNAL(selectionChanged(QItemSelection,QItemSelection)), 
+                   this, SLOT(selectionChanged()));
+  QObject::connect(this->RemoveEntry, SIGNAL(clicked(bool)), 
+                   this, SLOT(removeSelectedCacheEntries()));
 
   // get the saved binary directories
   QStringList buildPaths = this->loadBuildPaths();
@@ -457,9 +461,9 @@
   this->ConfigureButton->setEnabled(enabled);
   this->ReloadCacheAction->setEnabled(enabled);
   this->DeleteCacheAction->setEnabled(enabled);
-  this->DeleteCacheButton->setEnabled(enabled);
   this->ExitAction->setEnabled(enabled);
   this->ConfigureAction->setEnabled(enabled);
+  this->RemoveEntry->setEnabled(false);  // let selection re-enable it
   // generate button/action are handled separately
 }
 
@@ -671,4 +675,30 @@
   this->setGenerateEnabled(false);
 }
 
+void CMakeSetupDialog::removeSelectedCacheEntries()
+{
+  QModelIndexList idxs = this->CacheValues->selectionModel()->selectedRows();
+  QList<QPersistentModelIndex> pidxs;
+  foreach(QModelIndex i, idxs)
+    {
+    pidxs.append(i);
+    }
+  foreach(QPersistentModelIndex pi, pidxs)
+    {
+    this->CacheValues->model()->removeRow(pi.row());
+    }
+}
+
+void CMakeSetupDialog::selectionChanged()
+{
+  QModelIndexList idxs = this->CacheValues->selectionModel()->selectedRows();
+  if(idxs.count() && !this->InterruptButton->isEnabled())
+    {
+    this->RemoveEntry->setEnabled(true);
+    }
+  else
+    {
+    this->RemoveEntry->setEnabled(false);
+    }
+}
 

--- NEW FILE: Delete16.png ---
(This appears to be a binary file; contents omitted.)

Index: CMakeSetupDialog.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- CMakeSetupDialog.h	9 Nov 2007 20:18:49 -0000	1.14
+++ CMakeSetupDialog.h	10 Nov 2007 16:36:09 -0000	1.15
@@ -68,6 +68,8 @@
   void onBinaryDirectoryChanged(const QString& dir);
   void onSourceDirectoryChanged(const QString& dir);
   void setCacheModified();
+  void removeSelectedCacheEntries();
+  void selectionChanged();
 
 protected:
   void closeEvent(QCloseEvent*);



More information about the Cmake-commits mailing list