helpful tooltips implemented
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "io/media.h"
|
||||
#include "ui/sourcetable.h"
|
||||
#include "panels/effectcontrols.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "project/undo.h"
|
||||
#include "ui_timeline.h"
|
||||
#include "mainwindow.h"
|
||||
@@ -42,6 +43,9 @@ TimelineWidget::TimelineWidget(QWidget *parent) : QWidget(parent) {
|
||||
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu(const QPoint&)));
|
||||
|
||||
tooltip_timer.setInterval(500);
|
||||
connect(&tooltip_timer, SIGNAL(timeout()), this, SLOT(tooltip_timer_timeout()));
|
||||
}
|
||||
|
||||
void TimelineWidget::right_click_ripple() {
|
||||
@@ -162,6 +166,19 @@ void TimelineWidget::toggle_autoscale() {
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidget::tooltip_timer_timeout() {
|
||||
if (sequence != NULL) {
|
||||
Clip* c = sequence->clips.at(tooltip_clip);
|
||||
if (c != NULL) {
|
||||
QToolTip::showText(QCursor::pos(),
|
||||
c->name
|
||||
+ "\nStart: " + frame_to_timecode(c->timeline_in, config.timecode_view, sequence->frame_rate)
|
||||
+ "\nEnd: " + frame_to_timecode(c->timeline_out, config.timecode_view, sequence->frame_rate)
|
||||
+ "\nDuration: " + frame_to_timecode(c->getLength(), config.timecode_view, sequence->frame_rate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool same_sign(int a, int b) {
|
||||
return (a < 0) == (b < 0);
|
||||
}
|
||||
@@ -1215,9 +1232,12 @@ void TimelineWidget::update_ghosts(QPoint& mouse_pos) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QToolTip::showText(mapToGlobal(mouse_pos), ((frame_diff < 0) ? "-" : "+") + frame_to_timecode(qAbs(frame_diff), config.timecode_view, sequence->frame_rate));
|
||||
}
|
||||
|
||||
void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
tooltip_timer.stop();
|
||||
if (sequence != NULL) {
|
||||
bool alt = (event->modifiers() & Qt::AltModifier);
|
||||
|
||||
@@ -1596,6 +1616,9 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
panel_timeline->cursor_frame <= c->timeline_out) {
|
||||
cursor_contains_clip = true;
|
||||
|
||||
tooltip_timer.start();
|
||||
tooltip_clip = i;
|
||||
|
||||
if (c->opening_transition != NULL && panel_timeline->cursor_frame <= c->timeline_in + c->opening_transition->length) {
|
||||
panel_timeline->transition_select = TA_OPENING_TRANSITION;
|
||||
} else if (c->closing_transition != NULL && panel_timeline->cursor_frame >= c->timeline_out - c->closing_transition->length) {
|
||||
@@ -1695,6 +1718,10 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidget::leaveEvent(QEvent *event) {
|
||||
tooltip_timer.stop();
|
||||
}
|
||||
|
||||
int color_brightness(int r, int g, int b) {
|
||||
return (0.2126*r + 0.7152*g + 0.0722*b);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef TIMELINEWIDGET_H
|
||||
#define TIMELINEWIDGET_H
|
||||
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
#include "timelinetools.h"
|
||||
|
||||
@@ -33,6 +34,7 @@ protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
@@ -63,6 +65,9 @@ private:
|
||||
// used for "right click ripple"
|
||||
long rc_ripple_min;
|
||||
long rc_ripple_max;
|
||||
|
||||
QTimer tooltip_timer;
|
||||
int tooltip_clip;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
@@ -71,6 +76,7 @@ private slots:
|
||||
void right_click_ripple();
|
||||
void show_context_menu(const QPoint& pos);
|
||||
void toggle_autoscale();
|
||||
void tooltip_timer_timeout();
|
||||
};
|
||||
|
||||
#endif // TIMELINEWIDGET_H
|
||||
|
||||
Reference in New Issue
Block a user