Fix crash in project settings, update render widget when project profile changed

parent 630a6c06
......@@ -276,6 +276,8 @@ bool Core::setCurrentProfile(const QString &profilePath)
{
if (ProfileRepository::get()->profileExists(profilePath)) {
KdenliveSettings::setCurrent_profile(profilePath);
// inform render widget
m_mainWindow->updateRenderWidgetProfile();
return true;
}
return false;
......
......@@ -1512,7 +1512,6 @@ int RenderWidget::waitingJobsCount() const
void RenderWidget::adjustViewToProfile()
{
//TODO: Update settings on profile change
m_view.scanning_list->setCurrentIndex(0);
m_view.rescale_width->setValue(KdenliveSettings::defaultrescalewidth());
if (!m_view.rescale_keep->isChecked()) {
......
......@@ -117,7 +117,6 @@ public:
virtual ~RenderWidget();
void setGuides(const QMap<double, QString> &guidesData, double duration);
void focusFirstVisibleItem(const QString &profile = QString());
void adjustViewToProfile();
void setRenderJob(const QString &dest, int progress = 0);
void setRenderStatus(const QString &dest, int status, const QString &error);
void setDocumentPath(const QString &path);
......@@ -150,6 +149,7 @@ public slots:
const QList<QString> &trackNames, const QString &scriptPath, bool exportAudio);
void slotAbortCurrentJob();
void slotPrepareExport(bool scriptExport = false, const QString &scriptPath = QString());
void adjustViewToProfile();
private slots:
void slotUpdateButtons(const QUrl &url);
......
......@@ -1691,7 +1691,7 @@ void MainWindow::slotEditProjectSettings()
KdenliveDoc *project = pCore->projectManager()->current();
QPoint p = m_timelineTabs->getCurrentTimeline()->getTracksCount();
ProjectSettings *w = new ProjectSettings(project, project->metadata(), pCore->projectManager()->currentTimeline()->projectView()->extractTransitionsLumas(),
ProjectSettings *w = new ProjectSettings(project, project->metadata(), m_timelineTabs->getCurrentTimeline()->controller()->extractCompositionLumas(),
p.x(), p.y(), project->projectTempFolder(), true, !project->isModified(), this);
connect(w, &ProjectSettings::disableProxies, this, &MainWindow::slotDisableProxies);
connect(w, SIGNAL(disablePreview()), pCore->projectManager()->currentTimeline(), SLOT(invalidateRange()));
......@@ -1700,7 +1700,8 @@ void MainWindow::slotEditProjectSettings()
if (w->exec() == QDialog::Accepted) {
QString profile = w->selectedProfile();
// project->setProjectFolder(w->selectedFolder());
pCore->projectManager()->currentTimeline()->updatePreviewSettings(w->selectedPreview());
//TODO: timeline preview
//pCore->projectManager()->currentTimeline()->updatePreviewSettings(w->selectedPreview());
bool modified = false;
if (m_renderWidget) {
m_renderWidget->setDocumentPath(project->projectDataFolder() + QDir::separator());
......@@ -1824,6 +1825,7 @@ void MainWindow::slotRenderProject()
connect(m_renderWidget, &RenderWidget::prepareRenderingData, this, &MainWindow::slotPrepareRendering);
connect(m_renderWidget, &RenderWidget::abortProcess, this, &MainWindow::abortRenderJob);
connect(m_renderWidget, &RenderWidget::openDvdWizard, this, &MainWindow::slotDvdWizard);
connect(this, &MainWindow::updateRenderWidgetProfile, m_renderWidget, &RenderWidget::adjustViewToProfile);
m_renderWidget->setGuides(pCore->projectManager()->currentTimeline()->projectView()->guidesData(), project->projectDuration());
m_renderWidget->setDocumentPath(project->projectDataFolder() + QDir::separator());
m_renderWidget->setRenderProfile(project->getRenderProperties());
......@@ -2055,7 +2057,6 @@ void MainWindow::connectDocument()
if (m_renderWidget) {
slotCheckRenderStatus();
m_renderWidget->adjustViewToProfile();
// m_renderWidget->setGuides(pCore->projectManager()->currentTimeline()->projectView()->guidesData(), project->projectDuration());
m_renderWidget->setDocumentPath(project->projectDataFolder() + QDir::separator());
m_renderWidget->setRenderProfile(project->getRenderProperties());
......
......@@ -476,6 +476,8 @@ signals:
void setPreviewProgress(int);
void setRenderProgress(int);
void displayMessage(const QString &, MessageType, int);
/** @brief Project profile changed, update render widget accordingly. */
void updateRenderWidgetProfile();
};
#endif
......@@ -1415,7 +1415,8 @@ void Monitor::setCustomProfile(const QString &profile, const Timecode &tc)
if (m_multitrackView) {
m_multitrackView->setChecked(false);
}
pCore->setCurrentProfile(profile);
//TODO: this is a temporary profile for DVD preview, it should not alter project profile
//pCore->setCurrentProfile(profile);
m_glMonitor->reloadProfile();
}
......
......@@ -1573,3 +1573,16 @@ std::shared_ptr<EffectStackModel> TimelineModel::getClipEffectStackModel(int cli
Q_ASSERT(isClip(clipId));
return std::static_pointer_cast<EffectStackModel>(m_allClips.at(clipId)->m_effectStack);
}
QStringList TimelineModel::extractCompositionLumas() const
{
QStringList urls;
for (const auto &compo : m_allCompositions) {
QString luma = compo.second->getProperty(QStringLiteral("resource"));
if (!luma.isEmpty()) {
urls << QUrl::fromLocalFile(luma).toLocalFile();
}
}
urls.removeDuplicates();
return urls;
}
......@@ -465,6 +465,10 @@ public:
*/
std::unordered_set<int> getItemsAfterPosition(int trackId, int position, int end = -1, bool listCompositions = true);
/* @brief Returns a list of all luma files used in the project
*/
QStringList extractCompositionLumas() const;
protected:
/* @brief Register a new track. This is a call-back meant to be called from TrackModel
@param pos indicates the number of the track we are adding. If this is -1, then we add at the end.
......
......@@ -520,3 +520,8 @@ QPoint TimelineController::getTracksCount() const
QPoint p(tracks.at(0).toInt(), tracks.at(1).toInt());
return p;
}
QStringList TimelineController::extractCompositionLumas() const
{
return m_model->extractCompositionLumas();
}
......@@ -210,6 +210,10 @@ public:
*/
void snapChanged(bool snap);
/* @brief Returns a list of all luma files used in the project
*/
QStringList extractCompositionLumas() const;
public slots:
void selectMultitrack();
Q_INVOKABLE void setSeekPosition(int position);
......
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