MCPcopy Create free account
hub / github.com/KDE/labplot / extensionName

Method extensionName

src/frontend/datasources/FITSOptionsWidget.cpp:124–152  ·  view source on GitHub ↗

return full path of file name and [extension] appended

Source from the content-addressed store, hash-verified

122
123// return full path of file name and [extension] appended
124const 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}

Callers 1

currentFileFilterMethod · 0.80

Calls 3

currentItemMethod · 0.80
textMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected