Commit 98dbc8c6 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Merge branch '1908'

parents 964a42dd 853bbd53
Pipeline #7146 passed with stage
in 20 minutes and 26 seconds
......@@ -236,6 +236,7 @@ signals:
/** @brief Call config dialog on a selected page / tab */
void showConfigDialog(int, int);
void finalizeRecording(const QString &captureFile);
void autoScrollChanged();
};
#endif
......@@ -1025,6 +1025,11 @@ void KdenliveSettingsDialog::updateSettings()
emit resetView();
}
if (m_configTimeline.kcfg_autoscroll->isChecked() != KdenliveSettings::autoscroll()) {
KdenliveSettings::setAutoscroll(m_configTimeline.kcfg_autoscroll->isChecked());
pCore->autoScrollChanged();
}
// Mimes
if (m_configEnv.kcfg_addedExtensions->text() != KdenliveSettings::addedExtensions()) {
// Update list
......
......@@ -118,6 +118,8 @@ void EffectsRepository::parseCustomAssetFile(const QString &file_name, std::unor
result.xml = currentEffect;
// Parse type information.
// Video effect by default
result.type = EffectType::Video;
QString type = currentEffect.attribute(QStringLiteral("type"), QString());
if (type == QLatin1String("audio")) {
result.type = EffectType::Audio;
......@@ -146,10 +148,7 @@ void EffectsRepository::parseCustomAssetFile(const QString &file_name, std::unor
}
file.close();
}
} else {
result.type = EffectType::Video;
}
customAssets[result.id] = result;
}
}
......
......@@ -103,7 +103,6 @@
#include <QStatusBar>
#include <QStyleFactory>
#include <QUndoGroup>
#include <KConfigGroup>
#include <QDesktopWidget>
#include <QDialogButtonBox>
......@@ -2008,6 +2007,7 @@ void MainWindow::connectDocument()
m_buttonSelectTool->setChecked(true);
connect(m_projectMonitorDock, &QDockWidget::visibilityChanged, m_projectMonitor, &Monitor::slotRefreshMonitor, Qt::UniqueConnection);
connect(m_clipMonitorDock, &QDockWidget::visibilityChanged, m_clipMonitor, &Monitor::slotRefreshMonitor, Qt::UniqueConnection);
getMainTimeline()->focusTimeline();
}
void MainWindow::slotZoneMoved(int start, int end)
......
......@@ -1128,7 +1128,7 @@ void Monitor::checkOverlay(int pos)
pos = m_timePos->getValue();
}
QPoint zone = m_glMonitor->getControllerProxy()->zone();
std::shared_ptr<MarkerListModel> model;
std::shared_ptr<MarkerListModel> model(nullptr);
if (m_id == Kdenlive::ClipMonitor && m_controller) {
model = m_controller->getMarkerModel();
} else if (m_id == Kdenlive::ProjectMonitor && pCore->currentDoc()) {
......
......@@ -84,6 +84,8 @@ Rectangle {
onIsGrabbedChanged: {
if (clipRoot.isGrabbed) {
grabItem()
} else {
mouseArea.focus = false
}
}
......@@ -272,6 +274,7 @@ Rectangle {
}
Keys.onEscapePressed: {
timeline.grabCurrent()
//focus = false
}
onPositionChanged: {
var mapped = parentTrack.mapFromItem(clipRoot, mouse.x, mouse.y).x
......
......@@ -17,8 +17,8 @@
*/
function scrollIfNeeded() {
var x = timeline.position * timeline.scaleFactor;
if (!scrollView) return;
var x = timeline.position * timeline.scaleFactor;
if (x > scrollView.flickableItem.contentX + scrollView.width - 50)
scrollView.flickableItem.contentX = x - scrollView.width + 50;
else if (x < 50)
......
......@@ -57,7 +57,7 @@ Rectangle {
playhead.fillColor = activePalette.windowText
ruler.repaintRuler()
}
function moveSelectedTrack(offset) {
var cTrack = Logic.getTrackIndexFromId(timeline.activeTrack)
var newTrack = cTrack + offset
......@@ -211,13 +211,19 @@ Rectangle {
}
return tentativeClip
}
Keys.onDownPressed: {
root.moveSelectedTrack(1)
}
Keys.onUpPressed: {
root.moveSelectedTrack(-1)
}
property int headerWidth: timeline.headerWidth()
property int activeTool: 0
property real baseUnit: fontMetrics.font.pointSize
property color selectedTrackColor: Qt.rgba(activePalette.highlight.r, activePalette.highlight.g, activePalette.highlight.b, 0.2)
property color frameColor: Qt.rgba(activePalette.shadow.r, activePalette.shadow.g, activePalette.shadow.b, 0.3)
property bool stopScrolling: false
property bool autoScrolling: timeline.autoScroll
property int duration: timeline.duration
property color audioColor: timeline.audioColor
property color videoColor: timeline.videoColor
......@@ -822,10 +828,10 @@ Rectangle {
drag.smoothed: false
onPressed: {
root.stopScrolling = true
root.autoScrolling = false
}
onReleased: {
root.stopScrolling = false
root.autoScrolling = timeline.autoScroll
parent.opacity = 0
}
onEntered: parent.opacity = 0.5
......@@ -848,12 +854,6 @@ Rectangle {
property real clickY
width: root.width - headerWidth
height: root.height
Keys.onDownPressed: {
root.moveSelectedTrack(1)
}
Keys.onUpPressed: {
root.moveSelectedTrack(-1)
}
// This provides continuous scrubbing and scimming at the left/right edges.
hoverEnabled: true
acceptedButtons: Qt.RightButton | Qt.LeftButton | Qt.MidButton
......@@ -1136,7 +1136,7 @@ Rectangle {
controller.requestAddToSelection(dragProxy.draggedItem, /*clear=*/ true)
}
timeline.showAsset(dragProxy.draggedItem)
root.stopScrolling = true
root.autoScrolling = false
clipBeingMovedId = dragProxy.draggedItem
if (dragProxy.draggedItem > -1) {
var tk = controller.getItemTrackId(dragProxy.draggedItem)
......@@ -1230,7 +1230,7 @@ Rectangle {
}
onReleased: {
clipBeingMovedId = -1
root.stopScrolling = false
root.autoScrolling = timeline.autoScroll
if (dragProxy.draggedItem > -1 && dragFrame > -1 && (controller.isClip(dragProxy.draggedItem) || controller.isComposition(dragProxy.draggedItem))) {
var tId = controller.getItemTrackId(dragProxy.draggedItem)
if (dragProxy.isComposition) {
......@@ -1488,7 +1488,7 @@ Rectangle {
Connections {
target: timeline
onPositionChanged: if (!stopScrolling) Logic.scrollIfNeeded()
onPositionChanged: if (autoScrolling) Logic.scrollIfNeeded()
onFrameFormatChanged: ruler.adjustFormat()
onSelectionChanged: {
if (dragProxy.draggedItem > -1 && !timeline.exists(dragProxy.draggedItem)) {
......
......@@ -77,6 +77,7 @@ TimelineController::TimelineController(QObject *parent)
connect(this, &TimelineController::audioTargetChanged, this, &TimelineController::updateAudioTarget);
m_disablePreview->setEnabled(false);
connect(pCore.get(), &Core::finalizeRecording, this, &TimelineController::finishRecording);
connect(pCore.get(), &Core::autoScrollChanged, this, &TimelineController::autoScrollChanged);
}
TimelineController::~TimelineController()
......@@ -1916,6 +1917,11 @@ bool TimelineController::hasVideoTarget() const
return m_hasVideoTarget;
}
bool TimelineController::autoScroll() const
{
return KdenliveSettings::autoscroll();
}
void TimelineController::resetTrackHeight()
{
int tracksCount = m_model->getTracksCount();
......
......@@ -67,12 +67,13 @@ class TimelineController : public QObject
Q_PROPERTY(int activeTrack READ activeTrack WRITE setActiveTrack NOTIFY activeTrackChanged)
Q_PROPERTY(int audioTarget READ audioTarget WRITE setAudioTarget NOTIFY audioTargetChanged)
Q_PROPERTY(int videoTarget READ videoTarget WRITE setVideoTarget NOTIFY videoTargetChanged)
Q_PROPERTY(int lastAudioTarget MEMBER m_lastAudioTarget NOTIFY lastAudioTargetChanged)
Q_PROPERTY(int lastVideoTarget MEMBER m_lastVideoTarget NOTIFY lastVideoTargetChanged)
Q_PROPERTY(bool hasAudioTarget READ hasAudioTarget NOTIFY hasAudioTargetChanged)
Q_PROPERTY(bool hasVideoTarget READ hasVideoTarget NOTIFY hasVideoTargetChanged)
Q_PROPERTY(bool autoScroll READ autoScroll NOTIFY autoScrollChanged)
Q_PROPERTY(QColor videoColor READ videoColor NOTIFY colorsChanged)
Q_PROPERTY(QColor audioColor READ audioColor NOTIFY colorsChanged)
Q_PROPERTY(QColor lockedColor READ lockedColor NOTIFY colorsChanged)
......@@ -150,6 +151,7 @@ public:
Q_INVOKABLE int videoTarget() const;
Q_INVOKABLE bool hasAudioTarget() const;
Q_INVOKABLE bool hasVideoTarget() const;
Q_INVOKABLE bool autoScroll() const;
Q_INVOKABLE int activeTrack() const { return m_activeTrack; }
Q_INVOKABLE QColor videoColor() const;
Q_INVOKABLE QColor audioColor() const;
......@@ -541,6 +543,7 @@ signals:
void hasAudioTargetChanged();
void hasVideoTargetChanged();
void lastAudioTargetChanged();
void autoScrollChanged();
void lastVideoTargetChanged();
void activeTrackChanged();
void colorsChanged();
......
......@@ -224,3 +224,11 @@ int TimelineWidget::zoomForScale(double value) const
}
return ix;
}
void TimelineWidget::focusTimeline()
{
setFocus();
if (rootObject()) {
rootObject()->setFocus(true);
}
}
......@@ -50,6 +50,8 @@ public:
QPoint getTracksCount() const;
/* @brief calculate zoom level for a scale */
int zoomForScale(double value) const;
/* @brief Give keyboard focus to timeline qml */
void focusTimeline();
bool loading;
protected:
......
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