Commit 2c6b5b18 authored by Pistos Pi's avatar Pistos Pi Committed by Jean-Baptiste Mardelle
Browse files

Add scrolling orientation setting

Allow users to choose between:

- scroll wheel in timeline scrolls horizontally, Shift + scroll wheel scrolls vertically
- scroll wheel in timeline scrolls vertically, Shift + scroll wheel scrolls horizontally
parent 7e64ee1a
......@@ -159,7 +159,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QMap<QString, QString> mappable_a
m_configColors.setupUi(p10);
m_page10 = addPage(p10, i18n("Colors"));
m_page10->setIcon(QIcon::fromTheme(QStringLiteral("color-management")));
QWidget *p4 = new QWidget;
m_configCapture.setupUi(p4);
// Remove ffmpeg tab, unused
......@@ -395,7 +395,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QMap<QString, QString> mappable_a
// No blackmagic card found
m_configSdl.kcfg_external_display->setEnabled(false);
}
initAudioRecDevice();
// Config dialog size
......@@ -880,7 +880,7 @@ void KdenliveSettingsDialog::updateSettings()
if (m_configEnv.mediainfourl->text().isEmpty()) {
m_configEnv.mediainfourl->setText(KdenliveSettings::mediainfopath());
}
if (m_configTimeline.kcfg_trackheight->value() == 0) {
QFont ft = QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont);
// Default unit for timeline.qml objects size
......@@ -895,7 +895,7 @@ void KdenliveSettingsDialog::updateSettings()
m_configTimeline.kcfg_trackheight->setValue(baseUnit);
}
}
bool resetConsumer = false;
bool fullReset = false;
bool updateCapturePath = false;
......@@ -1041,7 +1041,7 @@ void KdenliveSettingsDialog::updateSettings()
KdenliveSettings::setWindow_background(m_configSdl.kcfg_window_background->color());
emit updateMonitorBg();
}
if (m_configColors.kcfg_thumbColor1->color() != KdenliveSettings::thumbColor1() || m_configColors.kcfg_thumbColor2->color() != KdenliveSettings::thumbColor2()) {
KdenliveSettings::setThumbColor1(m_configColors.kcfg_thumbColor1->color());
KdenliveSettings::setThumbColor2(m_configColors.kcfg_thumbColor2->color());
......@@ -1109,6 +1109,11 @@ void KdenliveSettingsDialog::updateSettings()
KdenliveSettings::setPauseonseek(m_configTimeline.kcfg_pauseonseek->isChecked());
}
if (m_configTimeline.kcfg_scrollvertically->isChecked() != KdenliveSettings::scrollvertically()) {
KdenliveSettings::setScrollvertically(m_configTimeline.kcfg_scrollvertically->isChecked());
emit pCore->window()->getMainTimeline()->controller()->scrollVerticallyChanged();
}
// Mimes
if (m_configEnv.kcfg_addedExtensions->text() != KdenliveSettings::addedExtensions()) {
// Update list
......
......@@ -80,12 +80,12 @@
<label>Default image sequence frame duration.</label>
<default>00:00:03:00</default>
</entry>
<entry name="mix_duration" type="String">
<label>Default mix transition duration.</label>
<default>00:00:01:00</default>
</entry>
<entry name="subtitle_duration" type="String">
<label>Default subtitle duration.</label>
<default>00:00:05:00</default>
......@@ -311,7 +311,7 @@
<label>Display all channels in audio thumbnails.</label>
<default>false</default>
</entry>
<entry name="normalizechannels" type="Bool">
<label>Normalize audio channels in thumbnails.</label>
<default>true</default>
......@@ -332,6 +332,11 @@
<default>false</default>
</entry>
<entry name="scrollvertically" type="Bool">
<label>Scroll vertically with scroll wheel, horizontally with Shift + scroll wheel</label>
<default>false</default>
</entry>
<entry name="trackheight" type="Int">
<label>Tracks height in pixel.</label>
<default>0</default>
......@@ -458,7 +463,7 @@
<label>FFprobe / avprobe binary path.</label>
<default></default>
</entry>
<entry name="mediainfopath" type="Path">
<label>mediaInfo binary path.</label>
<default></default>
......@@ -508,7 +513,7 @@
<label>Open Library in default system folder.</label>
<default>true</default>
</entry>
<entry name="videotodefaultfolder" type="Bool">
<label>Save titles, scripted renderings in default system folder.</label>
<default>true</default>
......@@ -518,7 +523,7 @@
<label>Default folder for library.</label>
<default></default>
</entry>
<entry name="videofolder" type="Path">
<label>Default folder for various stored files, like titles, scripted rendering.</label>
<default></default>
......@@ -577,7 +582,7 @@
<label>Audio device for v4l capture.</label>
<default></default>
</entry>
<entry name="alsachannels" type="UInt">
<label>Number of audio channels.</label>
<default>2</default>
......@@ -607,27 +612,27 @@
<label>Should we capture video.</label>
<default>true</default>
</entry>
<entry name="v4l_captureaudio" type="Bool">
<label>Should we also capture audio.</label>
<default>false</default>
</entry>
<entry name="v4l_profile" type="Int">
<label>default v4l encoding profile.</label>
<default>0</default>
</entry>
<entry name="grab_profile" type="Int">
<label>default screen grab encoding profile.</label>
<default>0</default>
</entry>
<entry name="grab_parameters" type="String">
<label>Default video4linux format.</label>
<default></default>
</entry>
<entry name="grab_extension" type="String">
<label>Default screen grab file extension.</label>
<default></default>
......@@ -697,7 +702,7 @@
<label>default HDMI capture filename.</label>
<default>capture</default>
</entry>
<entry name="decklink_parameters" type="String">
<label>Default Decklink encoding parameters.</label>
<default></default>
......@@ -724,7 +729,7 @@
<label>Available shuttle device names.</label>
<default></default>
</entry>
<entry name="shuttledevicepaths" type="StringList">
<label>Available shuttle device paths.</label>
<default></default>
......@@ -735,7 +740,7 @@
<default></default>
</entry>
</group>
<group name="bezier_spline">
<entry name="bezier_gridlines" type="Int">
<label>Number of lines to use for the grid.</label>
......@@ -798,7 +803,7 @@
<label>Show timecodes as frame number instead of hh:mm:ss:ff.</label>
<default>false</default>
</entry>
<entry name="rectimecode" type="Bool">
<label>Show recorded timecode in clip monitor, in format hh:mm:ss:ff.</label>
<default>false</default>
......@@ -846,12 +851,12 @@
<label>Show overlay info on monitor (in / out points, markers,...).</label>
<default>0x05</default>
</entry>
<entry name="previewScaling" type="Int">
<label>Divide monitor resolution by this factor to speedup preview.</label>
<default>1</default>
</entry>
<entry name="autoKeyframe" type="Bool">
<label>Automatically create a new keyframe on keyframe move.</label>
<default>true</default>
......@@ -865,7 +870,7 @@
<label>index of current guides overlay for project monitor.</label>
<default>0</default>
</entry>
<entry name="alwaysShowMonitorAudio" type="Bool">
<label>Always display audio thumbs in clip monitor.</label>
<default>false</default>
......@@ -925,17 +930,17 @@
<label>Color to preselect in the color clip dialog.</label>
<default>#000000</default>
</entry>
<entry name="showSubtitles" type="Bool">
<label>Show subtitle track.</label>
<default>false</default>
</entry>
<entry name="thumbColor1" type="Color">
<label>Color to draw even audio channels.</label>
<default>#2ac1a0</default>
</entry>
<entry name="thumbColor2" type="Color">
<label>Color to draw odd audio channels.</label>
<default>#2ed172</default>
......@@ -978,7 +983,7 @@
<entry name="showstopmotionthumbs" type="Bool">
<label>Show sequence thumbnails in stopmotion widget.</label>
<default>true</default>
</entry>
</entry>
<entry name="captureinterval" type="Int">
<label>Interval between each capture (in seconds).</label>
......@@ -1004,12 +1009,12 @@
<label>Should we play a sound to notify of captured frame in stop motion.</label>
<default>false</default>
</entry>
<entry name="sm_framesplayback" type="Int">
<label>Number of frames to play back in stop motion playback.</label>
<default>10</default>
</entry>
<entry name="stopmotioneffect" type="Int">
<label>Effect applied to stopmotion frame overlay.</label>
<default>0</default>
......
......@@ -59,7 +59,7 @@ Rectangle {
mainItemId = -1
}
}
function getActiveTrackStreamPos() {
return Logic.getTrackYFromId(timeline.activeTrack) + rulercontainer.height
}
......@@ -104,13 +104,25 @@ Rectangle {
root.wheelAccumulatedDelta = 0;
}
} else if (wheel.modifiers & Qt.ShiftModifier) {
// Vertical scroll
var newScroll = Math.min(scrollView.contentY - wheel.angleDelta.y, trackHeaders.height - tracksArea.height + horScroll.height + ruler.height)
scrollView.contentY = Math.max(newScroll, 0)
if (scrollVertically) {
// Horizontal scroll
var newScroll = Math.min(scrollView.contentX - wheel.angleDelta.y, timeline.fullDuration * root.timeScale - scrollView.width)
scrollView.contentX = Math.max(newScroll, 0)
} else {
// Vertical scroll
var newScroll = Math.min(scrollView.contentY - wheel.angleDelta.y, trackHeaders.height - tracksArea.height + horScroll.height + ruler.height)
scrollView.contentY = Math.max(newScroll, 0)
}
} else {
// Horizontal scroll
var newScroll = Math.min(scrollView.contentX - wheel.angleDelta.y, timeline.fullDuration * root.timeScale - scrollView.width)
scrollView.contentX = Math.max(newScroll, 0)
if (scrollVertically) {
// Vertical scroll
var newScroll = Math.min(scrollView.contentY - wheel.angleDelta.y, trackHeaders.height - tracksArea.height + horScroll.height + ruler.height)
scrollView.contentY = Math.max(newScroll, 0)
} else {
// Horizontal scroll
var newScroll = Math.min(scrollView.contentX - wheel.angleDelta.y, timeline.fullDuration * root.timeScale - scrollView.width)
scrollView.contentX = Math.max(newScroll, 0)
}
}
wheel.accepted = true
}
......@@ -202,7 +214,7 @@ Rectangle {
}
return col
}
function centerViewOnCursor() {
scrollView.contentX = Math.max(0, root.consumerPosition * timeline.scaleFactor - (scrollView.width / 2))
}
......@@ -315,11 +327,12 @@ Rectangle {
property bool subtitlesLocked: timeline.subtitlesLocked
property bool subtitlesDisabled: timeline.subtitlesDisabled
property int trackTagWidth: fontMetrics.boundingRect("M").width
property bool scrollVertically: timeline.scrollVertically
onSeekingFinishedChanged : {
playhead.opacity = seekingFinished ? 1 : 0.5
}
onShowSubtitlesChanged: {
subtitleTrack.height = showSubtitles? root.baseUnit * 5 : 0
}
......@@ -729,7 +742,7 @@ Rectangle {
anchors.left: parent.left
anchors.leftMargin: 2 * root.trackTagWidth
width: root.collapsedHeight
height: root.collapsedHeight
height: root.collapsedHeight
contentItem: Item {
Image {
source: subtitleTrackHeader.collapsed ? "image://icon/go-next" : "image://icon/go-down"
......@@ -755,7 +768,7 @@ Rectangle {
text: i18n("Subtitles")
visible: (subtitleTrackHeader.height > root.collapsedHeight + subLabel.height)
}
Row {
id: subButtonsRow
width: childrenRect.width
......
......@@ -1397,7 +1397,7 @@ void TimelineController::selectItems(const QVariantList &tracks, int startFrame,
auto currentSubs = subtitleModel->getItemsInRange(startFrame, endFrame);
itemsToSelect.insert(currentSubs.begin(), currentSubs.end());
}
}
m_model->requestSetSelection(itemsToSelect);
}
......@@ -1472,7 +1472,7 @@ void TimelineController::cutSubtitle(int id, int cursorPos)
Fun redo = []() { return true; };
bool res = subtitleModel->cutSubtitle(timelinePos, undo, redo);
if (res) {
Fun local_redo = [subtitleModel, start, position, firstText, secondText]() {
Fun local_redo = [subtitleModel, start, position, firstText, secondText]() {
subtitleModel->editSubtitle(start, firstText);
subtitleModel->editSubtitle(position, secondText);
return true;
......@@ -1863,6 +1863,11 @@ bool TimelineController::useRuler() const
return pCore->currentDoc()->getDocumentProperty(QStringLiteral("enableTimelineZone")).toInt() == 1;
}
bool TimelineController::scrollVertically() const
{
return KdenliveSettings::scrollvertically() == 1;
}
void TimelineController::resetPreview()
{
if (m_timelinePreview) {
......
......@@ -62,6 +62,7 @@ class TimelineController : public QObject
Q_PROPERTY(QVariantList renderedChunks READ renderedChunks NOTIFY renderedChunksChanged)
Q_PROPERTY(int workingPreview READ workingPreview NOTIFY workingPreviewChanged)
Q_PROPERTY(bool useRuler READ useRuler NOTIFY useRulerChanged)
Q_PROPERTY(bool scrollVertically READ scrollVertically NOTIFY scrollVerticallyChanged)
Q_PROPERTY(int activeTrack READ activeTrack WRITE setActiveTrack NOTIFY activeTrackChanged)
Q_PROPERTY(QVariantList audioTarget READ audioTarget NOTIFY audioTargetChanged)
Q_PROPERTY(int videoTarget READ videoTarget WRITE setVideoTarget NOTIFY videoTargetChanged)
......@@ -247,7 +248,7 @@ public:
Q_INVOKABLE const QString actionText(const QString &name);
/* @brief Returns id of the timeline selected clip if there is only 1 clip selected
* or an AVSplit group. If allowComposition is true, returns composition id if
* or an AVSplit group. If allowComposition is true, returns composition id if
* only 1 is selected, otherwise returns -1. If restrictToCurrentPos is true, it will
* only return the id if timeline cursor is inside item
*/
......@@ -502,6 +503,10 @@ public:
/** @brief Return true if we want to use timeline ruler zone for editing */
bool useRuler() const;
/** @brief Return true if the scroll wheel should scroll vertically (Shift key for horizontal); false if it should scroll horizontally (Shift for vertical) */
bool scrollVertically() const;
/* @brief Load timeline preview from saved doc
*/
void loadPreview(const QString &chunks, const QString &dirty, const QDateTime &documentDate, int enable);
......@@ -700,6 +705,7 @@ signals:
void subtitlesDisabledChanged();
void subtitlesLockedChanged();
void useRulerChanged();
void scrollVerticallyChanged();
void updateZoom(double);
/* @brief emitted when timeline selection changes, true if a clip is selected
*/
......
......@@ -11,7 +11,7 @@
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="8" column="0" colspan="4">
<item row="9" column="0" colspan="4">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Raise properties pane when selecting in timeline</string>
......@@ -54,7 +54,7 @@
</layout>
</widget>
</item>
<item row="9" column="0">
<item row="10" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -113,7 +113,7 @@
</layout>
</widget>
</item>
<item row="7" column="0" colspan="4">
<item row="8" column="0" colspan="4">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Multi stream audio clips</string>
......@@ -168,7 +168,7 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="4">
<item row="7" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
......@@ -226,6 +226,13 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_scrollvertically">
<property name="text">
<string>Scroll vertically with scroll wheel, horizontally with Shift + scroll wheel</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_showmarkers">
<property name="text">
......@@ -240,6 +247,7 @@
<tabstop>kcfg_showmarkers</tabstop>
<tabstop>kcfg_autoscroll</tabstop>
<tabstop>kcfg_verticalzoom</tabstop>
<tabstop>kcfg_scrollvertically</tabstop>
<tabstop>kcfg_trackheight</tabstop>
</tabstops>
<resources/>
......
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