Show message in bin on error loading producer

parent c2795b0b
......@@ -491,6 +491,11 @@ void Core::displayMessage(const QString &message, MessageType type, int timeout)
m_mainWindow->displayMessage(message, type, timeout);
}
void Core::displayBinMessage(const QString &text, int type, const QList<QAction *> &actions)
{
m_binWidget->doDisplayMessage(text, (KMessageWidget::MessageType) type, actions);
}
void Core::clearAssetPanel(int itemId)
{
if (m_guiConstructed) m_mainWindow->clearAssetPanel(itemId);
......
......@@ -197,6 +197,8 @@ private:
public slots:
void triggerAction(const QString &name);
/** @brief display a user info/warning message in the project bin */
void displayBinMessage(const QString &text, int type, const QList<QAction *> &actions = QList<QAction *>());
signals:
void coreIsReady();
......
......@@ -1368,7 +1368,7 @@ void KdenliveDoc::switchProfile(std::unique_ptr<ProfileParam> &profile, const QS
connect(ac, &QAction::triggered, [this, profilePath]() { this->slotSwitchProfile(profilePath); });
QAction *ac2 = new QAction(KoIconUtils::themedIcon(QStringLiteral("dialog-cancel")), i18n("Cancel"), this);
list << ac << ac2;
pCore->bin()->doDisplayMessage(i18n("Switch to clip profile %1?", profile->descriptiveString()), KMessageWidget::Information, list);
pCore->displayBinMessage(i18n("Switch to clip profile %1?", profile->descriptiveString()), KMessageWidget::Information, list);
} else {
// No known profile, ask user if he wants to use clip profile anyway
// Check profile fps so that we don't end up with an fps = 30.003 which would mess things up
......
......@@ -35,6 +35,7 @@
#include "xml/xml.hpp"
#include <QMimeDatabase>
#include <QWidget>
#include <KMessageWidget>
#include <mlt++/MltProducer.h>
#include <mlt++/MltProfile.h>
......@@ -269,6 +270,7 @@ bool LoadJob::startJob()
qCDebug(KDENLIVE_LOG) << " / / / / / / / / ERROR / / / / // CANNOT LOAD PRODUCER: " << m_resource;
m_done = true;
m_successful = false;
QMetaObject::invokeMethod(pCore.get(), "displayBinMessage", Qt::QueuedConnection, Q_ARG(const QString &, i18n("Cannot open file %1", m_resource)), Q_ARG(int, (int)KMessageWidget::Warning));
m_errorMessage.append(i18n("ERROR: Could not load clip %1: producer is invalid", m_resource));
return false;
}
......@@ -510,6 +512,7 @@ bool LoadJob::commitResult(Fun &undo, Fun &redo)
m_resultConsumed = true;
auto m_binClip = pCore->projectItemModel()->getClipByBinID(m_clipId);
if (!m_successful) {
// TODO: Deleting cannot happen at this stage or we endup in a mutex lock
pCore->projectItemModel()->requestBinClipDeletion(m_binClip, undo, redo);
return false;
}
......
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