better timeline scrollbars

This commit is contained in:
itsmattkc
2018-08-18 22:17:33 +10:00
parent 2b3d9636db
commit dacf0efd9a
5 changed files with 221 additions and 170 deletions
+6 -7
View File
@@ -69,6 +69,12 @@ Timeline::Timeline(QWidget *parent) :
ui->toolArrowButton->click();
int timeline_area_height = (ui->timeline_area->height()>>1);
ui->videoScrollArea->resize(ui->videoScrollArea->width(), timeline_area_height);
ui->audioScrollArea->resize(ui->audioScrollArea->width(), timeline_area_height);
connect(ui->audioScrollArea->horizontalScrollBar(), SIGNAL(valueChanged(int)), ui->videoScrollArea->horizontalScrollBar(), SLOT(setValue(int)));
connect(ui->audioScrollArea->horizontalScrollBar(), SIGNAL(valueChanged(int)), ui->headerScrollArea->horizontalScrollBar(), SLOT(setValue(int)));
update_sequence();
connect(&playback_updater, SIGNAL(timeout()), this, SLOT(repaint_timeline()));
@@ -397,13 +403,6 @@ void Timeline::set_zoom(bool in) {
} else {
zoom /= 2;
}
ui->timeline_area->horizontalScrollBar()->setValue(
lerp(
ui->timeline_area->horizontalScrollBar()->value(),
getTimelineScreenPointFromFrame(playhead) - (ui->timeline_area->width()/2),
0.99
)
);
redraw_all_clips(false);
}
+87 -36
View File
@@ -256,26 +256,74 @@
</widget>
</item>
<item>
<widget class="ScrollArea" name="timeline_area">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>819</width>
<height>557</height>
</rect>
<widget class="QWidget" name="timeline_area" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="headerScrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_5">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>821</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing">
<number>0</number>
</property>
@@ -293,6 +341,12 @@
</property>
<item>
<widget class="TimelineHeader" name="headers" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
@@ -304,6 +358,10 @@
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
@@ -336,11 +394,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>805</width>
<height>269</height>
<width>807</width>
<height>277</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
@@ -355,12 +416,6 @@
</property>
<item>
<widget class="TimelineWidget" name="video_area" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
@@ -377,7 +432,7 @@
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
@@ -390,11 +445,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>805</width>
<height>269</height>
<width>807</width>
<height>263</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
@@ -421,7 +479,6 @@
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="AudioMonitor" name="audio_monitor" native="true">
@@ -455,12 +512,6 @@
<header>ui/audiomonitor.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ScrollArea</class>
<extends>QScrollArea</extends>
<header>ui/scrollarea.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../icons/icons.qrc"/>
+1 -1
View File
@@ -10,7 +10,7 @@
#include <QLabel>
#include <QMouseEvent>
#define KEYFRAME_SIZE 5
#define KEYFRAME_SIZE 6
#define KEYFRAME_POINT_COUNT 4
KeyframeView::KeyframeView(QWidget *parent) : QWidget(parent), mouseover(false), visible_in(0), visible_out(0) {
+1 -1
View File
@@ -10,7 +10,6 @@ public:
explicit TimelineHeader(QWidget *parent = 0);
void set_in_point(long p);
void set_out_point(long p);
void set_visible_in(long i);
bool snapping;
@@ -40,6 +39,7 @@ private:
signals:
public slots:
void set_visible_in(long i);
};
#endif // TIMELINEHEADER_H
+2 -1
View File
@@ -10,6 +10,7 @@
#include "ui/sourcetable.h"
#include "panels/effectcontrols.h"
#include "project/undo.h"
#include "ui_timeline.h"
#include "effects/effect.h"
#include "effects/transition.h"
@@ -1576,8 +1577,8 @@ void TimelineWidget::redraw_clips() {
}
if (minimumWidth() != panel_width || clip_pixmap.height() != height() || panel_height != minimumHeight()) {
panel_timeline->ui->headers->setMinimumWidth(panel_width);
setMinimumWidth(panel_width);
container->setMinimumWidth(panel_width);
setMinimumHeight(panel_height);
clip_pixmap = QPixmap(qMax(width(), panel_width), qMax(height(), panel_height));
}