Commit 7698e034 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Merge branch '2004'

parents 41903979 353fc81d
Pipeline #17586 passed with stage
in 13 minutes and 49 seconds
......@@ -574,7 +574,7 @@ std::shared_ptr<Mlt::Producer> ProjectClip::getTimelineProducer(int trackId, int
(state == PlaylistState::VideoOnly && (m_clipType == ClipType::Color || m_clipType == ClipType::Image || m_clipType == ClipType::Text || m_clipType == ClipType::Qml))) {
// Temporary copy, return clone of master
int duration = m_masterProducer->time_to_frames(m_masterProducer->get("kdenlive:duration"));
return std::shared_ptr<Mlt::Producer>(m_masterProducer->cut(-1, duration > 0 ? duration : -1));
return std::shared_ptr<Mlt::Producer>(m_masterProducer->cut(-1, duration > 0 ? duration - 1 : -1));
}
if (m_timewarpProducers.count(clipId) > 0) {
m_effectStack->removeService(m_timewarpProducers[clipId]);
......@@ -604,7 +604,7 @@ std::shared_ptr<Mlt::Producer> ProjectClip::getTimelineProducer(int trackId, int
m_effectStack->addService(m_videoProducers[trackId]);
}
int duration = m_masterProducer->time_to_frames(m_masterProducer->get("kdenlive:duration"));
return std::shared_ptr<Mlt::Producer>(m_videoProducers[trackId]->cut(-1, duration > 0 ? duration : -1));
return std::shared_ptr<Mlt::Producer>(m_videoProducers[trackId]->cut(-1, duration > 0 ? duration - 1: -1));
}
if (m_videoProducers.count(trackId) > 0) {
m_effectStack->removeService(m_videoProducers[trackId]);
......@@ -613,7 +613,7 @@ std::shared_ptr<Mlt::Producer> ProjectClip::getTimelineProducer(int trackId, int
Q_ASSERT(state == PlaylistState::Disabled);
createDisabledMasterProducer();
int duration = m_masterProducer->time_to_frames(m_masterProducer->get("kdenlive:duration"));
return std::shared_ptr<Mlt::Producer>(m_disabledProducer->cut(-1, duration > 0 ? duration : -1));
return std::shared_ptr<Mlt::Producer>(m_disabledProducer->cut(-1, duration > 0 ? duration - 1: -1));
}
// For timewarp clips, we keep one separate producer for each clip.
......@@ -733,42 +733,6 @@ std::pair<std::shared_ptr<Mlt::Producer>, bool> ProjectClip::giveMasterAndGetTim
// we have a problem
return {std::shared_ptr<Mlt::Producer>(ClipController::mediaUnavailable->cut()), false};
}
/*
std::shared_ptr<Mlt::Producer> ProjectClip::timelineProducer(PlaylistState::ClipState state, int track)
{
if (!m_service.startsWith(QLatin1String("avformat"))) {
std::shared_ptr<Mlt::Producer> prod(originalProducer()->cut());
int length = getProducerIntProperty(QStringLiteral("kdenlive:duration"));
if (length > 0) {
prod->set_in_and_out(0, length);
}
return prod;
}
if (state == PlaylistState::VideoOnly) {
if (m_timelineProducers.count(0) > 0) {
return std::shared_ptr<Mlt::Producer>(m_timelineProducers.find(0)->second->cut());
}
std::shared_ptr<Mlt::Producer> videoProd = cloneProducer();
videoProd->set("audio_index", -1);
m_timelineProducers[0] = videoProd;
return std::shared_ptr<Mlt::Producer>(videoProd->cut());
}
if (state == PlaylistState::AudioOnly) {
if (m_timelineProducers.count(-track) > 0) {
return std::shared_ptr<Mlt::Producer>(m_timelineProducers.find(-track)->second->cut());
}
std::shared_ptr<Mlt::Producer> audioProd = cloneProducer();
audioProd->set("video_index", -1);
m_timelineProducers[-track] = audioProd;
return std::shared_ptr<Mlt::Producer>(audioProd->cut());
}
if (m_timelineProducers.count(track) > 0) {
return std::shared_ptr<Mlt::Producer>(m_timelineProducers.find(track)->second->cut());
}
std::shared_ptr<Mlt::Producer> normalProd = cloneProducer();
m_timelineProducers[track] = normalProd;
return std::shared_ptr<Mlt::Producer>(normalProd->cut());
}*/
std::shared_ptr<Mlt::Producer> ProjectClip::cloneProducer(bool removeEffects)
{
......
......@@ -206,57 +206,58 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
int size = style()->pixelMetric(QStyle::PM_SmallIconSize);
QSize iconSize(size, size);
m_toolbar->setIconSize(iconSize);
m_scalingLabel = new QLabel(this);
m_scalingLabel->setToolTip(i18n("Preview resolution - lower resolution means faster preview"));
m_scalingLabel->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
QFontMetricsF fm(m_scalingLabel->font());
int labelWidth = (int) fm.boundingRect(QRect(0, 0, fm.averageCharWidth()*10, fm.lineSpacing() * 2), Qt::AlignCenter, QStringLiteral("000p")).width();
QMargins labelMrg = m_scalingLabel->contentsMargins();
m_scalingLabel->setFixedWidth(labelWidth + labelMrg.left() + labelMrg.right());
m_scalingLabel->setAlignment(Qt::AlignCenter);
connect(m_scalingLabel, &QLabel::linkActivated, [&]() {
switch (KdenliveSettings::previewScaling()) {
QComboBox *scalingAction = new QComboBox(this);
scalingAction->setToolTip(i18n("Preview resolution - lower resolution means faster preview"));
// Combobox padding is bad, so manually add a space before text
scalingAction->addItems({QStringLiteral(" ") + i18n("1:1"),QStringLiteral(" ") + i18n("720p"),QStringLiteral(" ") + i18n("540p"),QStringLiteral(" ") + i18n("360p"),QStringLiteral(" ") + i18n("270p")});
connect(scalingAction, QOverload<int>::of(&QComboBox::activated), [this] (int index) {
switch (index) {
case 1:
KdenliveSettings::setPreviewScaling(2);
break;
case 2:
KdenliveSettings::setPreviewScaling(4);
break;
case 4:
case 3:
KdenliveSettings::setPreviewScaling(8);
break;
case 8:
case 4:
KdenliveSettings::setPreviewScaling(16);
break;
case 16:
KdenliveSettings::setPreviewScaling(0);
break;
default:
KdenliveSettings::setPreviewScaling(2);
KdenliveSettings::setPreviewScaling(0);
}
m_monitorManager->scalingChanged();
m_monitorManager->updatePreviewScaling();
});
connect(manager, &MonitorManager::updatePreviewScaling, [this]() {
connect(manager, &MonitorManager::updatePreviewScaling, [this, scalingAction]() {
m_glMonitor->updateScaling();
switch (KdenliveSettings::previewScaling()) {
case 2:
m_scalingLabel->setText(QString("<a href=\"#\">%1</a>").arg(i18n("720p")));
scalingAction->setCurrentIndex(1);
break;
case 4:
m_scalingLabel->setText(QString("<a href=\"#\">%1</a>").arg(i18n("540p")));
scalingAction->setCurrentIndex(2);
break;
case 8:
m_scalingLabel->setText(QString("<a href=\"#\">%1</a>").arg(i18n("360p")));
scalingAction->setCurrentIndex(3);
break;
case 16:
m_scalingLabel->setText(QString("<a href=\"#\">%1</a>").arg(i18n("270p")));
scalingAction->setCurrentIndex(4);
break;
default:
m_scalingLabel->setText(QString("<a href=\"#\">%1</a>").arg(i18n("1:1")));
scalingAction->setCurrentIndex(0);
break;
}
refreshMonitorIfActive();
});
scalingAction->setFrame(false);
scalingAction->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
m_toolbar->addWidget(scalingAction);
m_toolbar->addSeparator();
m_toolbar->addWidget(m_scalingLabel);
m_speedLabel = new QLabel(this);
m_speedLabel->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
KColorScheme scheme(palette().currentColorGroup(), KColorScheme::Button);
......
......@@ -221,7 +221,6 @@ private:
MonitorAudioLevel *m_audioMeterWidget;
QTimer m_droppedTimer;
double m_displayedFps;
QLabel *m_scalingLabel;
QLabel *m_speedLabel;
int m_speedIndex;
......
......@@ -51,21 +51,6 @@ Item {
acceptedButtons: Qt.NoButton
anchors.fill: parent
}
SceneToolBar {
id: sceneToolBar
barContainsMouse: sceneToolBar.rightSide ? barOverArea.mouseX >= x - 10 : barOverArea.mouseX < x + width + 10
onBarContainsMouseChanged: {
sceneToolBar.opacity = 1
sceneToolBar.visible = sceneToolBar.barContainsMouse
}
anchors {
right: parent.right
top: parent.top
topMargin: 4
rightMargin: 4
leftMargin: 4
}
}
Item {
id: frame
......@@ -77,8 +62,8 @@ Item {
Repeater {
id: trackSeparators
model: tracks
property int rows: trackSeparators.count < 5 ? 2 : 3
property int columns: trackSeparators.count < 3 ? 1 : trackSeparators.count < 7 ? 2 : 3
property int rows: trackSeparators.count < 2 ? 1 : trackSeparators.count < 5 ? 2 : 3
property int columns: trackSeparators.count < 2 ? 1 : trackSeparators.count < 3 ? 1 : trackSeparators.count < 7 ? 2 : 3
Rectangle {
width: parent.width / trackSeparators.rows
height: parent.height / trackSeparators.columns
......@@ -103,6 +88,21 @@ Item {
}
}
}
SceneToolBar {
id: sceneToolBar
barContainsMouse: sceneToolBar.rightSide ? barOverArea.mouseX >= x - 10 : barOverArea.mouseX < x + width + 10
onBarContainsMouseChanged: {
sceneToolBar.opacity = 1
sceneToolBar.visible = sceneToolBar.barContainsMouse
}
anchors {
right: parent.right
top: parent.top
topMargin: 4
rightMargin: 4
leftMargin: 4
}
}
MonitorRuler {
id: clipMonitorRuler
anchors {
......
......@@ -860,6 +860,9 @@ QStringList TimelineFunctions::enableMultitrackView(const std::shared_ptr<Timeli
switch (count) {
case 0:
switch (videoTracks.size()) {
case 1:
geometry = QStringLiteral("0 0 100% 100%");
break;
case 2:
geometry = QStringLiteral("0 0 50% 100%");
break;
......
......@@ -121,7 +121,11 @@ Rectangle {
contentItem: Label {
color: activePalette.text
font: miniFont
text: label.text + ' (' + timeline.simplifiedTC(clipRoot.inPoint) + '-' + timeline.simplifiedTC(clipRoot.outPoint) + ')'
text: '%1 (%2-%3)\n%4: %5'.arg(label.text)
.arg(timeline.simplifiedTC(clipRoot.inPoint))
.arg(timeline.simplifiedTC(clipRoot.outPoint))
.arg(i18n("Duration"))
.arg(timeline.simplifiedTC(clipRoot.clipDuration))
}
}
......
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