* @brief Handles a dataset being clicked in the dataset section of the WelcomeScreen. * Initiates listing information about the dataset in the previously mentioned section. * * @param category the category the dataset belongs to * @param subcategory the subcategory the dataset belongs to * @param datasetName the name of the dataset */
| 108 | * @param datasetName the name of the dataset |
| 109 | */ |
| 110 | void WelcomeScreenHelper::datasetClicked(const QString& category, const QString& subcategory, const QString& datasetName) { |
| 111 | m_datasetWidget->setCollection("All"); |
| 112 | m_datasetWidget->setCategory(category); |
| 113 | m_datasetWidget->setSubcategory(subcategory); |
| 114 | m_datasetWidget->setDataset(datasetName); |
| 115 | m_spreadsheet.reset(new Spreadsheet(i18n("Dataset%1", 1))); |
| 116 | |
| 117 | if (m_datasetHandler) |
| 118 | delete m_datasetHandler; |
| 119 | m_datasetHandler = new DatasetHandler(m_spreadsheet.get()); |
| 120 | |
| 121 | m_datasetWidget->import(m_datasetHandler); |
| 122 | |
| 123 | QTimer timer; |
| 124 | timer.setSingleShot(true); |
| 125 | QEventLoop loop; |
| 126 | connect(m_datasetHandler, &DatasetHandler::downloadCompleted, &loop, &QEventLoop::quit); |
| 127 | connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); |
| 128 | timer.start(1500); |
| 129 | loop.exec(); |
| 130 | |
| 131 | if (timer.isActive()) { |
| 132 | timer.stop(); |
| 133 | Q_EMIT datasetFound(); |
| 134 | } else |
| 135 | Q_EMIT datasetNotFound(); |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * @brief Returns the dataset's full name. |
nothing calls this directly
no test coverage detected