Qt: Don't use non-C++14 designated initializers

This commit is contained in:
Vicki Pfau 2020-06-29 14:47:31 -07:00
parent 8a7f8c67fc
commit 8137a43233
2 changed files with 42 additions and 71 deletions

View File

@ -112,96 +112,58 @@ VideoView::VideoView(QWidget* parent)
void VideoView::updatePresets() { void VideoView::updatePresets() {
m_presets.clear(); m_presets.clear();
addPreset(m_ui.preset4K, { addPreset(m_ui.preset4K, { maintainAspect(QSize(3840, 2160)) });
.container = QString(), addPreset(m_ui.preset1080, { maintainAspect(QSize(1920, 1080)) });
.vcodec = QString(), addPreset(m_ui.preset720, { maintainAspect(QSize(1280, 720)) });
.acodec = QString(), addPreset(m_ui.preset480, { maintainAspect(QSize(720, 480)) });
.vbr = 0,
.abr = 0,
.dims = maintainAspect(QSize(3840, 2160))
});
addPreset(m_ui.preset1080, {
.container = QString(),
.vcodec = QString(),
.acodec = QString(),
.vbr = 0,
.abr = 0,
.dims = maintainAspect(QSize(1920, 1080))
});
addPreset(m_ui.preset720, {
.container = QString(),
.vcodec = QString(),
.acodec = QString(),
.vbr = 0,
.abr = 0,
.dims = maintainAspect(QSize(1280, 720))
});
addPreset(m_ui.preset480, {
.container = QString(),
.vcodec = QString(),
.acodec = QString(),
.vbr = 0,
.abr = 0,
.dims = maintainAspect(QSize(720, 480))
});
if (m_nativeWidth && m_nativeHeight) { if (m_nativeWidth && m_nativeHeight) {
addPreset(m_ui.presetNative, { addPreset(m_ui.presetNative, { QSize(m_nativeWidth, m_nativeHeight) });
.container = QString(),
.vcodec = QString(),
.acodec = QString(),
.vbr = 0,
.abr = 0,
.dims = QSize(m_nativeWidth, m_nativeHeight)
});
m_ui.presetNative->setEnabled(true); m_ui.presetNative->setEnabled(true);
} }
addPreset(m_ui.presetHQ, { addPreset(m_ui.presetHQ, {
.container = "MP4", "MP4",
.vcodec = "h.264", "h.264",
.acodec = "AAC", "AAC",
.vbr = 8000, 8000,
.abr = 384, 384,
.dims = maintainAspect(QSize(1920, 1080)) maintainAspect({ 1920, 1080 })
}); });
addPreset(m_ui.presetYoutube, { addPreset(m_ui.presetYoutube, {
.container = "MP4", "MP4",
.vcodec = "h.264", "h.264",
.acodec = "AAC", "AAC",
.vbr = 5000, 5000,
.abr = 256, 256,
.dims = maintainAspect(QSize(1280, 720)) maintainAspect({ 1280, 720 })
}); });
addPreset(m_ui.presetWebM, { addPreset(m_ui.presetWebM, {
.container = "WebM", "WebM",
.vcodec = "VP9", "VP9",
.acodec = "Opus", "Opus",
.vbr = 800, 800,
.abr = 128 128
}); });
addPreset(m_ui.presetMP4, { addPreset(m_ui.presetMP4, {
.container = "MP4", "MP4",
.vcodec = "h.264", "h.264",
.acodec = "AAC", "AAC",
.vbr = 800, 800,
.abr = 128 128
}); });
if (m_nativeWidth && m_nativeHeight) { if (m_nativeWidth && m_nativeHeight) {
addPreset(m_ui.presetLossless, { addPreset(m_ui.presetLossless, {
.container = "MKV", "MKV",
.vcodec = "h.264", "h.264",
.acodec = "FLAC", "FLAC",
.vbr = -1, -1,
.abr = 0, 0,
.dims = QSize(m_nativeWidth, m_nativeHeight) { m_nativeWidth, m_nativeHeight }
}); });
} }
} }

View File

@ -70,6 +70,15 @@ private:
int abr; int abr;
QSize dims; QSize dims;
Preset() {}
Preset(QString container, QString vcodec, QString acodec, int vbr, int abr, QSize dims = QSize())
: container(container)
, vcodec(vcodec)
, acodec(acodec)
, vbr(vbr)
, abr(abr)
, dims(dims) {}
Preset(QSize dims) : dims(dims) {}
bool compatible(const Preset&) const; bool compatible(const Preset&) const;
}; };