| 1421 | } |
| 1422 | |
| 1423 | void |
| 1424 | ProfileConfigTab::onRemoteProfileSelected(void) |
| 1425 | { |
| 1426 | Suscan::Singleton *sus = Suscan::Singleton::get_instance(); |
| 1427 | |
| 1428 | if (this->ui->useNetworkProfileRadio->isChecked()) { |
| 1429 | QHash<QString, Suscan::Source::Config>::const_iterator it; |
| 1430 | std::string user, pass, mc, mc_if; |
| 1431 | bool hasMc; |
| 1432 | |
| 1433 | // Save multicast config |
| 1434 | hasMc = this->ui->mcCheck->isChecked(); |
| 1435 | mc_if = this->ui->mcInterfaceEdit->text().toStdString(); |
| 1436 | |
| 1437 | it = sus->getNetworkProfileFrom(this->ui->remoteDeviceCombo->currentText()); |
| 1438 | |
| 1439 | if (it != sus->getLastNetworkProfile()) { |
| 1440 | user = it->getParam("user"); |
| 1441 | pass = it->getParam("password"); |
| 1442 | |
| 1443 | if (user.length() == 0) |
| 1444 | user = this->ui->userEdit->text().toStdString(); |
| 1445 | if (user.length() == 0) |
| 1446 | user = "anonymous"; |
| 1447 | |
| 1448 | if (pass.length() == 0) |
| 1449 | pass = this->ui->passEdit->text().toStdString(); |
| 1450 | |
| 1451 | this->configChanged(true); |
| 1452 | this->setProfile(*it); |
| 1453 | |
| 1454 | // Provide a better hint for username if the server announced none |
| 1455 | this->ui->userEdit->setText(user.c_str()); |
| 1456 | this->ui->passEdit->setText(pass.c_str()); |
| 1457 | |
| 1458 | // Restore mc config |
| 1459 | this->ui->mcCheck->setChecked(hasMc); |
| 1460 | this->ui->mcInterfaceEdit->setText(mc_if.c_str()); |
| 1461 | this->ui->mcInterfaceEdit->setEnabled(hasMc); |
| 1462 | |
| 1463 | this->onRemoteParamsChanged(); |
| 1464 | } |
| 1465 | } |
| 1466 | } |
| 1467 | |
| 1468 | void |
| 1469 | ProfileConfigTab::onChangeSourceTimeUTC(void) |
no test coverage detected