Commit cd74627e authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Merge branch '2004'

parents a5c00441 4d9dd644
Pipeline #19994 canceled with stage
......@@ -145,11 +145,14 @@ std::shared_ptr<Mlt::Producer> LoadJob::loadPlaylist(QString &resource)
// This is currently crashing so I guess we'd better reject it for now
if (!pCore->getCurrentProfile()->isCompatible(xmlProfile.get())) {
m_errorMessage.append(i18n("Playlist has a different framerate (%1/%2fps), not recommended.", xmlProfile->frame_rate_num(), xmlProfile->frame_rate_den()));
QString loader = resource;
loader.prepend(QStringLiteral("consumer:"));
pCore->getCurrentProfile()->set_explicit(1);
return std::make_shared<Mlt::Producer>(pCore->getCurrentProfile()->profile(), loader.toUtf8().constData());
} else {
m_errorMessage.append(i18n("No matching profile"));
return nullptr;
}
QString loader = resource;
loader.prepend(QStringLiteral("consumer:"));
pCore->getCurrentProfile()->set_explicit(1);
return std::make_shared<Mlt::Producer>(pCore->getCurrentProfile()->profile(), loader.toUtf8().constData());
}
pCore->getCurrentProfile()->set_explicit(1);
return std::make_shared<Mlt::Producer>(pCore->getCurrentProfile()->profile(), "xml", resource.toUtf8().constData());
......@@ -351,7 +354,7 @@ bool LoadJob::startJob()
QMetaObject::invokeMethod(pCore.get(), "displayBinMessage", Qt::QueuedConnection, Q_ARG(const QString &, m_errorMessage),
Q_ARG(int, (int)KMessageWidget::Warning));
}
if (m_resource.endsWith(QLatin1String(".kdenlive"))) {
if (m_producer && m_resource.endsWith(QLatin1String(".kdenlive"))) {
QFile f(m_resource);
QDomDocument doc;
doc.setContent(&f, false);
......
......@@ -872,7 +872,7 @@
<label>True if slideshow default method is MIME type.</label>
<default>true</default>
</entry>
<entry name="monitorscene_directupdate" type="Bool">
<label>Update parameters while monitor scene changes.</label>
<default>false</default>
......@@ -884,14 +884,14 @@
<entry name="enableaudiospectrum" type="Bool">
<label>Send frames to audiospectrum scope for live analysis.</label>
<default>false</default>
<default>true</default>
</entry>
<entry name="showstopmotionthumbs" type="Bool">
<label>Show sequence thumbnails in stopmotion widget.</label>
<default>true</default>
</entry>
<entry name="captureinterval" type="Int">
<label>Interval between each capture (in seconds).</label>
<default>5</default>
......
......@@ -328,6 +328,9 @@ void MainWindow::init()
// Audio spectrum scope
m_audioSpectrum = new AudioGraphSpectrum(pCore->monitorManager());
QDockWidget *spectrumDock = addDock(i18n("Audio Spectrum"), QStringLiteral("audiospectrum"), m_audioSpectrum);
connect(spectrumDock, &QDockWidget::visibilityChanged, [&](bool visible) {
m_audioSpectrum->dockVisible(visible);
});
// Close library and audiospectrum on first run
screenGrabDock->close();
libraryDock->close();
......
......@@ -303,7 +303,7 @@ AudioGraphSpectrum::AudioGraphSpectrum(MonitorManager *manager, QWidget *parent)
QAction *a = new QAction(i18n("Enable Audio Spectrum"), this);
a->setCheckable(true);
a->setChecked(KdenliveSettings::enableaudiospectrum());
if (KdenliveSettings::enableaudiospectrum()) {
if (KdenliveSettings::enableaudiospectrum() && isVisible()) {
connect(m_manager, &MonitorManager::frameDisplayed, this, &ScopeWidget::onNewFrame, Qt::UniqueConnection);
}
connect(a, &QAction::triggered, this, &AudioGraphSpectrum::activate);
......@@ -317,6 +317,17 @@ AudioGraphSpectrum::~AudioGraphSpectrum()
delete m_filter;
}
void AudioGraphSpectrum::dockVisible(bool visible)
{
if (KdenliveSettings::enableaudiospectrum()) {
if (!visible) {
disconnect(m_manager, &MonitorManager::frameDisplayed, this, &ScopeWidget::onNewFrame);
} else {
connect(m_manager, &MonitorManager::frameDisplayed, this, &ScopeWidget::onNewFrame);
}
}
}
void AudioGraphSpectrum::activate(bool enable)
{
if (enable) {
......
......@@ -80,6 +80,7 @@ class AudioGraphSpectrum : public ScopeWidget
public:
AudioGraphSpectrum(MonitorManager *manager, QWidget *parent = nullptr);
~AudioGraphSpectrum() override;
void dockVisible(bool visible);
private:
MonitorManager *m_manager;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment