Merge branch 'master' into gizmos
This commit is contained in:
@@ -22,6 +22,11 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
@@ -48,40 +53,51 @@ SliderLabel::SliderLabel(QWidget *parent) :
|
||||
setFocusPolicy(Qt::TabFocus);
|
||||
}
|
||||
|
||||
void SliderLabel::mousePressEvent(QMouseEvent *ev)
|
||||
void SliderLabel::mousePressEvent(QMouseEvent *)
|
||||
{
|
||||
QLabel::mousePressEvent(ev);
|
||||
emit drag_start();
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
CGAssociateMouseAndMouseCursorPosition(false);
|
||||
CGDisplayHideCursor(kCGDirectMainDisplay);
|
||||
CGGetLastMouseDelta(nullptr, nullptr);
|
||||
#else
|
||||
drag_start_ = QCursor::pos();
|
||||
|
||||
static_cast<QGuiApplication*>(QApplication::instance())->setOverrideCursor(Qt::BlankCursor);
|
||||
|
||||
emit drag_start();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SliderLabel::mouseMoveEvent(QMouseEvent *ev)
|
||||
void SliderLabel::mouseMoveEvent(QMouseEvent *)
|
||||
{
|
||||
QLabel::mouseMoveEvent(ev);
|
||||
|
||||
QPoint current_pos = QCursor::pos();
|
||||
|
||||
int x_mvmt = current_pos.x() - drag_start_.x();
|
||||
int y_mvmt = drag_start_.y() - current_pos.y();
|
||||
|
||||
emit dragged(x_mvmt + y_mvmt);
|
||||
int32_t x_mvmt, y_mvmt;
|
||||
|
||||
// Keep cursor in the same position
|
||||
#if defined(Q_OS_MAC)
|
||||
CGGetLastMouseDelta(&x_mvmt, &y_mvmt);
|
||||
#else
|
||||
QPoint current_pos = QCursor::pos();
|
||||
|
||||
x_mvmt = current_pos.x() - drag_start_.x();
|
||||
y_mvmt = drag_start_.y() - current_pos.y();
|
||||
|
||||
QCursor::setPos(drag_start_);
|
||||
#endif
|
||||
|
||||
emit dragged(x_mvmt + y_mvmt);
|
||||
}
|
||||
|
||||
void SliderLabel::mouseReleaseEvent(QMouseEvent *ev)
|
||||
void SliderLabel::mouseReleaseEvent(QMouseEvent *)
|
||||
{
|
||||
QWidget::mouseReleaseEvent(ev);
|
||||
#if defined(Q_OS_MAC)
|
||||
CGAssociateMouseAndMouseCursorPosition(true);
|
||||
CGDisplayShowCursor(kCGDirectMainDisplay);
|
||||
#else
|
||||
static_cast<QGuiApplication*>(QApplication::instance())->restoreOverrideCursor();
|
||||
#endif
|
||||
|
||||
// Emit a clicked signal
|
||||
emit drag_stop();
|
||||
|
||||
static_cast<QGuiApplication*>(QApplication::instance())->restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void SliderLabel::focusInEvent(QFocusEvent *event)
|
||||
|
||||
@@ -54,6 +54,8 @@ signals:
|
||||
private:
|
||||
QPoint drag_start_;
|
||||
|
||||
bool cancel_mm_event_;
|
||||
|
||||
};
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -105,6 +105,7 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
|
||||
connect(video_renderer_, &VideoRenderBackend::CachedTimeReady, this, &ViewerWidget::RendererCachedTime);
|
||||
connect(video_renderer_, &VideoRenderBackend::CachedTimeReady, ruler(), &TimeRuler::CacheTimeReady);
|
||||
connect(video_renderer_, &VideoRenderBackend::RangeInvalidated, ruler(), &TimeRuler::CacheInvalidatedRange);
|
||||
connect(video_renderer_, &VideoRenderBackend::GeneratedFrame, this, &ViewerWidget::RendererGeneratedFrame);
|
||||
audio_renderer_ = new AudioBackend(this);
|
||||
|
||||
waveform_view_->SetBackend(audio_renderer_);
|
||||
@@ -522,6 +523,13 @@ void ViewerWidget::ContextMenuScopeTriggered(QAction *action)
|
||||
emit RequestScopePanel(static_cast<ScopePanel::Type>(action->data().toInt()));
|
||||
}
|
||||
|
||||
void ViewerWidget::RendererGeneratedFrame(FramePtr f)
|
||||
{
|
||||
foreach (ViewerDisplayWidget* glw, gl_widgets_) {
|
||||
glw->SetImageFromLoadBuffer(f.get());
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerWidget::UpdateRendererParameters()
|
||||
{
|
||||
if (!GetConnectedNode()) {
|
||||
@@ -878,7 +886,7 @@ void ViewerWidget::SetZoomFromMenu(QAction *action)
|
||||
|
||||
void ViewerWidget::InvalidateVisible(NodeInput* source)
|
||||
{
|
||||
video_renderer_->InvalidateCache(TimeRange(GetTime(), GetTime()), source);
|
||||
video_renderer_->InvalidateVisible(TimeRange(GetTime(), GetTime()), source);
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -236,6 +236,8 @@ private slots:
|
||||
|
||||
void ContextMenuScopeTriggered(QAction* action);
|
||||
|
||||
void RendererGeneratedFrame(FramePtr f);
|
||||
|
||||
};
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
Reference in New Issue
Block a user