| 348 | } |
| 349 | |
| 350 | void SettingsDialog::on_pushButtonFFMpegSelectFile_clicked() |
| 351 | { |
| 352 | QStringList newFiles = this->getLibraryPath( |
| 353 | ui.lineEditAVFormat->text(), |
| 354 | "Please select the 4 FFmpeg libraries AVCodec, AVFormat, AVUtil and SWResample.", |
| 355 | true); |
| 356 | if (newFiles.empty()) |
| 357 | return; |
| 358 | |
| 359 | // Get the 4 libraries from the list |
| 360 | QString avCodecLib, avFormatLib, avUtilLib, swResampleLib; |
| 361 | if (newFiles.count() == 4) |
| 362 | { |
| 363 | for (auto file : newFiles) |
| 364 | { |
| 365 | QFileInfo fileInfo(file); |
| 366 | if (fileInfo.baseName().contains("avcodec", Qt::CaseInsensitive)) |
| 367 | avCodecLib = file; |
| 368 | if (fileInfo.baseName().contains("avformat", Qt::CaseInsensitive)) |
| 369 | avFormatLib = file; |
| 370 | if (fileInfo.baseName().contains("avutil", Qt::CaseInsensitive)) |
| 371 | avUtilLib = file; |
| 372 | if (fileInfo.baseName().contains("swresample", Qt::CaseInsensitive)) |
| 373 | swResampleLib = file; |
| 374 | } |
| 375 | } |
| 376 | if (avCodecLib.isEmpty() || avFormatLib.isEmpty() || avUtilLib.isEmpty() || |
| 377 | swResampleLib.isEmpty()) |
| 378 | { |
| 379 | QMessageBox::critical( |
| 380 | this, |
| 381 | "Error in file selection", |
| 382 | "Please select the four FFmpeg files AVCodec, AVFormat, AVUtil and SWresample."); |
| 383 | return; |
| 384 | } |
| 385 | |
| 386 | // Try to open ffmpeg using the four libraries |
| 387 | QStringList logList; |
| 388 | if (!FFmpeg::FFmpegVersionHandler::checkLibraryFiles( |
| 389 | avCodecLib, avFormatLib, avUtilLib, swResampleLib, logList)) |
| 390 | { |
| 391 | QMessageBox::StandardButton b = QMessageBox::question( |
| 392 | this, |
| 393 | "Error opening the library", |
| 394 | "The selected file does not appear to be a usable ffmpeg avFormat library. \nWe have " |
| 395 | "collected a more detailed log. Do you want to save it to disk?"); |
| 396 | if (b == QMessageBox::Yes) |
| 397 | { |
| 398 | const auto filePath = |
| 399 | QFileDialog::getSaveFileName(this, "Select a destination for the log file."); |
| 400 | QFile logFile(filePath); |
| 401 | logFile.open(QIODevice::WriteOnly); |
| 402 | if (logFile.isOpen()) |
| 403 | { |
| 404 | QTextStream outputStream(&logFile); |
| 405 | for (auto l : logList) |
| 406 | outputStream << l << "\n"; |
| 407 | } |
nothing calls this directly
no test coverage detected