Commit 1444cbd3 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix disabling autoscroll.

Fixes #312
parent 4d0c9d43
......@@ -237,6 +237,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
......
......@@ -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)
......
......@@ -217,7 +217,7 @@ Rectangle {
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 +822,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
......@@ -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)) {
......
......@@ -80,6 +80,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()
......@@ -1919,6 +1920,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();
......
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