| 125 | } |
| 126 | |
| 127 | void frmConvert::checkFPSNeeded() { |
| 128 | bool fpsNeeded; |
| 129 | if (srcFormat.isEmpty() || targetFormat.isEmpty()) { |
| 130 | fpsNeeded = false; |
| 131 | } else { |
| 132 | QSharedPointer<const SubtitleFormat> srcSF = |
| 133 | subtitleFormatsRegistry->select(srcFormat); |
| 134 | QSharedPointer<const SubtitleFormat> targetSF = |
| 135 | subtitleFormatsRegistry->select(targetFormat); |
| 136 | fpsNeeded = (srcSF->isTimeBased() != targetSF->isTimeBased()) || |
| 137 | (ui.cbDelaySubtitles->isChecked() && !targetSF->isTimeBased()); |
| 138 | |
| 139 | QString targetDefaultExt = targetSF->defaultExtension(); |
| 140 | ui.cbTargetExtension->setItemText(0, |
| 141 | tr("Default (%1)").arg(targetDefaultExt)); |
| 142 | generateTargetFileName(); |
| 143 | } |
| 144 | |
| 145 | ui.cbMovieFPS->setEnabled(fpsNeeded); |
| 146 | ui.lbMovieFPS->setEnabled(fpsNeeded); |
| 147 | ui.pbMovieFPSSelect->setEnabled(fpsNeeded); |
| 148 | |
| 149 | if (fpsNeeded) { |
| 150 | QFileInfo srcSubFI(ui.leSrcSubFile->text()); |
| 151 | |
| 152 | QString movieFilePathBase = |
| 153 | srcSubFI.absolutePath() + "/" + srcSubFI.completeBaseName(); |
| 154 | |
| 155 | foreach (QString movieExt, staticConfig->movieExtensions()) { |
| 156 | QString movieFilePath = movieFilePathBase + "." + movieExt; |
| 157 | if (QFileInfo(movieFilePath).exists()) { |
| 158 | Maybe<QString> maybeFPS = determineMovieFPS(movieFilePath); |
| 159 | if (maybeFPS) { |
| 160 | ui.cbMovieFPS->setCurrentText(maybeFPS.value()); |
| 161 | ui.cbFPSTo->setCurrentText(maybeFPS.value()); |
| 162 | } |
| 163 | break; |
| 164 | } |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | void frmConvert::movieFPSSelectClicked() { |
| 170 | QNapiOpenDialog openMovie(this, tr("Select a video file"), |
nothing calls this directly
no test coverage detected