| 290 | } |
| 291 | |
| 292 | void |
| 293 | TLESourceTab::onAddTLESource(void) |
| 294 | { |
| 295 | if (this->addDialog->run()) { |
| 296 | auto sus = Suscan::Singleton::get_instance(); |
| 297 | Suscan::TLESource src = this->addDialog->getTLESource(); |
| 298 | if (sus->registerTLESource(src)) { |
| 299 | int index = this->ui->tleSourceTable->rowCount(); |
| 300 | this->ui->tleSourceTable->insertRow(index); |
| 301 | this->ui->tleSourceTable->setItem( |
| 302 | index, |
| 303 | 0, |
| 304 | new QTableWidgetItem(QString::fromStdString(src.name))); |
| 305 | |
| 306 | this->ui->tleSourceTable->setItem( |
| 307 | index, |
| 308 | 1, |
| 309 | new QTableWidgetItem(QString::fromStdString(src.url))); |
| 310 | |
| 311 | this->ui->tleSourceTable->resizeColumnToContents(0); |
| 312 | this->ui->tleSourceTable->horizontalHeader()->setStretchLastSection(true); |
| 313 | this->ui->tleSourceTable->scrollToBottom(); |
| 314 | this->refreshUi(); |
| 315 | } else { |
| 316 | QMessageBox::warning( |
| 317 | this, |
| 318 | "There is another source named " + QString::fromStdString(src.name) |
| 319 | + ". please choose a different name.", |
| 320 | "Add TLE source"); |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | void |
| 326 | TLESourceTab::onRemoveTLESource(void) |
nothing calls this directly
no test coverage detected