file type specific option widgets
| 1409 | |
| 1410 | // file type specific option widgets |
| 1411 | void ImportFileWidget::initOptionsWidget() { |
| 1412 | DEBUG(Q_FUNC_INFO << ", for " << ENUM_TO_STRING(AbstractFileFilter, FileType, currentFileType())); |
| 1413 | switch (currentFileType()) { |
| 1414 | case AbstractFileFilter::FileType::Ascii: { |
| 1415 | if (!m_asciiOptionsWidget) { |
| 1416 | auto* asciiw = new QWidget(); |
| 1417 | m_asciiOptionsWidget = std::unique_ptr<AsciiOptionsWidget>(new AsciiOptionsWidget(asciiw, m_liveDataSource)); |
| 1418 | m_asciiOptionsWidget->loadSettings(); |
| 1419 | |
| 1420 | // allow to add timestamp column for live data sources |
| 1421 | if (m_liveDataSource) { |
| 1422 | m_asciiOptionsWidget->showTimestampOptions(true); |
| 1423 | } |
| 1424 | ui.swOptions->addWidget(asciiw); |
| 1425 | } |
| 1426 | |
| 1427 | ui.swOptions->setCurrentWidget(m_asciiOptionsWidget->parentWidget()); |
| 1428 | break; |
| 1429 | } |
| 1430 | case AbstractFileFilter::FileType::Binary: |
| 1431 | if (!m_binaryOptionsWidget) { |
| 1432 | auto* binaryw = new QWidget(); |
| 1433 | m_binaryOptionsWidget = std::unique_ptr<BinaryOptionsWidget>(new BinaryOptionsWidget(binaryw)); |
| 1434 | ui.swOptions->addWidget(binaryw); |
| 1435 | m_binaryOptionsWidget->loadSettings(); |
| 1436 | } |
| 1437 | ui.swOptions->setCurrentWidget(m_binaryOptionsWidget->parentWidget()); |
| 1438 | break; |
| 1439 | case AbstractFileFilter::FileType::Image: |
| 1440 | if (!m_imageOptionsWidget) { |
| 1441 | auto* imagew = new QWidget(); |
| 1442 | m_imageOptionsWidget = std::unique_ptr<ImageOptionsWidget>(new ImageOptionsWidget(imagew)); |
| 1443 | ui.swOptions->addWidget(imagew); |
| 1444 | m_imageOptionsWidget->loadSettings(); |
| 1445 | } |
| 1446 | ui.swOptions->setCurrentWidget(m_imageOptionsWidget->parentWidget()); |
| 1447 | break; |
| 1448 | case AbstractFileFilter::FileType::XLSX: |
| 1449 | if (!m_xlsxOptionsWidget) { |
| 1450 | QWidget* xlsxw = new QWidget(); |
| 1451 | m_xlsxOptionsWidget = std::unique_ptr<XLSXOptionsWidget>(new XLSXOptionsWidget(xlsxw, this)); |
| 1452 | ui.swOptions->addWidget(xlsxw); |
| 1453 | connect(dynamic_cast<XLSXOptionsWidget*>(m_xlsxOptionsWidget.get()), |
| 1454 | &XLSXOptionsWidget::enableDataPortionSelection, |
| 1455 | this, |
| 1456 | &ImportFileWidget::enableDataPortionSelection); |
| 1457 | } |
| 1458 | ui.swOptions->setCurrentWidget(m_xlsxOptionsWidget->parentWidget()); |
| 1459 | break; |
| 1460 | case AbstractFileFilter::FileType::Ods: |
| 1461 | if (!m_odsOptionsWidget) { |
| 1462 | QWidget* odsw = new QWidget(); |
| 1463 | m_odsOptionsWidget = std::unique_ptr<OdsOptionsWidget>(new OdsOptionsWidget(odsw, this)); |
| 1464 | ui.swOptions->addWidget(odsw); |
| 1465 | connect(dynamic_cast<OdsOptionsWidget*>(m_odsOptionsWidget.get()), |
| 1466 | &OdsOptionsWidget::enableDataPortionSelection, |
| 1467 | this, |
| 1468 | &ImportFileWidget::enableDataPortionSelection); |
nothing calls this directly
no test coverage detected