| 290 | } |
| 291 | |
| 292 | void MainWindow::showResult(QListWidgetItem *item) |
| 293 | { |
| 294 | ui->statusBar->clearMessage(); |
| 295 | const bool local = item->text().startsWith(DACA2_PACKAGES); |
| 296 | if (!item->text().startsWith("ftp://") && !item->text().startsWith("https://") && !local) |
| 297 | return; |
| 298 | const QStringList lines = item->text().split("\n"); |
| 299 | if (lines.size() < 2) |
| 300 | return; |
| 301 | const QString &url = lines[0]; |
| 302 | QString msg = lines[1]; |
| 303 | if (!local) { |
| 304 | const QRegularExpressionMatch matchRes = mVersionRe.match(msg); |
| 305 | if (matchRes.hasMatch()) |
| 306 | msg = matchRes.captured(2); |
| 307 | } |
| 308 | const QString archiveName = url.mid(url.lastIndexOf("/") + 1); |
| 309 | const int pos1 = msg.indexOf(":"); |
| 310 | const int pos2 = msg.indexOf(":", pos1+1); |
| 311 | const QString fileName = WORK_FOLDER + '/' + msg.left(msg.indexOf(":")); |
| 312 | const int lineNumber = msg.mid(pos1+1, pos2-pos1-1).toInt(); |
| 313 | |
| 314 | if (!QFileInfo::exists(fileName)) { |
| 315 | const QString daca2archiveFile {DACA2_PACKAGES + '/' + archiveName.mid(0,archiveName.indexOf(".tar.")) + ".tar.xz"}; |
| 316 | if (QFileInfo::exists(daca2archiveFile)) { |
| 317 | if (!unpackArchive(daca2archiveFile)) |
| 318 | return; |
| 319 | } else if (!local) { |
| 320 | const QString archiveFullPath {WORK_FOLDER + '/' + archiveName}; |
| 321 | if (!QFileInfo::exists(archiveFullPath)) { |
| 322 | // Download archive |
| 323 | if (!wget(url)) |
| 324 | return; |
| 325 | } |
| 326 | if (!unpackArchive(archiveFullPath)) |
| 327 | return; |
| 328 | } |
| 329 | } |
| 330 | showSrcFile(fileName, url, lineNumber); |
| 331 | } |
| 332 | |
| 333 | void MainWindow::showSrcFile(const QString &fileName, const QString &url, const int lineNumber) |
| 334 | { |
nothing calls this directly
no test coverage detected