Merge branch 'alcomposer-ui_clip_arrows'

This commit is contained in:
itsmattkc
2019-02-12 16:03:20 -08:00
8 changed files with 470 additions and 333 deletions
+6
View File
@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/cursors">
<file>left_side.png</file>
<file>right_side.png</file>
</qresource>
</RCC>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

+3
View File
@@ -15,6 +15,7 @@
#include "ui/viewerwidget.h"
#include "ui/sourceiconview.h"
#include "ui/timelineheader.h"
#include "ui/cursors.h"
#include "panels/panels.h"
#include "panels/project.h"
@@ -95,6 +96,8 @@ MainWindow::MainWindow(QWidget *parent, const QString &an) :
enable_launch_with_project(false),
appName(an)
{
init_custom_cursors();
open_debug_file();
debug_dialog = new DebugDialog(this);
+318 -317
View File
@@ -1,317 +1,318 @@
#-------------------------------------------------
#
# Project created by QtCreator 2018-05-11T10:31:59
#
#-------------------------------------------------
QT += core gui multimedia opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
mac {
TARGET = Olive
}
!mac {
TARGET = olive-editor
}
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# Tries to get the current Git short hash
system("which git") {
GITHASHVAR = $$system(git --git-dir $$PWD/.git --work-tree $$PWD log -1 --format=%h)
DEFINES += GITHASH=\\"\"$$GITHASHVAR\\"\"
}
CONFIG += c++11
CONFIG(debug, debug|release) {
CONFIG += console
}
SOURCES += \
main.cpp \
mainwindow.cpp \
panels/project.cpp \
panels/effectcontrols.cpp \
panels/viewer.cpp \
panels/timeline.cpp \
ui/sourcetable.cpp \
dialogs/aboutdialog.cpp \
ui/timelinewidget.cpp \
project/media.cpp \
project/footage.cpp \
project/sequence.cpp \
project/clip.cpp \
playback/playback.cpp \
playback/audio.cpp \
io/config.cpp \
dialogs/newsequencedialog.cpp \
ui/viewerwidget.cpp \
ui/viewercontainer.cpp \
dialogs/exportdialog.cpp \
ui/collapsiblewidget.cpp \
panels/panels.cpp \
playback/cacher.cpp \
io/exportthread.cpp \
ui/timelineheader.cpp \
io/previewgenerator.cpp \
ui/labelslider.cpp \
dialogs/preferencesdialog.cpp \
ui/audiomonitor.cpp \
project/undo.cpp \
ui/scrollarea.cpp \
ui/comboboxex.cpp \
ui/colorbutton.cpp \
dialogs/replaceclipmediadialog.cpp \
ui/fontcombobox.cpp \
ui/checkboxex.cpp \
ui/keyframeview.cpp \
ui/texteditex.cpp \
dialogs/demonotice.cpp \
project/marker.cpp \
dialogs/speeddialog.cpp \
dialogs/mediapropertiesdialog.cpp \
io/crc32.cpp \
project/projectmodel.cpp \
io/loadthread.cpp \
dialogs/loaddialog.cpp \
debug.cpp \
io/path.cpp \
effects/internal/linearfadetransition.cpp \
effects/internal/transformeffect.cpp \
effects/internal/solideffect.cpp \
effects/internal/texteffect.cpp \
effects/internal/timecodeeffect.cpp \
effects/internal/audionoiseeffect.cpp \
effects/internal/paneffect.cpp \
effects/internal/toneeffect.cpp \
effects/internal/volumeeffect.cpp \
effects/internal/crossdissolvetransition.cpp \
effects/internal/shakeeffect.cpp \
effects/internal/exponentialfadetransition.cpp \
effects/internal/logarithmicfadetransition.cpp \
effects/internal/cornerpineffect.cpp \
io/math.cpp \
io/qpainterwrapper.cpp \
project/effect.cpp \
project/transition.cpp \
project/effectrow.cpp \
project/effectfield.cpp \
effects/internal/cubetransition.cpp \
project/effectgizmo.cpp \
io/clipboard.cpp \
dialogs/stabilizerdialog.cpp \
io/avtogl.cpp \
ui/resizablescrollbar.cpp \
ui/sourceiconview.cpp \
project/sourcescommon.cpp \
ui/keyframenavigator.cpp \
panels/grapheditor.cpp \
ui/graphview.cpp \
ui/keyframedrawing.cpp \
ui/clickablelabel.cpp \
project/keyframe.cpp \
ui/rectangleselect.cpp \
dialogs/actionsearch.cpp \
ui/embeddedfilechooser.cpp \
effects/internal/fillleftrighteffect.cpp \
effects/internal/voideffect.cpp \
dialogs/texteditdialog.cpp \
dialogs/debugdialog.cpp \
ui/renderthread.cpp \
ui/renderfunctions.cpp \
ui/viewerwindow.cpp \
project/projectfilter.cpp \
effects/internal/frei0reffect.cpp \
project/effectloaders.cpp \
io/crossplatformlib.cpp \
effects/internal/vsthost.cpp \
ui/flowlayout.cpp \
dialogs/proxydialog.cpp \
io/proxygenerator.cpp \
dialogs/advancedvideodialog.cpp
HEADERS += \
mainwindow.h \
panels/project.h \
panels/effectcontrols.h \
panels/viewer.h \
panels/timeline.h \
ui/sourcetable.h \
dialogs/aboutdialog.h \
ui/timelinewidget.h \
project/media.h \
project/footage.h \
project/sequence.h \
project/clip.h \
playback/playback.h \
playback/audio.h \
io/config.h \
dialogs/newsequencedialog.h \
ui/viewerwidget.h \
ui/viewercontainer.h \
dialogs/exportdialog.h \
ui/collapsiblewidget.h \
panels/panels.h \
playback/cacher.h \
io/exportthread.h \
ui/timelinetools.h \
ui/timelineheader.h \
io/previewgenerator.h \
ui/labelslider.h \
dialogs/preferencesdialog.h \
ui/audiomonitor.h \
project/undo.h \
ui/scrollarea.h \
ui/comboboxex.h \
ui/colorbutton.h \
dialogs/replaceclipmediadialog.h \
ui/fontcombobox.h \
ui/checkboxex.h \
ui/keyframeview.h \
ui/texteditex.h \
dialogs/demonotice.h \
project/marker.h \
project/selection.h \
dialogs/speeddialog.h \
dialogs/mediapropertiesdialog.h \
io/crc32.h \
project/projectmodel.h \
io/loadthread.h \
dialogs/loaddialog.h \
debug.h \
io/path.h \
effects/internal/transformeffect.h \
effects/internal/solideffect.h \
effects/internal/texteffect.h \
effects/internal/timecodeeffect.h \
effects/internal/audionoiseeffect.h \
effects/internal/paneffect.h \
effects/internal/toneeffect.h \
effects/internal/volumeeffect.h \
effects/internal/shakeeffect.h \
effects/internal/linearfadetransition.h \
effects/internal/crossdissolvetransition.h \
effects/internal/exponentialfadetransition.h \
effects/internal/logarithmicfadetransition.h \
effects/internal/cornerpineffect.h \
io/math.h \
io/qpainterwrapper.h \
project/effect.h \
project/transition.h \
project/effectrow.h \
project/effectfield.h \
effects/internal/cubetransition.h \
project/effectgizmo.h \
io/clipboard.h \
dialogs/stabilizerdialog.h \
io/avtogl.h \
ui/resizablescrollbar.h \
ui/sourceiconview.h \
project/sourcescommon.h \
ui/keyframenavigator.h \
panels/grapheditor.h \
ui/graphview.h \
ui/keyframedrawing.h \
ui/clickablelabel.h \
project/keyframe.h \
ui/rectangleselect.h \
dialogs/actionsearch.h \
ui/embeddedfilechooser.h \
effects/internal/fillleftrighteffect.h \
effects/internal/voideffect.h \
dialogs/texteditdialog.h \
dialogs/debugdialog.h \
ui/renderthread.h \
ui/renderfunctions.h \
ui/viewerwindow.h \
project/projectfilter.h \
effects/internal/frei0reffect.h \
project/effectloaders.h \
io/crossplatformlib.h \
effects/internal/vsthost.h \
ui/flowlayout.h \
dialogs/proxydialog.h \
io/proxygenerator.h \
dialogs/advancedvideodialog.h
FORMS +=
TRANSLATIONS += \
ts/olive_de.ts \
ts/olive_es.ts \
ts/olive_fr.ts \
ts/olive_it.ts \
ts/olive_cs.ts \
ts/olive_ar.ts \
ts/olive_ru.ts
win32 {
RC_FILE = packaging/windows/resources.rc
LIBS += -lavutil -lavformat -lavcodec -lavfilter -lswscale -lswresample -lopengl32 -luser32
}
mac {
LIBS += -L/usr/local/lib -lavutil -lavformat -lavcodec -lavfilter -lswscale -lswresample -framework CoreFoundation
ICON = packaging/macos/olive.icns
INCLUDEPATH = /usr/local/include
}
unix:!mac {
CONFIG += link_pkgconfig
PKGCONFIG += libavutil libavformat libavcodec libavfilter libswscale libswresample
LIBS += -ldl
}
RESOURCES += \
icons/icons.qrc \
effects/internal/internalshaders.qrc
unix:!mac:isEmpty(PREFIX) {
PREFIX = /usr/local
}
unix:!mac:target.path = $$PREFIX/bin
effects.files = $$PWD/effects/*.frag $$PWD/effects/*.xml $$PWD/effects/*.vert
unix:!mac:effects.path = $$PREFIX/share/olive-editor/effects
translations.files = $$PWD/ts/*.qm
unix:!mac:translations.path = $$PREFIX/share/olive-editor/ts
unix:!mac {
metainfo.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.appdata.xml
metainfo.path = $$PREFIX/share/metainfo
desktop.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.desktop
desktop.path = $$PREFIX/share/applications
mime.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.xml
mime.path = $$PREFIX/share/mime/packages
icon16.files = $$PWD/packaging/linux/icons/16x16/org.olivevideoeditor.Olive.png
icon16.path = $$PREFIX/share/icons/hicolor/16x16/apps
icon32.files = $$PWD/packaging/linux/icons/32x32/org.olivevideoeditor.Olive.png
icon32.path = $$PREFIX/share/icons/hicolor/32x32/apps
icon48.files = $$PWD/packaging/linux/icons/48x48/org.olivevideoeditor.Olive.png
icon48.path = $$PREFIX/share/icons/hicolor/48x48/apps
icon64.files = $$PWD/packaging/linux/icons/64x64/org.olivevideoeditor.Olive.png
icon64.path = $$PREFIX/share/icons/hicolor/64x64/apps
icon128.files = $$PWD/packaging/linux/icons/128x128/org.olivevideoeditor.Olive.png
icon128.path = $$PREFIX/share/icons/hicolor/128x128/apps
icon256.files = $$PWD/packaging/linux/icons/256x256/org.olivevideoeditor.Olive.png
icon256.path = $$PREFIX/share/icons/hicolor/256x256/apps
icon512.files = $$PWD/packaging/linux/icons/512x512/org.olivevideoeditor.Olive.png
icon512.path = $$PREFIX/share/icons/hicolor/512x512/apps
icon1024.files = $$PWD/packaging/linux/icons/1024x1024/org.olivevideoeditor.Olive.png
icon1024.path = $$PREFIX/share/icons/hicolor/1024x1024/apps
INSTALLS += target effects translations metainfo desktop mime icon16 icon32 icon48 icon64 icon128 icon256 icon512 icon1024
}
#-------------------------------------------------
#
# Project created by QtCreator 2018-05-11T10:31:59
#
#-------------------------------------------------
QT += core gui multimedia opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
mac {
TARGET = Olive
}
!mac {
TARGET = olive-editor
}
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# Tries to get the current Git short hash
system("which git") {
GITHASHVAR = $$system(git --git-dir $$PWD/.git --work-tree $$PWD log -1 --format=%h)
DEFINES += GITHASH=\\"\"$$GITHASHVAR\\"\"
}
CONFIG += c++11
CONFIG(debug, debug|release) {
CONFIG += console
}
SOURCES += \
main.cpp \
mainwindow.cpp \
panels/project.cpp \
panels/effectcontrols.cpp \
panels/viewer.cpp \
panels/timeline.cpp \
ui/sourcetable.cpp \
dialogs/aboutdialog.cpp \
ui/timelinewidget.cpp \
project/media.cpp \
project/footage.cpp \
project/sequence.cpp \
project/clip.cpp \
playback/playback.cpp \
playback/audio.cpp \
io/config.cpp \
dialogs/newsequencedialog.cpp \
ui/viewerwidget.cpp \
ui/viewercontainer.cpp \
dialogs/exportdialog.cpp \
ui/collapsiblewidget.cpp \
panels/panels.cpp \
playback/cacher.cpp \
io/exportthread.cpp \
ui/timelineheader.cpp \
io/previewgenerator.cpp \
ui/labelslider.cpp \
dialogs/preferencesdialog.cpp \
ui/audiomonitor.cpp \
project/undo.cpp \
ui/scrollarea.cpp \
ui/comboboxex.cpp \
ui/colorbutton.cpp \
dialogs/replaceclipmediadialog.cpp \
ui/fontcombobox.cpp \
ui/checkboxex.cpp \
ui/keyframeview.cpp \
ui/texteditex.cpp \
dialogs/demonotice.cpp \
project/marker.cpp \
dialogs/speeddialog.cpp \
dialogs/mediapropertiesdialog.cpp \
io/crc32.cpp \
project/projectmodel.cpp \
io/loadthread.cpp \
dialogs/loaddialog.cpp \
debug.cpp \
io/path.cpp \
effects/internal/linearfadetransition.cpp \
effects/internal/transformeffect.cpp \
effects/internal/solideffect.cpp \
effects/internal/texteffect.cpp \
effects/internal/timecodeeffect.cpp \
effects/internal/audionoiseeffect.cpp \
effects/internal/paneffect.cpp \
effects/internal/toneeffect.cpp \
effects/internal/volumeeffect.cpp \
effects/internal/crossdissolvetransition.cpp \
effects/internal/shakeeffect.cpp \
effects/internal/exponentialfadetransition.cpp \
effects/internal/logarithmicfadetransition.cpp \
effects/internal/cornerpineffect.cpp \
io/math.cpp \
io/qpainterwrapper.cpp \
project/effect.cpp \
project/transition.cpp \
project/effectrow.cpp \
project/effectfield.cpp \
effects/internal/cubetransition.cpp \
project/effectgizmo.cpp \
io/clipboard.cpp \
dialogs/stabilizerdialog.cpp \
io/avtogl.cpp \
ui/resizablescrollbar.cpp \
ui/sourceiconview.cpp \
project/sourcescommon.cpp \
ui/keyframenavigator.cpp \
panels/grapheditor.cpp \
ui/graphview.cpp \
ui/keyframedrawing.cpp \
ui/clickablelabel.cpp \
project/keyframe.cpp \
ui/rectangleselect.cpp \
dialogs/actionsearch.cpp \
ui/embeddedfilechooser.cpp \
effects/internal/fillleftrighteffect.cpp \
effects/internal/voideffect.cpp \
dialogs/texteditdialog.cpp \
dialogs/debugdialog.cpp \
ui/renderthread.cpp \
ui/renderfunctions.cpp \
ui/viewerwindow.cpp \
project/projectfilter.cpp \
effects/internal/frei0reffect.cpp \
project/effectloaders.cpp \
io/crossplatformlib.cpp \
effects/internal/vsthost.cpp \
ui/flowlayout.cpp \
dialogs/proxydialog.cpp \
io/proxygenerator.cpp \
dialogs/advancedvideodialog.cpp \
ui/cursors.cpp
HEADERS += \
mainwindow.h \
panels/project.h \
panels/effectcontrols.h \
panels/viewer.h \
panels/timeline.h \
ui/sourcetable.h \
dialogs/aboutdialog.h \
ui/timelinewidget.h \
project/media.h \
project/footage.h \
project/sequence.h \
project/clip.h \
playback/playback.h \
playback/audio.h \
io/config.h \
dialogs/newsequencedialog.h \
ui/viewerwidget.h \
ui/viewercontainer.h \
dialogs/exportdialog.h \
ui/collapsiblewidget.h \
panels/panels.h \
playback/cacher.h \
io/exportthread.h \
ui/timelinetools.h \
ui/timelineheader.h \
io/previewgenerator.h \
ui/labelslider.h \
dialogs/preferencesdialog.h \
ui/audiomonitor.h \
project/undo.h \
ui/scrollarea.h \
ui/comboboxex.h \
ui/colorbutton.h \
dialogs/replaceclipmediadialog.h \
ui/fontcombobox.h \
ui/checkboxex.h \
ui/keyframeview.h \
ui/texteditex.h \
dialogs/demonotice.h \
project/marker.h \
project/selection.h \
dialogs/speeddialog.h \
dialogs/mediapropertiesdialog.h \
io/crc32.h \
project/projectmodel.h \
io/loadthread.h \
dialogs/loaddialog.h \
debug.h \
io/path.h \
effects/internal/transformeffect.h \
effects/internal/solideffect.h \
effects/internal/texteffect.h \
effects/internal/timecodeeffect.h \
effects/internal/audionoiseeffect.h \
effects/internal/paneffect.h \
effects/internal/toneeffect.h \
effects/internal/volumeeffect.h \
effects/internal/shakeeffect.h \
effects/internal/linearfadetransition.h \
effects/internal/crossdissolvetransition.h \
effects/internal/exponentialfadetransition.h \
effects/internal/logarithmicfadetransition.h \
effects/internal/cornerpineffect.h \
io/math.h \
io/qpainterwrapper.h \
project/effect.h \
project/transition.h \
project/effectrow.h \
project/effectfield.h \
effects/internal/cubetransition.h \
project/effectgizmo.h \
io/clipboard.h \
dialogs/stabilizerdialog.h \
io/avtogl.h \
ui/resizablescrollbar.h \
ui/sourceiconview.h \
project/sourcescommon.h \
ui/keyframenavigator.h \
panels/grapheditor.h \
ui/graphview.h \
ui/keyframedrawing.h \
ui/clickablelabel.h \
project/keyframe.h \
ui/rectangleselect.h \
dialogs/actionsearch.h \
ui/embeddedfilechooser.h \
effects/internal/fillleftrighteffect.h \
effects/internal/voideffect.h \
dialogs/texteditdialog.h \
dialogs/debugdialog.h \
ui/renderthread.h \
ui/renderfunctions.h \
ui/viewerwindow.h \
project/projectfilter.h \
effects/internal/frei0reffect.h \
project/effectloaders.h \
io/crossplatformlib.h \
effects/internal/vsthost.h \
ui/flowlayout.h \
dialogs/proxydialog.h \
io/proxygenerator.h \
dialogs/advancedvideodialog.h \
ui/cursors.h
FORMS +=
TRANSLATIONS += \
ts/olive_de.ts \
ts/olive_es.ts \
ts/olive_fr.ts \
ts/olive_it.ts \
ts/olive_cs.ts \
ts/olive_ar.ts \
ts/olive_ru.ts
win32 {
RC_FILE = packaging/windows/resources.rc
LIBS += -lavutil -lavformat -lavcodec -lavfilter -lswscale -lswresample -lopengl32 -luser32
}
mac {
LIBS += -L/usr/local/lib -lavutil -lavformat -lavcodec -lavfilter -lswscale -lswresample -framework CoreFoundation
ICON = packaging/macos/olive.icns
INCLUDEPATH = /usr/local/include
}
unix:!mac {
CONFIG += link_pkgconfig
PKGCONFIG += libavutil libavformat libavcodec libavfilter libswscale libswresample
LIBS += -ldl
}
RESOURCES += \
icons/icons.qrc \
effects/internal/internalshaders.qrc \
cursors/cursors.qrc
unix:!mac:isEmpty(PREFIX) {
PREFIX = /usr/local
}
unix:!mac:target.path = $$PREFIX/bin
effects.files = $$PWD/effects/*.frag $$PWD/effects/*.xml $$PWD/effects/*.vert
unix:!mac:effects.path = $$PREFIX/share/olive-editor/effects
translations.files = $$PWD/ts/*.qm
unix:!mac:translations.path = $$PREFIX/share/olive-editor/ts
unix:!mac {
metainfo.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.appdata.xml
metainfo.path = $$PREFIX/share/metainfo
desktop.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.desktop
desktop.path = $$PREFIX/share/applications
mime.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.xml
mime.path = $$PREFIX/share/mime/packages
icon16.files = $$PWD/packaging/linux/icons/16x16/org.olivevideoeditor.Olive.png
icon16.path = $$PREFIX/share/icons/hicolor/16x16/apps
icon32.files = $$PWD/packaging/linux/icons/32x32/org.olivevideoeditor.Olive.png
icon32.path = $$PREFIX/share/icons/hicolor/32x32/apps
icon48.files = $$PWD/packaging/linux/icons/48x48/org.olivevideoeditor.Olive.png
icon48.path = $$PREFIX/share/icons/hicolor/48x48/apps
icon64.files = $$PWD/packaging/linux/icons/64x64/org.olivevideoeditor.Olive.png
icon64.path = $$PREFIX/share/icons/hicolor/64x64/apps
icon128.files = $$PWD/packaging/linux/icons/128x128/org.olivevideoeditor.Olive.png
icon128.path = $$PREFIX/share/icons/hicolor/128x128/apps
icon256.files = $$PWD/packaging/linux/icons/256x256/org.olivevideoeditor.Olive.png
icon256.path = $$PREFIX/share/icons/hicolor/256x256/apps
icon512.files = $$PWD/packaging/linux/icons/512x512/org.olivevideoeditor.Olive.png
icon512.path = $$PREFIX/share/icons/hicolor/512x512/apps
INSTALLS += target effects translations metainfo desktop mime icon16 icon32 icon48 icon64 icon128 icon256 icon512
}
+29
View File
@@ -0,0 +1,29 @@
#include "cursors.h"
#include <QPixmap>
#include <QCursor>
#include <QDebug>
QCursor Olive::Cursor_LeftTrim;
QCursor Olive::Cursor_RightTrim;
QCursor load_cursor(const QString& file, int hotX, int hotY, const bool& right_aligned){
// load specified file into a pixmap
QPixmap temp(file);
// set cursor's horizontal hotspot
if (right_aligned) {
hotX = temp.width() - hotX;
}
// return cursor
return QCursor(temp, hotX, hotY);
}
void init_custom_cursors(){
qInfo() << "Initializing custom cursors";
Olive::Cursor_LeftTrim = load_cursor(":/cursors/left_side.png", 0, -1, false);
Olive::Cursor_RightTrim = load_cursor(":/cursors/right_side.png", 0, -1, true);
qInfo() << "Finished initializing custom cursors";
}
+13
View File
@@ -0,0 +1,13 @@
#ifndef CURSORS_H
#define CURSORS_H
#include <QCursor>
void init_custom_cursors();
namespace Olive{
extern QCursor Cursor_LeftTrim;
extern QCursor Cursor_RightTrim;
}
#endif // CURSORS_H
+101 -16
View File
@@ -23,6 +23,7 @@
#include "mainwindow.h"
#include "ui/rectangleselect.h"
#include "playback/playback.h"
#include "ui/cursors.h"
#include "debug.h"
#include "project/effect.h"
@@ -1977,62 +1978,132 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
} else if (panel_timeline->tool == TIMELINE_TOOL_POINTER ||
panel_timeline->tool == TIMELINE_TOOL_RIPPLE ||
panel_timeline->tool == TIMELINE_TOOL_ROLLING) {
// hide any tooltip that may be currently showing
QToolTip::hideText();
// cache cursor position
QPoint pos = event->pos();
//
// check to see if the cursor is on a clip edge
//
// threshold around a trim point that the cursor can be within and still considered "trimming"
int lim = 5;
long mouse_frame_lower = panel_timeline->getTimelineFrameFromScreenPoint(pos.x()-lim)-1;
long mouse_frame_upper = panel_timeline->getTimelineFrameFromScreenPoint(pos.x()+lim)+1;
// current track that the cursor is on
int mouse_track = getTrackFromScreenPoint(pos.y());
long mouse_frame_lower = panel_timeline->getTimelineFrameFromScreenPoint(pos.x()-lim)-1;
long mouse_frame_upper = panel_timeline->getTimelineFrameFromScreenPoint(pos.x()+lim)+1;
bool found = false;
// used to determine whether we the cursor found a trim point or not
bool found = false;
// used to determine whether the cursor is within the rect of a clip
bool cursor_contains_clip = false;
// used to determine how close the cursor is to a trim point
// (and more specifically, whether another point is closer or not)
int closeness = INT_MAX;
// while we loop through the clips, we cache the maximum/minimum tracks in this sequence
int min_track = INT_MAX;
int max_track = INT_MIN;
// we default to selecting no transition, but set this accordingly if the cursor is on a transition
panel_timeline->transition_select = TA_NO_TRANSITION;
// set currently trimming clip to -1 (aka null)
panel_timeline->trim_target = -1;
// loop through current clips in the sequence
for (int i=0;i<sequence->clips.size();i++) {
Clip* c = sequence->clips.at(i);
if (c != nullptr) {
// cache track range
min_track = qMin(min_track, c->track);
max_track = qMax(max_track, c->track);
// if this clip is on the same track the mouse is
if (c->track == mouse_track) {
// if this cursor is inside the boundaries of this clip (hovering over the clip)
if (panel_timeline->cursor_frame >= c->timeline_in &&
panel_timeline->cursor_frame <= c->timeline_out) {
// acknowledge that we are hovering over a clip
cursor_contains_clip = true;
// start a timer to show a tooltip about this clip
tooltip_timer.start();
tooltip_clip = i;
if (c->get_opening_transition() != nullptr && panel_timeline->cursor_frame <= c->timeline_in + c->get_opening_transition()->get_true_length()) {
// check if the cursor is specifically hovering over one of the clip's transitions
if (c->get_opening_transition() != nullptr
&& panel_timeline->cursor_frame <= c->timeline_in + c->get_opening_transition()->get_true_length()) {
panel_timeline->transition_select = TA_OPENING_TRANSITION;
} else if (c->get_closing_transition() != nullptr && panel_timeline->cursor_frame >= c->timeline_out - c->get_closing_transition()->get_true_length()) {
} else if (c->get_closing_transition() != nullptr
&& panel_timeline->cursor_frame >= c->timeline_out - c->get_closing_transition()->get_true_length()) {
panel_timeline->transition_select = TA_CLOSING_TRANSITION;
}
}
// is the cursor hovering around the clip's IN point?
if (c->timeline_in > mouse_frame_lower && c->timeline_in < mouse_frame_upper) {
// test how close this IN point is to the cursor
int nc = qAbs(c->timeline_in + 1 - panel_timeline->cursor_frame);
// and test whether it's closer than the last in/out point we found
if (nc < closeness) {
// if so, this is the point we'll make active for now (unless we find a closer one later)
panel_timeline->trim_target = i;
panel_timeline->trim_in_point = true;
closeness = nc;
found = true;
found = true;
}
}
// is the cursor hovering around the clip's OUT point?
if (c->timeline_out > mouse_frame_lower && c->timeline_out < mouse_frame_upper) {
// test how close this OUT point is to the cursor
int nc = qAbs(c->timeline_out - 1 - panel_timeline->cursor_frame);
// and test whether it's closer than the last in/out point we found
if (nc < closeness) {
// if so, this is the point we'll make active for now (unless we find a closer one later)
panel_timeline->trim_target = i;
panel_timeline->trim_in_point = false;
closeness = nc;
found = true;
found = true;
}
}
// the pointer can be used to resize/trim transitions, here we test if the
// cursor is within the trim point of one of the clip's transitions
if (panel_timeline->tool == TIMELINE_TOOL_POINTER) {
// if the clip has an opening transition
if (c->get_opening_transition() != nullptr) {
// cache the timeline frame where the transition ends
long transition_point = c->timeline_in + c->get_opening_transition()->get_true_length();
// check if the cursor is hovering around it (within the threshold)
if (transition_point > mouse_frame_lower && transition_point < mouse_frame_upper) {
// similar to above, test how close it is and if it's closer, make this active
int nc = qAbs(transition_point - 1 - panel_timeline->cursor_frame);
if (nc < closeness) {
panel_timeline->trim_target = i;
@@ -2043,9 +2114,17 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
}
}
}
// if the clip has a closing transition
if (c->get_closing_transition() != nullptr) {
// cache the timeline frame where the transition starts
long transition_point = c->timeline_out - c->get_closing_transition()->get_true_length();
// check if the cursor is hovering around it (within the threshold)
if (transition_point > mouse_frame_lower && transition_point < mouse_frame_upper) {
// similar to above, test how close it is and if it's closer, make this active
int nc = qAbs(transition_point + 1 - panel_timeline->cursor_frame);
if (nc < closeness) {
panel_timeline->trim_target = i;
@@ -2059,16 +2138,22 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
}
}
}
}
/*if (cursor_contains_clip) {
QToolTip::showText(mapToGlobal(event->pos()), "HOVER OVER CLIP");
}*/
if (found) {
setCursor(Qt::SizeHorCursor);
} else {
panel_timeline->trim_target = -1;
}
// look for track heights
// if the cursor is indeed on a clip edge, we set the cursor accordingly
if (found) {
if (panel_timeline->trim_in_point) { // if we're trimming an IN point
setCursor(Olive::Cursor_LeftTrim);
} else { // if we're trimming an OUT point
setCursor(Olive::Cursor_RightTrim);
}
} else {
// we didn't find a trim target, so we must be doing something else
// (e.g. dragging a clip or resizing the track heights)
// check to see if we're resizing a track height
int track_y = 0;
for (int i=0;i<panel_timeline->get_track_height_size(bottom_align);i++) {
int track = (bottom_align) ? -1-i : i;