diff options
author | Sergey Zolotarev <sryze@yandex.com> | 2014-01-13 10:28:16 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-01-16 14:23:36 (GMT) |
commit | cfec180d66a7210606c5274e6ba3bb86a1e197a7 (patch) | |
tree | ed13abe0f993ac2b9e204da65d5e7c1e892e9e24 /Source/QtDialog/CMakeSetupDialog.cxx | |
parent | 9f6b633f37bebecc989cc8fc026da999148038f9 (diff) | |
download | CMake-cfec180d66a7210606c5274e6ba3bb86a1e197a7.zip CMake-cfec180d66a7210606c5274e6ba3bb86a1e197a7.tar.gz CMake-cfec180d66a7210606c5274e6ba3bb86a1e197a7.tar.bz2 |
cmake-gui: 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.
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. Drop the old
AddVariableCompletionEntries setting.
Diffstat (limited to 'Source/QtDialog/CMakeSetupDialog.cxx')
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 1903c02..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", + 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,23 +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 << w->name(); + 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")) + if (!this->AddVariableNames.contains("CMAKE_INSTALL_PREFIX")) { - this->AddVariableCompletions << QString("CMAKE_INSTALL_PREFIX"); + 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); } } } |