| 25 | #include <QSharedPointer> |
| 26 | |
| 27 | frmConvert::frmConvert(QWidget *parent, Qt::WindowFlags f) |
| 28 | : QDialog(parent, f), |
| 29 | staticConfig(LibQNapi::staticConfig()), |
| 30 | ppConfig(LibQNapi::loadConfig().postProcessingConfig()), |
| 31 | subtitleFormatsRegistry(LibQNapi::subtitleFormatsRegistry()), |
| 32 | subConverter(subtitleFormatsRegistry, LibQNapi::movieInfoProvider(), |
| 33 | ppConfig.skipConvertAds()), |
| 34 | targetFileNameSelected(false) { |
| 35 | ui.setupUi(this); |
| 36 | |
| 37 | setAttribute(Qt::WA_QuitOnClose, false); |
| 38 | |
| 39 | QRect position = frameGeometry(); |
| 40 | position.moveCenter(QDesktopWidget().availableGeometry().center()); |
| 41 | move(position.topLeft()); |
| 42 | |
| 43 | ui.lbDetectedFormatValue->setText(""); |
| 44 | |
| 45 | ui.cbTargetFormat->clear(); |
| 46 | foreach (QString format, subtitleFormatsRegistry->listFormatNames()) { |
| 47 | ui.cbTargetFormat->addItem(format); |
| 48 | } |
| 49 | |
| 50 | connect(ui.pbSrcSubFileSelect, SIGNAL(clicked()), this, |
| 51 | SLOT(srcSubSelectClicked())); |
| 52 | connect(ui.leSrcSubFile, SIGNAL(textChanged(const QString &)), this, |
| 53 | SLOT(srcSubFileLoaded(const QString &))); |
| 54 | connect(ui.cbTargetFormat, SIGNAL(currentIndexChanged(int)), this, |
| 55 | SLOT(targetFormatChanged(int))); |
| 56 | connect(ui.cbTargetExtension, SIGNAL(currentIndexChanged(int)), this, |
| 57 | SLOT(targetExtensionChanged())); |
| 58 | connect(ui.pbMovieFPSSelect, SIGNAL(clicked()), this, |
| 59 | SLOT(movieFPSSelectClicked())); |
| 60 | connect(ui.pbTargetMovieFPSSelect, SIGNAL(clicked()), this, |
| 61 | SLOT(targetMovieFPSSelectClicked())); |
| 62 | connect(ui.cbDelaySubtitles, SIGNAL(toggled(bool)), this, |
| 63 | SLOT(subDelayToggled())); |
| 64 | connect(ui.pbConvert, SIGNAL(clicked()), this, SLOT(convertClicked())); |
| 65 | |
| 66 | if (ppConfig.subFormat().isEmpty()) { |
| 67 | targetFormat = subtitleFormatsRegistry->listFormatNames().first(); |
| 68 | } else { |
| 69 | targetFormat = ppConfig.subFormat(); |
| 70 | ui.cbTargetFormat->setCurrentText(targetFormat); |
| 71 | } |
| 72 | |
| 73 | if (!ppConfig.subExtension().isEmpty()) { |
| 74 | ui.cbTargetExtension->setCurrentText(ppConfig.subExtension()); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | void frmConvert::srcSubSelectClicked() { |
| 79 | QNapiOpenDialog openSubtitle(this, tr("Choose a subtitles file"), |
nothing calls this directly
no test coverage detected