summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog/CMakeSetupDialog.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-12-07 21:29:13 (GMT)
committerDavid Cole <david.cole@kitware.com>2011-12-07 21:29:13 (GMT)
commit2d1195123ec85ffd04b415914cc5127db918d2c9 (patch)
tree7a05a915e9599c1596aa220ad620c965abe3902b /Source/QtDialog/CMakeSetupDialog.cxx
parent1eca18fd522575126b4d1e4faa3c9437d2f12e22 (diff)
parent9f18f64c7cfe57df96b6c2cd19d383f9532b6827 (diff)
downloadCMake-2d1195123ec85ffd04b415914cc5127db918d2c9.zip
CMake-2d1195123ec85ffd04b415914cc5127db918d2c9.tar.gz
CMake-2d1195123ec85ffd04b415914cc5127db918d2c9.tar.bz2
Merge branch 'master' into AutomocIncludedDotMocFileHandling
Conflicts: Source/cmTarget.cxx
Diffstat (limited to 'Source/QtDialog/CMakeSetupDialog.cxx')
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx25
1 files changed, 24 insertions, 1 deletions
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index c8c4bfa..1c058d3 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -68,6 +68,9 @@ CMakeSetupDialog::CMakeSetupDialog()
int w = settings.value("Width", 700).toInt();
this->resize(w, h);
+ this->AddVariableCompletions = settings.value("AddVariableCompletionEntries",
+ QStringList("CMAKE_INSTALL_PREFIX")).toStringList();
+
QWidget* cont = new QWidget(this);
this->setupUi(cont);
this->Splitter->setStretchFactor(0, 3);
@@ -1008,7 +1011,7 @@ void CMakeSetupDialog::addCacheEntry()
dialog.resize(400, 200);
dialog.setWindowTitle(tr("Add Cache Entry"));
QVBoxLayout* l = new QVBoxLayout(&dialog);
- AddCacheEntry* w = new AddCacheEntry(&dialog);
+ AddCacheEntry* w = new AddCacheEntry(&dialog, this->AddVariableCompletions);
QDialogButtonBox* btns = new QDialogButtonBox(
QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, &dialog);
@@ -1021,6 +1024,26 @@ void CMakeSetupDialog::addCacheEntry()
{
QCMakeCacheModel* m = this->CacheValues->cacheModel();
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()))
+ {
+ this->AddVariableCompletions << w->name();
+ // 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"))
+ {
+ this->AddVariableCompletions << QString("CMAKE_INSTALL_PREFIX");
+ }
+ QSettings settings;
+ settings.beginGroup("Settings/StartPath");
+ settings.setValue("AddVariableCompletionEntries",
+ this->AddVariableCompletions);
+ }
}
}