[Cmake-commits] CMake branch, next, updated. v2.8.12.1-7088-g35393cc

Clinton Stimpson clinton at elemtech.com
Tue Jan 14 01:26:30 EST 2014


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  35393cc01c2c08cae42a242bf848eeea0f804a8f (commit)
       via  97451e5376e3e4772049c32bee7a7abe8a98c956 (commit)
      from  ff744f3cfccebb01b436f2a5f09d5df7bce3850c (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=35393cc01c2c08cae42a242bf848eeea0f804a8f
commit 35393cc01c2c08cae42a242bf848eeea0f804a8f
Merge: ff744f3 97451e5
Author:     Clinton Stimpson <clinton at elemtech.com>
AuthorDate: Tue Jan 14 01:26:29 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jan 14 01:26:29 2014 -0500

    Merge topic 'var-type-autofill' into next
    
    97451e53 Remember variable type in Add Entry


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=97451e5376e3e4772049c32bee7a7abe8a98c956
commit 97451e5376e3e4772049c32bee7a7abe8a98c956
Author:     Sergey Zolotarev <sryze at yandex.com>
AuthorDate: Mon Jan 13 17:28:16 2014 +0700
Commit:     Clinton Stimpson <clinton at elemtech.com>
CommitDate: Mon Jan 13 22:18:03 2014 -0700

    Remember variable type in Add Entry
    
    Store variable types together with their names in the variable completion
    list so that the type is automatically recovered when you select a variable.

diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx
index e7fedc5..aa79bbd 100644
--- a/Source/QtDialog/AddCacheEntry.cxx
+++ b/Source/QtDialog/AddCacheEntry.cxx
@@ -15,6 +15,7 @@
 #include <QCompleter>
 
 static const int NumTypes = 4;
+static const int DefaultTypeIndex = 0;
 static const QByteArray TypeStrings[NumTypes] =
   { "BOOL", "PATH", "FILEPATH", "STRING" };
 static const QCMakeProperty::PropertyType Types[NumTypes] =
@@ -43,7 +44,10 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& completions)
   this->setTabOrder(path, filepath);
   this->setTabOrder(filepath, string);
   this->setTabOrder(string, this->Description);
-  this->Name->setCompleter(new QCompleter(completions, this));
+  QCompleter *completer = new QCompleter(completions, this);
+  this->Name->setCompleter(completer);
+  connect(completer, SIGNAL(activated(const QString&)),
+          this, SLOT(onCompletionActivated(const QString&)));
 }
 
 QString AddCacheEntry::name() const
@@ -77,7 +81,32 @@ QCMakeProperty::PropertyType AddCacheEntry::type() const
     {
     return Types[idx];
     }
-  return QCMakeProperty::BOOL;
+  return Types[DefaultTypeIndex];
 }
 
+QString AddCacheEntry::typeString() const
+{
+  int idx = this->Type->currentIndex();
+  if(idx >= 0 && idx < NumTypes)
+    {
+    return TypeStrings[idx];
+    }
+  return TypeStrings[DefaultTypeIndex];
+}
 
+void AddCacheEntry::onCompletionActivated(const QString &text)
+{
+  int pos = text.lastIndexOf(':');
+  if (pos != -1)
+    {
+    QString type = text.mid(pos + 1, text.length() - pos).toUpper();
+    for (int i = 0; i < NumTypes; i++)
+      {
+        if (TypeStrings[i] == type)
+          {
+          this->Type->setCurrentIndex(i);
+          break;
+          }
+      }
+    }
+}
diff --git a/Source/QtDialog/AddCacheEntry.h b/Source/QtDialog/AddCacheEntry.h
index e219d4e..a491cec 100644
--- a/Source/QtDialog/AddCacheEntry.h
+++ b/Source/QtDialog/AddCacheEntry.h
@@ -30,6 +30,10 @@ public:
   QVariant value() const;
   QString description() const;
   QCMakeProperty::PropertyType type() const;
+  QString typeString() const;
+
+private slots:
+  void onCompletionActivated(const QString &text);
 };
 
 #endif
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 1903c02..3af69b0 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -71,7 +71,7 @@ CMakeSetupDialog::CMakeSetupDialog()
   restoreState(settings.value("windowState").toByteArray());
 
   this->AddVariableCompletions = settings.value("AddVariableCompletionEntries",
-                           QStringList("CMAKE_INSTALL_PREFIX")).toStringList();
+                      QStringList("CMAKE_INSTALL_PREFIX:PATH")).toStringList();
 
   QWidget* cont = new QWidget(this);
   this->setupUi(cont);
@@ -1066,16 +1066,18 @@ void CMakeSetupDialog::addCacheEntry()
     // only add variable names to the completion which are new
     if (!this->AddVariableCompletions.contains(w->name()))
       {
-      this->AddVariableCompletions << w->name();
+      this->AddVariableCompletions << QString("%1:%2").arg(w->name(),
+                                                           w->typeString());
       // limit to at most 100 completion items
       if (this->AddVariableCompletions.size() > 100)
         {
         this->AddVariableCompletions.removeFirst();
         }
       // make sure CMAKE_INSTALL_PREFIX is always there
-      if (!this->AddVariableCompletions.contains("CMAKE_INSTALL_PREFIX"))
+      if (!this->AddVariableCompletions.contains("CMAKE_INSTALL_PREFIX:PATH") &&
+          !this->AddVariableCompletions.contains("CMAKE_INSTALL_PREFIX"))
         {
-        this->AddVariableCompletions << QString("CMAKE_INSTALL_PREFIX");
+        this->AddVariableCompletions << QString("CMAKE_INSTALL_PREFIX:PATH");
         }
       QSettings settings;
       settings.beginGroup("Settings/StartPath");

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

Summary of changes:
 Source/QtDialog/AddCacheEntry.cxx    |   33 +++++++++++++++++++++++++++++++--
 Source/QtDialog/AddCacheEntry.h      |    4 ++++
 Source/QtDialog/CMakeSetupDialog.cxx |   10 ++++++----
 3 files changed, 41 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list