MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / onSaveProfile

Method onSaveProfile

Settings/ProfileConfigTab.cpp:1351–1382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1349}
1350
1351void
1352ProfileConfigTab::onSaveProfile(void)
1353{
1354 Suscan::Singleton *sus = Suscan::Singleton::get_instance();
1355 std::string name = "My " + this->profile.label();
1356 std::string candidate = name;
1357 unsigned int i = 1;
1358
1359 while (sus->getProfile(candidate) != nullptr)
1360 candidate = name + " (" + std::to_string(i++) + ")";
1361
1362 this->saveProfileDialog.setProfileName(QString::fromStdString(candidate));
1363
1364 if (this->saveProfileDialog.run()) {
1365 candidate = this->saveProfileDialog.getProfileName().toStdString();
1366
1367 if (sus->getProfile(candidate) != nullptr) {
1368 QMessageBox::warning(
1369 this,
1370 "Profile already exists",
1371 "There is already a profile named " +
1372 this->saveProfileDialog.getProfileName() +
1373 " please choose a different one.",
1374 QMessageBox::Ok);
1375 return;
1376 }
1377
1378 this->profile.setLabel(candidate);
1379 sus->saveProfile(this->profile);
1380 this->populateProfileCombo();
1381 }
1382}
1383
1384void
1385ProfileConfigTab::onChangeConnectionType(void)

Callers

nothing calls this directly

Calls 8

populateProfileComboMethod · 0.95
labelMethod · 0.80
setProfileNameMethod · 0.80
getProfileNameMethod · 0.80
setLabelMethod · 0.80
saveProfileMethod · 0.80
getProfileMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected