Switch timeline to qml2 only (port qml1 code)

parent 108366cb
Pipeline #14119 passed with stage
in 15 minutes and 42 seconds
......@@ -572,7 +572,6 @@ void MainWindow::init()
noFrame->setData(QStringLiteral("3"));
noFrame->setCheckable(true);
thumbsMenu->addAction(noFrame);
timelineHeadersMenu->addMenu(thumbsMenu);
QMenu *openGLMenu = static_cast<QMenu *>(factory()->container(QStringLiteral("qt_opengl"), this));
#if defined(Q_OS_WIN)
......
......@@ -72,7 +72,7 @@ Rectangle {
property bool isComposition: false
property bool hideClipViews: false
property var groupTrimData
property int scrollStart: scrollView.flickableItem.contentX - (clipRoot.modelStart * timeline.scaleFactor)
property int scrollStart: scrollView.contentItem.contentX - (clipRoot.modelStart * timeline.scaleFactor)
width : clipDuration * timeScale
opacity: dragProxyArea.drag.active && dragProxy.draggedItem == clipId ? 0.8 : 1.0
......
......@@ -62,7 +62,7 @@ Item {
property color color: displayRect.color
property color borderColor: 'black'
property bool hideCompoViews
property int scrollStart: scrollView.flickableItem.contentX - modelStart * timeline.scaleFactor
property int scrollStart: scrollView.contentItem.contentX - modelStart * timeline.scaleFactor
signal moved(var clip)
signal dragged(var clip, var mouse)
......
......@@ -101,7 +101,7 @@ Rectangle {
Repeater {
id: tickRepeater
model: scrollView.width / rulerRoot.tickSpacing + 2
property int offset: Math.floor(scrollView.flickableItem.contentX /rulerRoot.tickSpacing)
property int offset: Math.floor(scrollView.contentItem.contentX /rulerRoot.tickSpacing)
Item {
property int realPos: (tickRepeater.offset + index) * rulerRoot.tickSpacing / timeline.scaleFactor
x: realPos * timeline.scaleFactor
......
......@@ -94,7 +94,7 @@ Item{
Binding {
target: loader.item
property: "scrollX"
value: scrollView.flickableItem.contentX
value: scrollView.contentItem.contentX
when: loader.status == Loader.Ready && loader.item
}
Binding {
......
This diff is collapsed.
......@@ -2824,9 +2824,20 @@ void TimelineController::collapseActiveTrack()
m_model->setTrackProperty(m_activeTrack, QStringLiteral("kdenlive:collapsed"), collapsed > 0 ? QStringLiteral("0") : QStringLiteral("5"));
}
void TimelineController::setTrackProperty(const QString &name, const QString &value)
void TimelineController::setActiveTrackProperty(const QString &name, const QString &value)
{
if (m_activeTrack > -1) {
m_model->setTrackProperty(m_activeTrack, name, value);
}
}
const QVariant TimelineController::getActiveTrackProperty(const QString &name)
{
if (m_activeTrack > -1) {
if (m_model->getTrackById_const(m_activeTrack)->isAudioTrack()) {
return QVariant(-1);
}
return m_model->getTrackProperty(m_activeTrack, name);
}
return QVariant();
}
......@@ -391,7 +391,8 @@ public:
/* @brief Set a property on the active track
*/
void setTrackProperty(const QString &name, const QString &value);
void setActiveTrackProperty(const QString &name, const QString &value);
const QVariant getActiveTrackProperty(const QString &name);
/* @brief Returns a list of all luma files used in the project
*/
......
......@@ -142,6 +142,7 @@ void TimelineWidget::setTimelineMenu(QMenu *clipMenu, QMenu *compositionMenu, QM
m_guideMenu = guideMenu;
m_headerMenu = headerMenu;
m_thumbsMenu = thumbsMenu;
m_headerMenu->addMenu(m_thumbsMenu);
m_editGuideAcion = editGuideAction;
updateEffectFavorites();
updateTransitionFavorites();
......@@ -155,7 +156,7 @@ void TimelineWidget::setTimelineMenu(QMenu *clipMenu, QMenu *compositionMenu, QM
m_proxy->setPosition(ac->data().toInt());
});
connect(m_headerMenu, &QMenu::triggered, [&] (QAction *ac) {
m_proxy->setTrackProperty(QStringLiteral("kdenlive:thumbs_format"), ac->data().toString());
m_proxy->setActiveTrackProperty(QStringLiteral("kdenlive:thumbs_format"), ac->data().toString());
});
m_timelineClipMenu->addMenu(m_favEffects);
m_timelineClipMenu->addMenu(m_favCompositions);
......@@ -228,6 +229,19 @@ void TimelineWidget::showCompositionMenu()
void TimelineWidget::showHeaderMenu()
{
int currentThumbs = m_proxy->getActiveTrackProperty(QStringLiteral("kdenlive:thumbs_format")).toInt();
if (currentThumbs >= 0) {
QList <QAction *> actions = m_thumbsMenu->actions();
for (QAction *ac : actions) {
if (ac->data().toInt() == currentThumbs) {
ac->setChecked(true);
break;
}
}
m_thumbsMenu->menuAction()->setVisible(true);
} else {
m_thumbsMenu->menuAction()->setVisible(false);
}
m_headerMenu->popup(m_clickPos);
connect(m_headerMenu, &QMenu::aboutToHide, [this]() {
slotUngrabHack();
......
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