[cmake-commits] clinton committed CMakeSetup.cxx 1.9 1.10 CMakeSetupDialog.cxx 1.28 1.29 CMakeSetupDialog.h 1.17 1.18 QCMake.cxx 1.12 1.13

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Feb 1 10:41:31 EST 2008


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

Modified Files:
	CMakeSetup.cxx CMakeSetupDialog.cxx CMakeSetupDialog.h 
	QCMake.cxx 
Log Message:
ENH:  Use translation file if it exists for the locale.
      Consolidate some strings.

      More responsive interrupting.  Prompt user if they try to close during
      configure, and allow them to close.



Index: CMakeSetupDialog.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.cxx,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- CMakeSetupDialog.cxx	29 Jan 2008 20:54:49 -0000	1.28
+++ CMakeSetupDialog.cxx	1 Feb 2008 15:41:29 -0000	1.29
@@ -48,19 +48,9 @@
   return this->CMakeInstance;
 }
 
-void QCMakeThread::processEvents()
-{
-  QCoreApplication::processEvents();
-}
-
 void QCMakeThread::run()
 {
   this->CMakeInstance = new QCMake;
-  // make the cmake thread to process events it receives from the GUI thread
-  QObject::connect(this->CMakeInstance, SIGNAL(progressChanged(QString, float)),
-                   this, SLOT(processEvents()), Qt::DirectConnection);
-  QObject::connect(this->CMakeInstance, SIGNAL(outputMessage(QString)),
-                   this, SLOT(processEvents()), Qt::DirectConnection);
   // emit that this cmake thread is ready for use
   emit this->cmakeInitialized();
   this->exec();
@@ -233,7 +223,7 @@
 
   // wait for thread to stop
   this->CMakeThread->quit();
-  this->CMakeThread->wait();
+  this->CMakeThread->wait(2000);
 }
   
 void CMakeSetupDialog::doConfigure()
@@ -250,8 +240,9 @@
   if(!dir.exists())
     {
     QString message = tr("Build directory does not exist, "
-                         "should I create it?\n\n"
-                         "Directory: ");
+                         "should I create it?")
+                      + "\n\n"
+                      + tr("Directory: ");
     message += bindir;
     QString title = tr("Create Directory");
     QMessageBox::StandardButton btn;
@@ -330,13 +321,7 @@
   
 void CMakeSetupDialog::closeEvent(QCloseEvent* e)
 {
-  // don't close if we're busy
-  if(this->CurrentState == Configuring || this->CurrentState == Generating)
-    {
-    e->ignore();
-    }
-  
-  // prompt for close if there are unsaved changes
+  // prompt for close if there are unsaved changes, and we're not busy
   if(this->CacheModified)
     {
     QString message = tr("You have changed options but not rebuilt, "
@@ -350,6 +335,32 @@
       e->ignore();
       }
     }
+
+  // don't close if we're busy, unless the user really wants to
+  if(this->CurrentState == Configuring)
+    {
+    QString message = "You are in the middle of a Configure.\n"
+                   "If you Exit now the configure information will be lost.\n"
+                   "Are you sure you want to Exit?";
+    QString title = tr("Confirm Exit");
+    QMessageBox::StandardButton btn;
+    btn = QMessageBox::critical(this, title, message,
+                                QMessageBox::Yes | QMessageBox::No);
+    if(btn == QMessageBox::No)
+      {
+      e->ignore();
+      }
+    else
+      {
+      this->doInterrupt();
+      }
+    }
+
+  // let the generate finish
+  if(this->CurrentState == Generating)
+    {
+    e->ignore();
+    }
 }
 
 void CMakeSetupDialog::doHelp()
@@ -373,7 +384,7 @@
     "directory.");
 
   QDialog dialog;
-  dialog.setWindowTitle(tr("CMakeSetup Help"));
+  dialog.setWindowTitle(tr("Help"));
   QVBoxLayout* l = new QVBoxLayout(&dialog);
   QLabel* lab = new QLabel(&dialog);
   l->addWidget(lab);
@@ -484,7 +495,7 @@
 
   QStringList gens = this->CMakeThread->cmakeInstance()->availableGenerators();
   QDialog dialog;
-  dialog.setWindowTitle(tr("CMakeSetup choose generator"));
+  dialog.setWindowTitle(tr("Choose Generator"));
   QLabel* lab = new QLabel(&dialog);
   lab->setText(tr("Please select what build system you want CMake to generate files for.\n"
                     "You should select the tool that you will use to build the project.\n"
@@ -539,10 +550,10 @@
 
 void CMakeSetupDialog::doAbout()
 {
-  QString msg = "CMakeSetup\nwww.cmake.org";
+  QString msg = QApplication::applicationName() + "\nwww.cmake.org";
 
   QDialog dialog;
-  dialog.setWindowTitle(tr("About CMakeSetup"));
+  dialog.setWindowTitle(tr("About"));
   QVBoxLayout* l = new QVBoxLayout(&dialog);
   QLabel* lab = new QLabel(&dialog);
   l->addWidget(lab);
@@ -762,7 +773,7 @@
 {
   QDialog dialog(this);
   dialog.resize(400, 200);
-  dialog.setWindowTitle(tr("CMakeSetup Help"));
+  dialog.setWindowTitle(tr("Add Cache Entry"));
   QVBoxLayout* l = new QVBoxLayout(&dialog);
   AddCacheEntry* w = new AddCacheEntry(&dialog);
   QDialogButtonBox* btns = new QDialogButtonBox(

Index: CMakeSetup.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetup.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- CMakeSetup.cxx	13 Dec 2007 22:56:50 -0000	1.9
+++ CMakeSetup.cxx	1 Feb 2008 15:41:29 -0000	1.10
@@ -18,6 +18,7 @@
 #include <QApplication>
 #include <QFileInfo>
 #include <QDir>
+#include <QTranslator>
 
 #include "CMakeSetupDialog.h"
 #include "cmDocumentation.h"
@@ -64,6 +65,12 @@
 {
   cmSystemTools::FindExecutableDirectory(argv[0]);
   QApplication app(argc, argv);
+
+  QTranslator translator;
+  QString transfile = QString("cmake_%1").arg(QLocale::system().name());
+  translator.load(transfile, app.applicationDirPath());
+  app.installTranslator(&translator);
+  
   app.setApplicationName("CMakeSetup");
   app.setOrganizationName("Kitware");
   app.setWindowIcon(QIcon(":/Icons/CMakeSetup.png"));
@@ -99,7 +106,7 @@
     }
 
   CMakeSetupDialog dialog;
-  dialog.setWindowTitle("CMakeSetup");
+  dialog.setWindowTitle(QApplication::applicationName());
   dialog.show();
  
   // for now: args support specifying build and/or source directory 

Index: CMakeSetupDialog.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- CMakeSetupDialog.h	13 Nov 2007 04:54:49 -0000	1.17
+++ CMakeSetupDialog.h	1 Feb 2008 15:41:29 -0000	1.18
@@ -103,9 +103,6 @@
 signals:  
   void cmakeInitialized();
 
-protected slots:
-  void processEvents();
-
 protected:
   virtual void run();
   QCMake* CMakeInstance;

Index: QCMake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMake.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- QCMake.cxx	13 Nov 2007 04:54:49 -0000	1.12
+++ QCMake.cxx	1 Feb 2008 15:41:29 -0000	1.13
@@ -292,6 +292,7 @@
     {
     emit self->outputMessage(msg);
     }
+  QCoreApplication::processEvents();
 }
 
 void QCMake::errorCallback(const char* msg, const char* /*title*/,
@@ -299,6 +300,7 @@
 {
   QCMake* self = reinterpret_cast<QCMake*>(cd);
   emit self->errorMessage(msg);
+  QCoreApplication::processEvents();
 }
 
 QString QCMake::binaryDirectory() const



More information about the Cmake-commits mailing list