MCPcopy Create free account
hub / github.com/Kitware/CMake / addCacheEntry

Method addCacheEntry

Source/QtDialog/CMakeSetupDialog.cxx:1239–1281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1237}
1238
1239void CMakeSetupDialog::addCacheEntry()
1240{
1241 QDialog dialog(this);
1242 dialog.resize(400, 200);
1243 dialog.setWindowTitle(tr("Add Cache Entry"));
1244 QVBoxLayout* l = new QVBoxLayout(&dialog);
1245 AddCacheEntry* w =
1246 new AddCacheEntry(&dialog, this->AddVariableNames, this->AddVariableTypes);
1247 QDialogButtonBox* btns = new QDialogButtonBox(
1248 QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog);
1249 QObject::connect(btns, &QDialogButtonBox::accepted, &dialog,
1250 &QDialog::accept);
1251 QObject::connect(btns, &QDialogButtonBox::rejected, &dialog,
1252 &QDialog::reject);
1253 l->addWidget(w);
1254 l->addStretch();
1255 l->addWidget(btns);
1256 if (QDialog::Accepted == dialog.exec()) {
1257 QCMakeCacheModel* m = this->CacheValues->cacheModel();
1258 m->insertProperty(w->type(), w->name(), w->description(), w->value(),
1259 false);
1260
1261 // only add variable names to the completion which are new
1262 if (!this->AddVariableNames.contains(w->name())) {
1263 this->AddVariableNames << w->name();
1264 this->AddVariableTypes << w->typeString();
1265 // limit to at most 100 completion items
1266 if (this->AddVariableNames.size() > 100) {
1267 this->AddVariableNames.removeFirst();
1268 this->AddVariableTypes.removeFirst();
1269 }
1270 // make sure CMAKE_INSTALL_PREFIX is always there
1271 if (!this->AddVariableNames.contains("CMAKE_INSTALL_PREFIX")) {
1272 this->AddVariableNames << "CMAKE_INSTALL_PREFIX";
1273 this->AddVariableTypes << "PATH";
1274 }
1275 QSettings settings;
1276 settings.beginGroup("Settings/StartPath");
1277 settings.setValue("AddVariableNames", this->AddVariableNames);
1278 settings.setValue("AddVariableTypes", this->AddVariableTypes);
1279 }
1280 }
1281}
1282
1283void CMakeSetupDialog::startSearch()
1284{

Callers

nothing calls this directly

Calls 9

connectFunction · 0.85
descriptionMethod · 0.80
valueMethod · 0.80
typeStringMethod · 0.80
setValueMethod · 0.80
resizeMethod · 0.45
typeMethod · 0.45
nameMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected