[Cmake-commits] CMake branch, next, updated. v3.6.2-1995-g375be98

Brad King brad.king at kitware.com
Tue Sep 13 16:13:12 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  375be98a45b2f56c60724bf79518534b3ab5088f (commit)
       via  1ca2d5d1db5117058e884bcfb226e17e090f29d0 (commit)
      from  d3a223e4918e3c7eeba9ec2511309399f987cf7a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=375be98a45b2f56c60724bf79518534b3ab5088f
commit 375be98a45b2f56c60724bf79518534b3ab5088f
Merge: d3a223e 1ca2d5d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Sep 13 16:13:10 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Sep 13 16:13:10 2016 -0400

    Merge topic 'cmake-gui-open-project' into next
    
    1ca2d5d1 cmake-gui: Add button to open the generated project


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ca2d5d1db5117058e884bcfb226e17e090f29d0
commit 1ca2d5d1db5117058e884bcfb226e17e090f29d0
Author:     Nico Heßler <ex at exmatrikulator.de>
AuthorDate: Fri Jan 22 16:11:03 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Sep 13 16:11:29 2016 -0400

    cmake-gui: Add button to open the generated project
    
    Look for VS or Xcode project files at the top of the build tree.
    If present, enable an "Open Project" button to open them through
    the OS desktop services.

diff --git a/Help/release/dev/cmake-gui-open-project.rst b/Help/release/dev/cmake-gui-open-project.rst
new file mode 100644
index 0000000..32f0f0f
--- /dev/null
+++ b/Help/release/dev/cmake-gui-open-project.rst
@@ -0,0 +1,5 @@
+cmake-gui-open-project
+----------------------
+
+* :manual:`cmake-gui(1)` gained a button to open the generated project file
+  for :ref:`Visual Studio Generators` and the :generator:`Xcode` generator.
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 5b84597..14ce3f7 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -14,6 +14,7 @@
 
 #include <QCloseEvent>
 #include <QCoreApplication>
+#include <QDesktopServices>
 #include <QDialogButtonBox>
 #include <QDragEnterEvent>
 #include <QFileDialog>
@@ -227,6 +228,8 @@ void CMakeSetupDialog::initialize()
 
   QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)), this,
                    SLOT(doGenerate()));
+  QObject::connect(this->OpenProjectButton, SIGNAL(clicked(bool)), this,
+                   SLOT(doOpenProject()));
 
   QObject::connect(this->BrowseSourceDirectoryButton, SIGNAL(clicked(bool)),
                    this, SLOT(doSourceBrowse()));
@@ -499,6 +502,26 @@ void CMakeSetupDialog::doGenerate()
   this->ConfigureNeeded = true;
 }
 
+QString CMakeSetupDialog::getProjectFilename()
+{
+  QStringList nameFilter;
+  nameFilter << "*.sln"
+             << "*.xcodeproj";
+  QDir directory(this->BinaryDirectory->currentText());
+  QStringList nlnFile = directory.entryList(nameFilter);
+
+  if (nlnFile.count() == 1) {
+    return this->BinaryDirectory->currentText() + "/" + nlnFile.at(0);
+  }
+
+  return QString();
+}
+
+void CMakeSetupDialog::doOpenProject()
+{
+  QDesktopServices::openUrl(QUrl::fromLocalFile(this->getProjectFilename()));
+}
+
 void CMakeSetupDialog::closeEvent(QCloseEvent* e)
 {
   // prompt for close if there are unsaved changes, and we're not busy
@@ -617,6 +640,11 @@ void CMakeSetupDialog::updateBinaryDirectory(const QString& dir)
     this->BinaryDirectory->setEditText(dir);
     this->BinaryDirectory->blockSignals(false);
   }
+  if (!this->getProjectFilename().isEmpty()) {
+    this->OpenProjectButton->setEnabled(true);
+  } else {
+    this->OpenProjectButton->setEnabled(false);
+  }
 }
 
 void CMakeSetupDialog::doBinaryBrowse()
@@ -1002,22 +1030,28 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
   if (s == Interrupting) {
     this->ConfigureButton->setEnabled(false);
     this->GenerateButton->setEnabled(false);
+    this->OpenProjectButton->setEnabled(false);
   } else if (s == Configuring) {
     this->setEnabledState(false);
     this->GenerateButton->setEnabled(false);
     this->GenerateAction->setEnabled(false);
+    this->OpenProjectButton->setEnabled(false);
     this->ConfigureButton->setText(tr("&Stop"));
   } else if (s == Generating) {
     this->CacheModified = false;
     this->setEnabledState(false);
     this->ConfigureButton->setEnabled(false);
     this->GenerateAction->setEnabled(false);
+    this->OpenProjectButton->setEnabled(false);
     this->GenerateButton->setText(tr("&Stop"));
   } else if (s == ReadyConfigure) {
     this->setEnabledState(true);
     this->GenerateButton->setEnabled(true);
     this->GenerateAction->setEnabled(true);
     this->ConfigureButton->setEnabled(true);
+    if (!this->getProjectFilename().isEmpty()) {
+      this->OpenProjectButton->setEnabled(true);
+    }
     this->ConfigureButton->setText(tr("&Configure"));
     this->GenerateButton->setText(tr("&Generate"));
   } else if (s == ReadyGenerate) {
@@ -1025,6 +1059,9 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
     this->GenerateButton->setEnabled(true);
     this->GenerateAction->setEnabled(true);
     this->ConfigureButton->setEnabled(true);
+    if (!this->getProjectFilename().isEmpty()) {
+      this->OpenProjectButton->setEnabled(true);
+    }
     this->ConfigureButton->setText(tr("&Configure"));
     this->GenerateButton->setText(tr("&Generate"));
   }
diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h
index 2a4ea7a..992de01 100644
--- a/Source/QtDialog/CMakeSetupDialog.h
+++ b/Source/QtDialog/CMakeSetupDialog.h
@@ -41,6 +41,8 @@ protected slots:
   void initialize();
   void doConfigure();
   void doGenerate();
+  QString getProjectFilename();
+  void doOpenProject();
   void doInstallForCommandLine();
   void doHelp();
   void doAbout();
diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui
index b04bd93..8d8e0cd 100644
--- a/Source/QtDialog/CMakeSetupDialog.ui
+++ b/Source/QtDialog/CMakeSetupDialog.ui
@@ -238,6 +238,13 @@
            </property>
           </widget>
          </item>
+          <item>
+            <widget class="QPushButton" name="OpenProjectButton">
+              <property name="text">
+                <string>Open &Project</string>
+              </property>
+            </widget>
+          </item>
          <item>
           <widget class="QLabel" name="Generator">
            <property name="text">

-----------------------------------------------------------------------

Summary of changes:
 Help/release/dev/cmake-gui-open-project.rst |    5 ++++
 Source/QtDialog/CMakeSetupDialog.cxx        |   37 +++++++++++++++++++++++++++
 Source/QtDialog/CMakeSetupDialog.h          |    2 ++
 Source/QtDialog/CMakeSetupDialog.ui         |    7 +++++
 4 files changed, 51 insertions(+)
 create mode 100644 Help/release/dev/cmake-gui-open-project.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list