Added option to remove/replace originals in transcoder dialog.
This commit is contained in:
parent
b9dbcb78db
commit
93c07f7721
|
@ -98,6 +98,9 @@ TranscodeDialog::TranscodeDialog(QWidget* parent)
|
|||
}
|
||||
}
|
||||
|
||||
ui_->remove_original->setChecked(
|
||||
s.value("overwrite_existing", false).toBool());
|
||||
|
||||
// Add a start button
|
||||
start_button_ = ui_->button_box->addButton(tr("Start transcoding"),
|
||||
QDialogButtonBox::ActionRole);
|
||||
|
@ -182,6 +185,7 @@ void TranscodeDialog::Start() {
|
|||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("last_output_format", preset.codec_mimetype_);
|
||||
s.setValue("overwrite_existing", ui_->remove_original->isChecked());
|
||||
}
|
||||
|
||||
void TranscodeDialog::Cancel() {
|
||||
|
@ -205,6 +209,20 @@ void TranscodeDialog::JobComplete(const QString& input, const QString& output,
|
|||
|
||||
UpdateStatusText();
|
||||
UpdateProgress();
|
||||
|
||||
bool overwrite_existing = ui_->remove_original->isChecked();
|
||||
QFileInfo input_fileinfo(input);
|
||||
QFileInfo output_fileinfo(output);
|
||||
bool same_extension = input_fileinfo.suffix() == output_fileinfo.suffix();
|
||||
bool same_path =
|
||||
input_fileinfo.absolutePath() == output_fileinfo.absolutePath();
|
||||
|
||||
if (success && overwrite_existing) {
|
||||
QFile(input).remove();
|
||||
if (same_path && same_extension) {
|
||||
QFile(output).rename(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TranscodeDialog::UpdateProgress() {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>499</width>
|
||||
<height>448</height>
|
||||
<height>482</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -165,6 +165,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="remove_original">
|
||||
<property name="toolTip">
|
||||
<string>If enabled the original files will be removed. If transcoded files have the same file extension and the destination is the same directory as the original files, the original files will be replaced.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove or replace original files </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in New Issue