Commit 01b125f5 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

[Render widget] add clickable link to edit metadata, display them in tooltip.

Fixes #1523
parent 8a1baef3
Pipeline #241563 failed with stage
in 8 minutes and 52 seconds
......@@ -12,6 +12,7 @@
#include "dialogs/renderpresetdialog.h"
#include "doc/kdenlivedoc.h"
#include "kdenlivesettings.h"
#include "mainwindow.h"
#include "monitor/monitor.h"
#include "profiles/profilemodel.hpp"
#include "profiles/profilerepository.hpp"
......@@ -243,6 +244,8 @@ RenderWidget::RenderWidget(bool enableProxy, QWidget *parent)
connect(m_view.buttonRender, &QAbstractButton::clicked, this, [&]() { slotPrepareExport(); });
connect(m_view.buttonGenerateScript, &QAbstractButton::clicked, this, [&]() { slotPrepareExport(true); });
updateMetadataToolTip();
connect(m_view.edit_metadata, &QLabel::linkActivated, []() { pCore->window()->slotEditProjectSettings(2); });
m_view.infoMessage->hide();
m_view.jobInfo->hide();
......@@ -2102,3 +2105,16 @@ void RenderWidget::resetRenderPath(const QString &path)
renderProps.insert(QStringLiteral("renderurl"), url);
emit selectedRenderProfile(renderProps);
}
void RenderWidget::updateMetadataToolTip()
{
QString tipText;
QMapIterator<QString, QString> i(pCore->currentDoc()->metadata());
while (i.hasNext()) {
i.next();
QString metaName = i.key().section(QLatin1Char('.'), 2, 2);
metaName[0] = metaName[0].toUpper();
tipText.append(QString("%1: <b>%2</b><br/>").arg(metaName, i.value()));
}
m_view.edit_metadata->setToolTip(tipText);
}
......@@ -146,7 +146,9 @@ public slots:
void reloadGuides();
/** @brief Adjust render file name to current project name. */
void resetRenderPath(const QString &path);
/** @brief Update metadata tooltip with current values. */
void updateMetadataToolTip();
private slots:
/**
* Will be called when the user selects an output file via the file dialog.
......
......@@ -1981,13 +1981,16 @@ void MainWindow::slotRefreshProfiles()
}
}
void MainWindow::slotEditProjectSettings()
void MainWindow::slotEditProjectSettings(int ix)
{
KdenliveDoc *project = pCore->currentDoc();
QPair<int, int> p = getMainTimeline()->getTracksCount();
int channels = project->getDocumentProperty(QStringLiteral("audioChannels"), QStringLiteral("2")).toInt();
ProjectSettings *w = new ProjectSettings(project, project->metadata(), getMainTimeline()->controller()->extractCompositionLumas(), p.first, p.second,
channels, project->projectTempFolder(), true, !project->isModified(), this);
if (ix > 0) {
w->tabWidget->setCurrentIndex(ix);
}
connect(w, &ProjectSettings::disableProxies, this, &MainWindow::slotDisableProxies);
// connect(w, SIGNAL(disablePreview()), pCore->projectManager()->currentTimeline(), SLOT(invalidateRange()));
connect(w, &ProjectSettings::refreshProfiles, this, &MainWindow::slotRefreshProfiles);
......@@ -2068,6 +2071,9 @@ void MainWindow::slotEditProjectSettings()
}
if (w->metadata() != project->metadata()) {
project->setMetadata(w->metadata());
if (m_renderWidget) {
m_renderWidget->updateMetadataToolTip();
}
}
QString newProjectFolder = w->storageFolder();
......@@ -2339,6 +2345,7 @@ void MainWindow::connectDocument()
m_renderWidget->setGuides(pCore->currentDoc()->getGuideModel());
m_renderWidget->updateDocumentPath();
m_renderWidget->setRenderProfile(project->getRenderProperties());
m_renderWidget->updateMetadataToolTip();
}
m_zoomSlider->setValue(project->zoom().x());
m_commandStack->setActiveStack(project->commandStack().get());
......
......@@ -351,6 +351,7 @@ public slots:
void slotUpdateProjectDuration(int pos);
/** @brief Remove all unused clips from the project. */
void slotCleanProject();
void slotEditProjectSettings(int ix = 0);
private slots:
/** @brief Shows the shortcut dialog. */
......@@ -360,7 +361,6 @@ private slots:
void updateConfiguration();
void slotConnectMonitors();
void slotUpdateMousePosition(int pos, int duration = -1);
void slotEditProjectSettings();
void slotSwitchMarkersComments();
void slotSwitchSnap();
void slotShowTimelineTags();
......
......@@ -42,6 +42,18 @@
<item>
<widget class="QFrame" name="baseGroup">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="8" column="0">
<widget class="KMessageWidget" name="infoMessage">
<property name="wordWrap">
......@@ -444,11 +456,23 @@
<rect>
<x>0</x>
<y>0</y>
<width>313</width>
<height>952</height>
<width>324</width>
<height>924</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="video_box">
<property name="title">
......@@ -777,11 +801,35 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="export_meta">
<property name="text">
<string>Export metadata</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QCheckBox" name="export_meta">
<property name="text">
<string>Export metadata</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="edit_metadata">
<property name="text">
<string>&lt;a href=&quot;#&quot;&gt;Edit metadata&lt;/a&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="embed_subtitles">
......
Supports Markdown
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