! called when the output format was changed. Adjusts the extension for the specified file. */
| 417 | called when the output format was changed. Adjusts the extension for the specified file. |
| 418 | */ |
| 419 | void ExportSpreadsheetDialog::formatChanged(int index) { |
| 420 | QStringList extensions; |
| 421 | extensions << QStringLiteral(".txt") << QStringLiteral(".tex"); |
| 422 | #ifdef HAVE_FITS |
| 423 | extensions << QStringLiteral(".fits"); |
| 424 | #endif |
| 425 | #ifdef HAVE_QXLSX |
| 426 | extensions << QStringLiteral(".xlsx"); |
| 427 | #endif |
| 428 | extensions << QStringLiteral(".db"); |
| 429 | #ifdef HAVE_MCAP |
| 430 | extensions << QStringLiteral(".mcap"); // Todo: Order of suffixes matters |
| 431 | #endif |
| 432 | QString path = ui->leFileName->text(); |
| 433 | int i = path.indexOf(QLatin1Char('.')); |
| 434 | if (index != -1) { |
| 435 | if (i == -1) |
| 436 | path = path + extensions.at(index); |
| 437 | else |
| 438 | path = path.left(i) + extensions.at(index); |
| 439 | } |
| 440 | |
| 441 | const auto format = static_cast<Format>(ui->cbFormat->currentData().toInt()); |
| 442 | QString extension; |
| 443 | switch (format) { |
| 444 | case Format::LaTeX: |
| 445 | extension = QStringLiteral(".tex"); |
| 446 | ui->cbSeparator->hide(); |
| 447 | ui->lSeparator->hide(); |
| 448 | ui->lDecimalSeparator->hide(); |
| 449 | ui->cbDecimalSeparator->hide(); |
| 450 | |
| 451 | ui->chkCaptions->show(); |
| 452 | ui->chkGridLines->show(); |
| 453 | ui->lExportArea->show(); |
| 454 | ui->lGridLines->show(); |
| 455 | ui->lCaptions->show(); |
| 456 | ui->cbLaTeXExport->show(); |
| 457 | |
| 458 | if (!m_matrixMode) { |
| 459 | ui->lHeader->show(); |
| 460 | ui->chkHeaders->show(); |
| 461 | ui->lEmptyRows->show(); |
| 462 | ui->chkEmptyRows->show(); |
| 463 | ui->lMatrixHHeader->hide(); |
| 464 | ui->lMatrixVHeader->hide(); |
| 465 | ui->chkMatrixHHeader->hide(); |
| 466 | ui->chkMatrixVHeader->hide(); |
| 467 | } else { |
| 468 | ui->lMatrixHHeader->show(); |
| 469 | ui->lMatrixVHeader->show(); |
| 470 | ui->chkMatrixHHeader->show(); |
| 471 | ui->chkMatrixVHeader->show(); |
| 472 | } |
| 473 | ui->cbExportToFITS->hide(); |
| 474 | ui->lExportToFITS->hide(); |
| 475 | ui->lColumnAsUnits->hide(); |
| 476 | ui->chkColumnsAsUnits->hide(); |
no test coverage detected