Changeset View
Changeset View
Standalone View
Standalone View
src/kdefrontend/datasources/NetCDFOptionsWidget.cpp
Show All 23 Lines | |||||
24 | * Boston, MA 02110-1301 USA * | 24 | * Boston, MA 02110-1301 USA * | ||
25 | * * | 25 | * * | ||
26 | ***************************************************************************/ | 26 | ***************************************************************************/ | ||
27 | #include "NetCDFOptionsWidget.h" | 27 | #include "NetCDFOptionsWidget.h" | ||
28 | #include "ImportFileWidget.h" | 28 | #include "ImportFileWidget.h" | ||
29 | #include "backend/datasources/filters/NetCDFFilter.h" | 29 | #include "backend/datasources/filters/NetCDFFilter.h" | ||
30 | #include "backend/lib/macros.h" | 30 | #include "backend/lib/macros.h" | ||
31 | 31 | | |||
32 | #include <KUrlComboBox> | ||||
33 | | ||||
32 | /*! | 34 | /*! | ||
33 | \class NetCDFOptionsWidget | 35 | \class NetCDFOptionsWidget | ||
34 | \brief Widget providing options for the import of NetCDF data | 36 | \brief Widget providing options for the import of NetCDF data | ||
35 | 37 | | |||
36 | \ingroup kdefrontend | 38 | \ingroup kdefrontend | ||
37 | */ | 39 | */ | ||
38 | NetCDFOptionsWidget::NetCDFOptionsWidget(QWidget* parent, ImportFileWidget* fileWidget) | 40 | NetCDFOptionsWidget::NetCDFOptionsWidget(QWidget* parent, ImportFileWidget* fileWidget) | ||
39 | : QWidget(parent), m_fileWidget(fileWidget) { | 41 | : QWidget(parent), m_fileWidget(fileWidget) { | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 83 | if (ui.twContent->selectedItems().isEmpty()) | |||
82 | return; | 84 | return; | ||
83 | 85 | | |||
84 | QTreeWidgetItem* item = ui.twContent->selectedItems().first(); | 86 | QTreeWidgetItem* item = ui.twContent->selectedItems().first(); | ||
85 | if (item->data(1, Qt::DisplayRole).toString() == "variable") | 87 | if (item->data(1, Qt::DisplayRole).toString() == "variable") | ||
86 | m_fileWidget->refreshPreview(); | 88 | m_fileWidget->refreshPreview(); | ||
87 | else if (item->data(1, Qt::DisplayRole).toString().contains("attribute")) { | 89 | else if (item->data(1, Qt::DisplayRole).toString().contains("attribute")) { | ||
88 | // reads attributes (only for preview) | 90 | // reads attributes (only for preview) | ||
89 | auto filter = static_cast<NetCDFFilter*>(m_fileWidget->currentFileFilter()); | 91 | auto filter = static_cast<NetCDFFilter*>(m_fileWidget->currentFileFilter()); | ||
90 | QString fileName = m_fileWidget->ui.leFileName->text(); | 92 | QString fileName = m_fileWidget->m_cbFileName->currentText(); | ||
91 | QString name = item->data(0, Qt::DisplayRole).toString(); | 93 | QString name = item->data(0, Qt::DisplayRole).toString(); | ||
92 | QString varName = item->data(1, Qt::DisplayRole).toString().split(' ')[0]; | 94 | QString varName = item->data(1, Qt::DisplayRole).toString().split(' ')[0]; | ||
93 | QDEBUG("name =" << name << "varName =" << varName); | 95 | QDEBUG("name =" << name << "varName =" << varName); | ||
94 | 96 | | |||
95 | QString importedText = filter->readAttribute(fileName, name, varName); | 97 | QString importedText = filter->readAttribute(fileName, name, varName); | ||
96 | DEBUG("importedText =" << importedText.toStdString()); | 98 | DEBUG("importedText =" << importedText.toStdString()); | ||
97 | 99 | | |||
98 | QStringList lineStrings = importedText.split('\n'); | 100 | QStringList lineStrings = importedText.split('\n'); | ||
Show All 36 Lines |