return full path of file name and [extension] appended
| 122 | |
| 123 | // return full path of file name and [extension] appended |
| 124 | const QString FITSOptionsWidget::extensionName(bool* ok) { |
| 125 | const auto* item = ui.twExtensions->currentItem(); |
| 126 | if (!item) |
| 127 | return {}; |
| 128 | |
| 129 | const int currentColumn = ui.twExtensions->currentColumn(); |
| 130 | QString itemText = item->text(currentColumn); |
| 131 | QDEBUG(Q_FUNC_INFO << ", item text:" << itemText) |
| 132 | |
| 133 | ExtensionType extType = ExtensionType::UNKNOWN; |
| 134 | if (itemText.contains(QLatin1String("IMAGE #")) || itemText.contains(QLatin1String("ASCII_TBL #")) || itemText.contains(QLatin1String("BINARY_TBL #"))) |
| 135 | extType = ExtensionType::IMAGE_OR_TBL; |
| 136 | else if (!itemText.compare(QLatin1String("Primary header"))) |
| 137 | extType = ExtensionType::PRIMARY; |
| 138 | //DEBUG(Q_FUNC_INFO << ", extension type:" << extType) |
| 139 | |
| 140 | switch (extType) { |
| 141 | case ExtensionType::UNKNOWN: |
| 142 | return itemText; |
| 143 | case ExtensionType::IMAGE_OR_TBL: { |
| 144 | int hduNum = itemText.right(1).toInt(ok); |
| 145 | return QString::number(hduNum - 1); |
| 146 | } |
| 147 | case ExtensionType::PRIMARY: |
| 148 | break; |
| 149 | } |
| 150 | |
| 151 | return {}; |
| 152 | } |
no test coverage detected