Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Fix check profile on first added clip

parent 69efc5d2
......@@ -3064,18 +3064,6 @@ QDir Bin::getCacheDir(CacheType type, bool *ok) const
return m_doc->getCacheDir(type, ok);
}
bool Bin::addClip(QDomElement elem, const QString &clipId)
{
const QString producerId = clipId.section(QLatin1Char('_'), 0, 0);
elem.setAttribute(QStringLiteral("id"), producerId);
if ((KdenliveSettings::default_profile().isEmpty() || KdenliveSettings::checkfirstprojectclip()) && isEmpty()) {
elem.setAttribute(QStringLiteral("checkProfile"), 1);
}
createClip(elem);
pCore->jobManager()->startJob<LoadJob>({producerId}, -1, QString(), elem);
return true;
}
void Bin::rebuildProxies()
{
QList<std::shared_ptr<ProjectClip>> clipList = m_itemModel->getRootFolder()->childClips();
......
......@@ -277,8 +277,6 @@ public:
QDockWidget *clipPropertiesDock();
/** @brief Returns a document's cache dir. ok is set to false if folder does not exist */
QDir getCacheDir(CacheType type, bool *ok) const;
/** @brief Command adding a bin clip */
bool addClip(QDomElement elem, const QString &clipId);
void rebuildProxies();
/** @brief Return a list of all clips hashes used in this project */
QStringList getProxyHashList();
......
......@@ -21,6 +21,7 @@
#include "clipcreator.hpp"
#include "core.h"
#include "bin/bin.h"
#include "doc/kdenlivedoc.h"
#include "kdenlivesettings.h"
#include "klocalizedstring.h"
......@@ -140,6 +141,9 @@ QString ClipCreator::createClipFromFile(const QString &path, const QString &pare
Xml::addXmlProperties(prod, properties);
qDebug() << "/////////// normal" << url.toLocalFile() << properties << url;
}
if (pCore->bin()->isEmpty() && (KdenliveSettings::default_profile().isEmpty() || KdenliveSettings::checkfirstprojectclip())) {
prod.setAttribute(QStringLiteral("_checkProfile"), 1);
}
qDebug() << "/////////// final xml" << xml.toString();
QString id;
......
......@@ -305,6 +305,9 @@ bool Core::setCurrentProfile(const QString &profilePath)
m_thumbProfile.reset();
// inform render widget
m_mainWindow->updateRenderWidgetProfile();
if (m_guiConstructed) {
m_mainWindow->getCurrentTimeline()->controller()->getModel()->updateProfile(&getCurrentProfile()->profile());
}
return true;
}
return false;
......
......@@ -1363,8 +1363,9 @@ void KdenliveDoc::switchProfile(std::unique_ptr<ProfileParam> &profile, const QS
// Build actions for the info message (switch / cancel)
QList<QAction *> list;
const QString profilePath = profile->path();
QAction *ac = new QAction(KoIconUtils::themedIcon(QStringLiteral("dialog-ok")), i18n("Switch"), this);
connect(ac, &QAction::triggered, [this, &profile]() { this->slotSwitchProfile(profile->path()); });
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);
......
......@@ -172,7 +172,7 @@ void LoadJob::checkProfile()
clipProfile->adjustWidth();
if (clipProfile != projectProfile) {
// Profiles do not match, propose profile adjustment
pCore->currentDoc()->switchProfile(projectProfile, m_clipId, m_xml);
pCore->currentDoc()->switchProfile(clipProfile, m_clipId, m_xml);
} else if (KdenliveSettings::default_profile().isEmpty()) {
// Confirm default project format
KdenliveSettings::setDefault_profile(pCore->getCurrentProfile()->path());
......@@ -513,7 +513,7 @@ bool LoadJob::commitResult(Fun &undo, Fun &redo)
pCore->projectItemModel()->requestBinClipDeletion(m_binClip, undo, redo);
return false;
}
if (m_xml.hasAttribute(QStringLiteral("checkProfile")) && m_producer->get_int("video_index") > -1) {
if (m_xml.hasAttribute(QStringLiteral("_checkProfile")) && m_producer->get_int("video_index") > -1) {
checkProfile();
}
if (m_video_list.size() > 1) {
......
......@@ -2298,3 +2298,9 @@ const QString TimelineModel::getTrackTagById(int trackId) const
}
return isAudio ? QStringLiteral("A%1").arg(totalAudio - count) : QStringLiteral("V%1").arg(count - 1);
}
void TimelineModel::updateProfile(Mlt::Profile *profile)
{
m_profile = profile;
m_tractor->set_profile(*m_profile);
}
......@@ -526,6 +526,8 @@ public:
bool requestClipTimeWarp(int clipId, int trackId, int blankSpace, double speed, Fun &undo, Fun &redo);
bool changeItemSpeed(int clipId, int speed);
void replugClip(int clipId);
/** @brief Refresh the tractor profile in case a change was requested. */
void updateProfile(Mlt::Profile *profile);
protected:
/* @brief Register a new track. This is a call-back meant to be called from TrackModel
......
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