Commit 7816192f authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Always show master effect zones

parent d5df2439
Pipeline #53371 passed with stage
in 10 minutes and 41 seconds
......@@ -1055,6 +1055,7 @@ void Core::showEffectZone(QPair <int, int>inOut, bool checked)
{
if (m_guiConstructed && m_mainWindow->getCurrentTimeline()->controller()) {
m_mainWindow->getCurrentTimeline()->controller()->showRulerEffectZone(inOut, checked);
m_mainWindow->getCurrentTimeline()->controller()->updateMasterZones(m_mainWindow->getCurrentTimeline()->controller()->getModel()->getMasterEffectZones());
}
}
......@@ -1391,3 +1391,16 @@ bool EffectStackModel::hasEffect(const QString &assetId) const
}
return false;
}
QVariantList EffectStackModel::getEffectZones() const
{
QVariantList effectZones;
for (int i = 0; i < rootItem->childCount(); ++i) {
auto item = std::static_pointer_cast<EffectItemModel>(rootItem->child(i));
if (item->hasForcedInOut()) {
QPair<int, int> z = item->getInOut();
effectZones << QPoint(z.first, z.second);
}
}
return effectZones;
}
......@@ -147,6 +147,9 @@ public:
/** @brief Remove all effects for this stack */
void removeAllEffects(Fun &undo, Fun & redo);
/** @brief Returns a list of zones for all effects */
QVariantList getEffectZones() const;
public slots:
/** @brief Delete an effect from the stack */
......
......@@ -2356,6 +2356,9 @@ void MainWindow::connectDocument()
connect(m_effectList2, &EffectListWidget::reloadFavorites, getMainTimeline(), &TimelineWidget::updateEffectFavorites);
connect(m_transitionList2, &TransitionListWidget::reloadFavorites, getMainTimeline(), &TimelineWidget::updateTransitionFavorites);
connect(pCore->bin(), &Bin::processDragEnd, getMainTimeline(), &TimelineWidget::endDrag);
// Load master effect zones
getMainTimeline()->controller()->updateMasterZones(getMainTimeline()->controller()->getModel()->getMasterEffectZones());
// TODO REFAC: fix
// trackView->updateProfile(1.0);
......
......@@ -5248,3 +5248,10 @@ std::pair<int, GenTime> TimelineModel::getSubtitleIdFromIndex(int index) const
return {it->first, it->second};
}
QVariantList TimelineModel::getMasterEffectZones() const
{
if (m_masterStack) {
return m_masterStack->getEffectZones();
}
return {};
}
......@@ -436,6 +436,9 @@ public:
void plantMix(int tid, Mlt::Transition *t);
bool removeMixWithUndo(int cid, Fun &undo, Fun &redo);
bool removeMix(int cid);
/** @brief Returns a list of the master effects zones
*/
QVariantList getMasterEffectZones() const;
protected:
/** @brief Creates a new clip instance without inserting it.
......
......@@ -34,7 +34,8 @@ Item {
property int zoneHeight: Math.ceil(root.baseUnit / 2)
property bool showZoneLabels: false
property bool resizeActive: false // Used to decide which mouse cursor we should display
property var effectZones: timeline.masterEffectZones
function adjustStepSize() {
if (timeline.scaleFactor > 19) {
// Frame size >= 20 pixels
......@@ -173,8 +174,8 @@ Item {
property: "frameOut"
value: timeline.effectZone.y
}
color: 'yellow'
opacity: 0.9
color: 'blueviolet'
opacity: 0.7
anchors.bottom: parent.bottom
height: zoneHeight
function updateZone(start, end, update)
......@@ -182,5 +183,16 @@ Item {
timeline.updateEffectZone(start, end, update)
}
}
Repeater {
model: effectZones
Rectangle {
x: effectZones[index].x * timeline.scaleFactor
height: 2
width: (effectZones[index].y - effectZones[index].x) * timeline.scaleFactor
color: 'blueviolet'
opacity: 0.5
anchors.bottom: parent.bottom
}
}
}
......@@ -4254,3 +4254,9 @@ void TimelineController::showRulerEffectZone(QPair <int, int>inOut, bool checked
emit effectZoneChanged();
}
void TimelineController::updateMasterZones(QVariantList zones)
{
m_masterEffectZones = zones;
emit masterZonesChanged();
}
......@@ -60,6 +60,7 @@ class TimelineController : public QObject
Q_PROPERTY(bool showAudioThumbnails READ showAudioThumbnails NOTIFY showAudioThumbnailsChanged)
Q_PROPERTY(QVariantList dirtyChunks READ dirtyChunks NOTIFY dirtyChunksChanged)
Q_PROPERTY(QVariantList renderedChunks READ renderedChunks NOTIFY renderedChunksChanged)
Q_PROPERTY(QVariantList masterEffectZones MEMBER m_masterEffectZones NOTIFY masterZonesChanged)
Q_PROPERTY(int workingPreview READ workingPreview NOTIFY workingPreviewChanged)
Q_PROPERTY(bool useRuler READ useRuler NOTIFY useRulerChanged)
Q_PROPERTY(bool scrollVertically READ scrollVertically NOTIFY scrollVerticallyChanged)
......@@ -618,6 +619,8 @@ public:
void subtitleSpeechRecognition();
/** @brief Show active effect zone for current effect*/
void showRulerEffectZone(QPair <int, int>inOut, bool checked);
/** @brief Set the list of master effect zones */
void updateMasterZones(QVariantList zones);
public slots:
void resetView();
......@@ -686,6 +689,7 @@ private:
QMetaObject::Connection m_connection;
QMetaObject::Connection m_deleteConnection;
QPoint m_effectZone;
QVariantList m_masterEffectZones;
void initializePreview();
bool darkBackground() const;
......@@ -744,6 +748,7 @@ signals:
*/
void centerView();
void effectZoneChanged();
void masterZonesChanged();
Q_INVOKABLE void ungrabHack();
};
......
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