| 1349 | } |
| 1350 | |
| 1351 | void |
| 1352 | ProfileConfigTab::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 | |
| 1384 | void |
| 1385 | ProfileConfigTab::onChangeConnectionType(void) |
nothing calls this directly
no test coverage detected