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

Method updateContent

src/frontend/datasources/ImportFileWidget.cpp:2188–2278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2186}
2187
2188void ImportFileWidget::updateContent(const QString& fileName) {
2189 DEBUG(Q_FUNC_INFO << ", file name = " << STDSTRING(fileName));
2190
2191 if (m_suppressRefresh)
2192 return;
2193
2194 QApplication::processEvents(QEventLoop::AllEvents, 0);
2195 WAIT_CURSOR;
2196 CleanupNoArguments cleanup([] () {
2197 RESET_CURSOR;
2198 });
2199
2200 if (auto filter = currentFileFilter()) {
2201 switch (filter->type()) {
2202 case AbstractFileFilter::FileType::HDF5: {
2203 int status = m_hdf5OptionsWidget->updateContent(static_cast<HDF5Filter*>(filter), fileName);
2204 if (status != 0) { // parsing failed: switch to binary filter
2205 ui.cbFileType->setCurrentIndex(ui.cbFileType->findData(static_cast<int>(AbstractFileFilter::FileType::Binary)));
2206 Q_EMIT error(i18n("Not a HDF5 file: %1", fileName));
2207 }
2208 break;
2209 }
2210 case AbstractFileFilter::FileType::NETCDF:
2211 // TODO: check status (see HDF5)
2212 m_netcdfOptionsWidget->updateContent(static_cast<NetCDFFilter*>(filter), fileName);
2213 break;
2214 // case AbstractFileFilter::FileType::VECTOR_BLF:
2215 // m_vectorBLFOptionsWidget->updateContent(static_cast<VectorBLFFilter*>(filter), fileName);
2216 // break;
2217 case AbstractFileFilter::FileType::FITS:
2218#ifdef HAVE_FITS
2219 // TODO: check status (see HDF5)
2220 m_fitsOptionsWidget->updateContent(static_cast<FITSFilter*>(filter), fileName);
2221#endif
2222 break;
2223 case AbstractFileFilter::FileType::ROOT:
2224 // TODO: check status (see HDF5)
2225 m_rootOptionsWidget->updateContent(static_cast<ROOTFilter*>(filter), fileName);
2226 break;
2227 case AbstractFileFilter::FileType::JSON:
2228 m_jsonOptionsWidget->loadDocument(fileName);
2229 ui.tvJson->setExpanded(m_jsonOptionsWidget->model()->index(0, 0), true); // expand the root node
2230 break;
2231 case AbstractFileFilter::FileType::MCAP: {
2232#ifdef HAVE_MCAP
2233 DEBUG(Q_FUNC_INFO << "loadDocument, file name = " << STDSTRING(fileName));
2234 auto* mcap_filter = static_cast<McapFilter*>(filter);
2235
2236 if (!mcapTopicsInitialized) {
2237 ui.cbMcapTopics->clear();
2238 const auto& mcapTopics = mcap_filter->getValidTopics(fileName);
2239 for (int i = 0; i < mcapTopics.size(); i++)
2240 ui.cbMcapTopics->addItem(mcapTopics.at(i));
2241 mcapTopicsInitialized = true;
2242 }
2243
2244 const auto& currentMcapTopic = ui.cbMcapTopics->currentText();
2245 DEBUG("Current selected topic" << STDSTRING(currentMcapTopic));

Callers

nothing calls this directly

Calls 10

loadDocumentMethod · 0.80
getValidTopicsMethod · 0.80
currentTextMethod · 0.80
setCurrentTopicMethod · 0.80
typeMethod · 0.45
setCurrentIndexMethod · 0.45
indexMethod · 0.45
modelMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected