fix: dialog bugs surfaced by new gtest coverage

- SequencePreset::Save() wrote element "interlacing_" while Load() read
  "interlacing", losing the interlacing mode on preset round-trips;
  Save() now writes "interlacing" and Load() accepts both for backward
  compatibility with existing preset files
- ExportFormatComboBox: current_ was never initialized (UB on GetFormat
  before first user selection)
- ExportSubtitlesTab::SetSidecarEnabled() called setEnabled instead of
  setChecked, so restored export params could never re-enable sidecar
  subtitles
- h264section.h: static const int constants were odr-use unsafe (link
  error when referenced); changed to static constexpr
This commit is contained in:
2026-07-17 13:20:51 +08:00
parent 807e02614b
commit 1475525eb2
4 changed files with 11 additions and 8 deletions
+4 -4
View File
@@ -40,12 +40,12 @@ public:
int GetValue() const;
void SetValue(int c);
static const int kDefaultH264CRF = 18;
static const int kDefaultH265CRF = 23;
static constexpr int kDefaultH264CRF = 18;
static constexpr int kDefaultH265CRF = 23;
private:
static const int kMinimumCRF = 0;
static const int kMaximumCRF = 51;
static constexpr int kMinimumCRF = 0;
static constexpr int kMaximumCRF = 51;
QSlider *crf_slider_;
};
+1 -1
View File
@@ -71,7 +71,7 @@ private:
Menu *custom_menu_;
ExportFormat::Format current_;
ExportFormat::Format current_ = ExportFormat::kFormatCount;
};
}
+1 -1
View File
@@ -44,7 +44,7 @@ public:
}
void SetSidecarEnabled(bool e)
{
sidecar_checkbox_->setEnabled(e);
sidecar_checkbox_->setChecked(e);
}
ExportFormat::Format GetSidecarFormat() const
+5 -2
View File
@@ -70,7 +70,10 @@ public:
} else if (reader->name() == QStringLiteral("pixelaspect")) {
pixel_aspect_ = rational::fromString(
reader->readElementText().toStdString());
} else if (reader->name() == QStringLiteral("interlacing")) {
} else if (reader->name() == QStringLiteral("interlacing") ||
reader->name() == QStringLiteral("interlacing_")) {
// "interlacing_" is the element name mistakenly written by
// older versions of Save(); accept it for backward compatibility
interlacing_ = static_cast<VideoParams::Interlacing>(
reader->readElementText().toInt());
} else if (reader->name() == QStringLiteral("samplerate")) {
@@ -103,7 +106,7 @@ public:
writer->writeTextElement(
QStringLiteral("pixelaspect"),
QString::fromStdString(pixel_aspect_.toString()));
writer->writeTextElement(QStringLiteral("interlacing_"),
writer->writeTextElement(QStringLiteral("interlacing"),
QString::number(interlacing_));
writer->writeTextElement(QStringLiteral("samplerate"),
QString::number(sample_rate_));