This commit is contained in:
itsmattkc
2019-02-12 15:19:29 -08:00
8 changed files with 372 additions and 317 deletions
+22
View File
@@ -0,0 +1,22 @@
#include "cursors.h"
#include <QPixmap>
#include <QCursor>
#include <QDebug>
QCursor Olive::left_side;
QCursor Olive::right_side;
QCursor load_cursor(QString file, const int hotX, const int hotY, const bool right_aligned){
int hotX_out;
QPixmap temp = QPixmap(file);
right_aligned? hotX_out = temp.width() : hotX_out = hotX;
return QCursor(temp,hotX_out,hotY);
}
void initCustomCursors(){
qInfo() << "Loading Custom Cursors";
Olive::left_side = load_cursor(":/cursors/left_side.png", 0,-1, false);
Olive::right_side = load_cursor(":/cursors/right_side.png", 0,-1, true);
}
+13
View File
@@ -0,0 +1,13 @@
#ifndef CURSORS_H
#define CURSORS_H
#include <QCursor>
void initCustomCursors();
namespace Olive{
extern QCursor left_side;
extern QCursor right_side;
}
#endif // CURSORS_H
+10
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"
@@ -1986,6 +1987,8 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
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;
bool left_arrow_cursor = false;
bool right_arrow_cursor = false;
bool cursor_contains_clip = false;
int closeness = INT_MAX;
int min_track = INT_MAX;
@@ -2017,6 +2020,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
panel_timeline->trim_in_point = true;
closeness = nc;
found = true;
left_arrow_cursor = true;
}
}
if (c->timeline_out > mouse_frame_lower && c->timeline_out < mouse_frame_upper) {
@@ -2026,6 +2030,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
panel_timeline->trim_in_point = false;
closeness = nc;
found = true;
right_arrow_cursor = true;
}
}
if (panel_timeline->tool == TIMELINE_TOOL_POINTER) {
@@ -2064,6 +2069,11 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
QToolTip::showText(mapToGlobal(event->pos()), "HOVER OVER CLIP");
}*/
if (found) {
if (right_arrow_cursor && !panel_timeline->trim_in_point){
setCursor(Olive::right_side);
}else if (left_arrow_cursor && panel_timeline->trim_in_point){
setCursor(Olive::left_side);
}else
setCursor(Qt::SizeHorCursor);
} else {
panel_timeline->trim_target = -1;