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 3102e2914eec3e34afb2e447ec1b47a3c5ad1902 (commit) via d5c68610c244a292a92034203c246f904be9324f (commit) from b3313b18fb2bf70af783f61201e730214692831b (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=3102e2914eec3e34afb2e447ec1b47a3c5ad1902 commit 3102e2914eec3e34afb2e447ec1b47a3c5ad1902 Merge: b3313b1 d5c6861 Author: Clinton Stimpson <clin...@elemtech.com> AuthorDate: Tue Jan 14 17:08:06 2014 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Tue Jan 14 17:08:06 2014 -0500 Merge topic 'var-type-autofill' into next d5c68610 Keep variable names and types in separate lists http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d5c68610c244a292a92034203c246f904be9324f commit d5c68610c244a292a92034203c246f904be9324f Author: Sergey Zolotarev <sr...@yandex.com> AuthorDate: Tue Jan 14 01:59:37 2014 +0700 Commit: Clinton Stimpson <clin...@elemtech.com> CommitDate: Tue Jan 14 15:06:37 2014 -0700 Keep variable names and types in separate lists This removes the :TYPE string from completion list and the Name field and makes variable search easier. The variable names and types are now kept in two different settings - AddVariableNames and AddVariableTypes. The old AddVariableCompletionEntries setting is ignored. diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx index aa79bbd..68635d8 100644 --- a/Source/QtDialog/AddCacheEntry.cxx +++ b/Source/QtDialog/AddCacheEntry.cxx @@ -22,8 +22,9 @@ static const QCMakeProperty::PropertyType Types[NumTypes] = { QCMakeProperty::BOOL, QCMakeProperty::PATH, QCMakeProperty::FILEPATH, QCMakeProperty::STRING}; -AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& completions) - : QWidget(p) +AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames, + const QStringList& varTypes) + : QWidget(p), VarNames(varNames), VarTypes(varTypes) { this->setupUi(this); for(int i=0; i<NumTypes; i++) @@ -44,7 +45,7 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& completions) this->setTabOrder(path, filepath); this->setTabOrder(filepath, string); this->setTabOrder(string, this->Description); - QCompleter *completer = new QCompleter(completions, this); + QCompleter *completer = new QCompleter(this->VarNames, this); this->Name->setCompleter(completer); connect(completer, SIGNAL(activated(const QString&)), this, SLOT(onCompletionActivated(const QString&))); @@ -96,10 +97,10 @@ QString AddCacheEntry::typeString() const void AddCacheEntry::onCompletionActivated(const QString &text) { - int pos = text.lastIndexOf(':'); - if (pos != -1) + int idx = this->VarNames.indexOf(text); + if (idx != -1) { - QString type = text.mid(pos + 1, text.length() - pos).toUpper(); + QString type = this->VarTypes[idx]; for (int i = 0; i < NumTypes; i++) { if (TypeStrings[i] == type) diff --git a/Source/QtDialog/AddCacheEntry.h b/Source/QtDialog/AddCacheEntry.h index a491cec..38c3a74 100644 --- a/Source/QtDialog/AddCacheEntry.h +++ b/Source/QtDialog/AddCacheEntry.h @@ -24,7 +24,8 @@ class AddCacheEntry : public QWidget, public Ui::AddCacheEntry { Q_OBJECT public: - AddCacheEntry(QWidget* p, const QStringList& completions); + AddCacheEntry(QWidget* p, const QStringList& varNames, + const QStringList& varTypes); QString name() const; QVariant value() const; @@ -34,6 +35,10 @@ public: private slots: void onCompletionActivated(const QString &text); + +private: + const QStringList& VarNames; + const QStringList& VarTypes; }; #endif diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 3af69b0..f62afd6 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -70,8 +70,10 @@ CMakeSetupDialog::CMakeSetupDialog() restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("windowState").toByteArray()); - this->AddVariableCompletions = settings.value("AddVariableCompletionEntries", - QStringList("CMAKE_INSTALL_PREFIX:PATH")).toStringList(); + this->AddVariableNames = settings.value("AddVariableNames", + QStringList("CMAKE_INSTALL_PREFIX")).toStringList(); + this->AddVariableTypes = settings.value("AddVariableTypes", + QStringList("PATH")).toStringList(); QWidget* cont = new QWidget(this); this->setupUi(cont); @@ -1049,7 +1051,8 @@ void CMakeSetupDialog::addCacheEntry() dialog.resize(400, 200); dialog.setWindowTitle(tr("Add Cache Entry")); QVBoxLayout* l = new QVBoxLayout(&dialog); - AddCacheEntry* w = new AddCacheEntry(&dialog, this->AddVariableCompletions); + AddCacheEntry* w = new AddCacheEntry(&dialog, this->AddVariableNames, + this->AddVariableTypes); QDialogButtonBox* btns = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog); @@ -1064,25 +1067,26 @@ void CMakeSetupDialog::addCacheEntry() m->insertProperty(w->type(), w->name(), w->description(), w->value(), false); // only add variable names to the completion which are new - if (!this->AddVariableCompletions.contains(w->name())) + if (!this->AddVariableNames.contains(w->name())) { - this->AddVariableCompletions << QString("%1:%2").arg(w->name(), - w->typeString()); + this->AddVariableNames << w->name(); + this->AddVariableTypes << w->typeString(); // limit to at most 100 completion items - if (this->AddVariableCompletions.size() > 100) + if (this->AddVariableNames.size() > 100) { - this->AddVariableCompletions.removeFirst(); + this->AddVariableNames.removeFirst(); + this->AddVariableTypes.removeFirst(); } // make sure CMAKE_INSTALL_PREFIX is always there - if (!this->AddVariableCompletions.contains("CMAKE_INSTALL_PREFIX:PATH") && - !this->AddVariableCompletions.contains("CMAKE_INSTALL_PREFIX")) + if (!this->AddVariableNames.contains("CMAKE_INSTALL_PREFIX")) { - this->AddVariableCompletions << QString("CMAKE_INSTALL_PREFIX:PATH"); + this->AddVariableNames << "CMAKE_INSTALL_PREFIX"; + this->AddVariableTypes << "PATH"; } QSettings settings; settings.beginGroup("Settings/StartPath"); - settings.setValue("AddVariableCompletionEntries", - this->AddVariableCompletions); + settings.setValue("AddVariableNames", this->AddVariableNames); + settings.setValue("AddVariableTypes", this->AddVariableTypes); } } } diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 963c7d1..1b26c64 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -110,7 +110,8 @@ protected: QTextCharFormat ErrorFormat; QTextCharFormat MessageFormat; - QStringList AddVariableCompletions; + QStringList AddVariableNames; + QStringList AddVariableTypes; QStringList FindHistory; QEventLoop LocalLoop; ----------------------------------------------------------------------- Summary of changes: Source/QtDialog/AddCacheEntry.cxx | 13 +++++++------ Source/QtDialog/AddCacheEntry.h | 7 ++++++- Source/QtDialog/CMakeSetupDialog.cxx | 30 +++++++++++++++++------------- Source/QtDialog/CMakeSetupDialog.h | 3 ++- 4 files changed, 32 insertions(+), 21 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits