[cmake-commits] clinton committed CMakeSetupDialog.cxx 1.17 1.18 CMakeSetupDialog.h 1.13 1.14 QCMake.cxx 1.10 1.11 QCMake.h 1.7 1.8 QCMakeCacheView.cxx 1.13 1.14 QCMakeCacheView.h 1.11 1.12

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Nov 9 15:18:51 EST 2007


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

Modified Files:
	CMakeSetupDialog.cxx CMakeSetupDialog.h QCMake.cxx QCMake.h 
	QCMakeCacheView.cxx QCMakeCacheView.h 
Log Message:
BUG:  Don't prompt for unsaved changes if no changes were made.
ENH:  Error messages go to output window instead of message boxes.


Index: QCMakeCacheView.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMakeCacheView.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- QCMakeCacheView.cxx	9 Nov 2007 06:14:37 -0000	1.13
+++ QCMakeCacheView.cxx	9 Nov 2007 20:18:49 -0000	1.14
@@ -207,7 +207,7 @@
 
 QCMakeCacheModel::QCMakeCacheModel(QObject* p)
   : QAbstractTableModel(p),
-    NewCount(0), ModifiedValues(false), EditEnabled(true)
+    NewCount(0), EditEnabled(true)
 {
 }
 
@@ -215,11 +215,6 @@
 {
 }
 
-bool QCMakeCacheModel::modifiedValues() const
-{
-  return this->ModifiedValues;
-}
-
 static uint qHash(const QCMakeCacheProperty& p)
 {
   return qHash(p.Key);
@@ -247,7 +242,6 @@
   qSort(tmp);
   this->Properties += tmp;
   
-  this->ModifiedValues = NewCount != 0;
   this->reset();
 }
   
@@ -266,6 +260,11 @@
   return this->EditEnabled;
 }
 
+int QCMakeCacheModel::newCount() const
+{
+  return this->NewCount;
+}
+
 int QCMakeCacheModel::columnCount (const QModelIndex& /*p*/ ) const
 {
   return 2;
@@ -361,19 +360,16 @@
   if(idx.column() == 0 && (role == Qt::DisplayRole || role == Qt::EditRole))
     {
     this->Properties[idx.row()].Key = value.toString();
-    this->ModifiedValues = true;
     emit this->dataChanged(idx, idx);
     }
   else if(idx.column() == 1 && (role == Qt::DisplayRole || role == Qt::EditRole))
     {
     this->Properties[idx.row()].Value = value.toString();
-    this->ModifiedValues = true;
     emit this->dataChanged(idx, idx);
     }
   else if(idx.column() == 1 && (role == Qt::CheckStateRole))
     {
     this->Properties[idx.row()].Value = value.toInt() == Qt::Checked;
-    this->ModifiedValues = true;
     emit this->dataChanged(idx, idx);
     }
   return false;

Index: QCMakeCacheView.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMakeCacheView.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- QCMakeCacheView.h	8 Nov 2007 15:17:37 -0000	1.11
+++ QCMakeCacheView.h	9 Nov 2007 20:18:49 -0000	1.12
@@ -81,18 +81,17 @@
   bool setData ( const QModelIndex& index, const QVariant& value, int role );
   QModelIndex buddy ( const QModelIndex& index ) const;
 
-  // flag if a cache property has been modified
-  bool modifiedValues() const;
   // get the properties
   QCMakeCachePropertyList properties() const;
   
   // editing enabled
   bool editEnabled() const;
 
+  int newCount() const;
+
 protected:
   QCMakeCachePropertyList Properties;
   int NewCount;
-  bool ModifiedValues;
   bool EditEnabled;
 };
 

Index: CMakeSetupDialog.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- CMakeSetupDialog.cxx	8 Nov 2007 21:47:00 -0000	1.17
+++ CMakeSetupDialog.cxx	9 Nov 2007 20:18:49 -0000	1.18
@@ -66,7 +66,7 @@
 }
 
 CMakeSetupDialog::CMakeSetupDialog()
-  : ExitAfterGenerate(true)
+  : ExitAfterGenerate(true), CacheModified(false)
 {
   // create the GUI
   QSettings settings;
@@ -170,9 +170,8 @@
                    this, SLOT(showProgress(QString,float)));
   
   QObject::connect(this->CMakeThread->cmakeInstance(),
-                   SIGNAL(error(QString, QString, bool*)),
-                   this, SLOT(error(QString,QString,bool*)),
-                   Qt::BlockingQueuedConnection);
+                   SIGNAL(errorMessage(QString)),
+                   this, SLOT(error(QString)));
 
   QObject::connect(this->InterruptButton, SIGNAL(clicked(bool)),
                    this, SLOT(doInterrupt()));
@@ -191,15 +190,14 @@
                    this, SLOT(updateGeneratorLabel(QString)));
   this->updateGeneratorLabel(QString());
   
-  QObject::connect(this->CacheValues->cacheModel(),
-                   SIGNAL(dataChanged(QModelIndex, QModelIndex)),
-                   this, SLOT(cacheModelDirty()));
-  QObject::connect(this->CacheValues->cacheModel(), SIGNAL(modelReset()),
-                   this, SLOT(cacheModelDirty()));
-  
   QObject::connect(this->DeleteCacheButton, SIGNAL(clicked(bool)), 
                    this, SLOT(doDeleteCache()));
 
+  QObject::connect(this->CacheValues->cacheModel(),
+                   SIGNAL(dataChanged(QModelIndex,QModelIndex)), 
+                   this, SLOT(setCacheModified()));
+
+
   // get the saved binary directories
   QStringList buildPaths = this->loadBuildPaths();
   this->BinaryDirectory->blockSignals(true);
@@ -284,7 +282,7 @@
       tr("Error in configuration process, project files may be invalid"), 
       QMessageBox::Ok);
     }
-  else if(!this->CacheValues->cacheModel()->modifiedValues())
+  else if(0 == this->CacheValues->cacheModel()->newCount())
     {
     this->setGenerateEnabled(true);
     }
@@ -329,7 +327,7 @@
     }
   
   // prompt for close if there are unsaved changes
-  if(this->CacheValues->cacheModel()->modifiedValues())
+  if(this->CacheModified)
     {
     QString message = tr("You have changed options but not rebuilt, "
                     "are you sure you want to exit?");
@@ -426,6 +424,7 @@
 
 void CMakeSetupDialog::onBinaryDirectoryChanged(const QString& dir)
 {
+  this->CacheModified = false;
   this->CacheValues->cacheModel()->clear();
   this->Output->clear();
   QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
@@ -442,18 +441,9 @@
   this->ProgressBar->setValue(qRound(percent * 100));
 }
   
-void CMakeSetupDialog::error(const QString& title, const QString& message, 
-                             bool* cancel)
+void CMakeSetupDialog::error(const QString& message)
 {
-  QMessageBox::StandardButton btn;
-  QString msg = message + "\n\n" + 
-    tr("(Press cancel to suppress any further messages.)");
-  btn = QMessageBox::critical(this, title, msg,
-                              QMessageBox::Ok | QMessageBox::Cancel);
-  if(btn == QMessageBox::Cancel)
-    {
-    *cancel = false;
-    }
+  this->Output->append(QString("<b><font color=red>%1</font></b>").arg(message));
 }
 
 void CMakeSetupDialog::setEnabledState(bool enabled)
@@ -562,14 +552,6 @@
   */
 }
 
-void CMakeSetupDialog::cacheModelDirty()
-{
-  if(this->CacheValues->cacheModel()->modifiedValues())
-    {
-    this->setGenerateEnabled(false);
-    }
-}
-
 void CMakeSetupDialog::setGenerateEnabled(bool b)
 {
   this->GenerateButton->setEnabled(b);
@@ -682,4 +664,11 @@
     settings.setValue(QString("WhereBuild%1").arg(i), paths[i]);
     }
 }
+  
+void CMakeSetupDialog::setCacheModified()
+{
+  this->CacheModified = true;
+  this->setGenerateEnabled(false);
+}
+
 

Index: CMakeSetupDialog.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- CMakeSetupDialog.h	7 Nov 2007 16:31:55 -0000	1.13
+++ CMakeSetupDialog.h	9 Nov 2007 20:18:49 -0000	1.14
@@ -49,7 +49,7 @@
   void doInterrupt();
   void finishConfigure(int error);
   void finishGenerate(int error);
-  void error(const QString& title, const QString& message, bool* cancel);
+  void error(const QString& message);
   
   void doSourceBrowse();
   void doBinaryBrowse();
@@ -61,13 +61,13 @@
   void promptForGenerator();
   void updateGeneratorLabel(const QString& gen);
   void setExitAfterGenerate(bool);
-  void cacheModelDirty();
   void setGenerateEnabled(bool);
   void addBinaryPath(const QString&);
   QStringList loadBuildPaths();
   void saveBuildPaths(const QStringList&);
   void onBinaryDirectoryChanged(const QString& dir);
   void onSourceDirectoryChanged(const QString& dir);
+  void setCacheModified();
 
 protected:
   void closeEvent(QCloseEvent*);
@@ -76,6 +76,7 @@
 
   QCMakeThread* CMakeThread;
   bool ExitAfterGenerate;
+  bool CacheModified;
   QAction* ReloadCacheAction;
   QAction* DeleteCacheAction;
   QAction* ExitAction;

Index: QCMake.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMake.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- QCMake.h	6 Nov 2007 06:16:11 -0000	1.7
+++ QCMake.h	9 Nov 2007 20:18:49 -0000	1.8
@@ -105,8 +105,6 @@
   void propertiesChanged(const QCMakeCachePropertyList& vars);
   /// signal when the generator changes
   void generatorChanged(const QString& gen);
-  /// signal when there is an error message
-  void error(const QString& title, const QString& message, bool*);
   /// signal when the source directory changes (binary directory already
   /// containing a CMakeCache.txt file)
   void sourceDirChanged(const QString& dir);
@@ -118,6 +116,8 @@
   void generateDone(int error);
   /// signal when there is an output message
   void outputMessage(const QString& msg);
+  /// signal when there is an error message
+  void errorMessage(const QString& msg);
 
 protected:
   cmake* CMakeInstance;

Index: QCMake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMake.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- QCMake.cxx	8 Nov 2007 21:47:00 -0000	1.10
+++ QCMake.cxx	9 Nov 2007 20:18:49 -0000	1.11
@@ -255,11 +255,11 @@
     }
 }
 
-void QCMake::errorCallback(const char* msg, const char* title,
-                           bool& stop, void* cd)
+void QCMake::errorCallback(const char* msg, const char* /*title*/,
+                           bool& /*stop*/, void* cd)
 {
   QCMake* self = reinterpret_cast<QCMake*>(cd);
-  emit self->error(title, msg, &stop);
+  emit self->errorMessage(msg);
 }
 
 QString QCMake::binaryDirectory() const



More information about the Cmake-commits mailing list