style: unify identifier naming per updated conventions
Automated with clang-tidy readability-identifier-naming (config added to .clang-tidy) plus scripted passes, per the updated rules now documented in CONTRIBUTING.md: - types (class/struct/enum/alias/template params): PascalCase - functions, variables, members: snake_case (incl. rational -> Rational) - private/protected members: trailing underscore; static member variables likewise (instance_, available_themes_) - constants and enum values: snake_case (kLinear -> k_linear, F32P -> f32p); ALL_CAPS reserved for macros - macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG -> OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE, include guards -> OAK_*) - file names: all lowercase (Current/Plugin/OliveHost/OliveClip/ OlivePluginInstance -> current/plugin/olivehost/oliveclip/ oliveplugininstance) - getters share the member name sans underscore, setters set_foo() - Qt and third-party (OpenFX) virtual overrides and framework callbacks keep their original names (exempt in .clang-tidy) Manual follow-ups required where automation could not reach: - string-based QMetaObject/SIGNAL/SLOT references updated to renamed methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...) - macro bodies referencing renamed methods (OLIVE_CONFIG, NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*) - self-shadowing locals renamed where signals/methods became same-named (size_changed, worker_count, selected_items, import param, filters) - third_party OFX member/namespace usages restored (OFX::Host::*, _created, _clipPrefsDirty, createInstance, clearPersistentMessage) - STL protocol aliases restored (const_iterator) with .clang-tidy ignore rules; qHash overloads restored Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
This commit is contained in:
@@ -58,93 +58,93 @@ SeekableWidget::SeekableWidget(QWidget *parent)
|
||||
text_height_ = fm.height();
|
||||
|
||||
// Set width of playhead marker
|
||||
playhead_width_ = QtUtils::QFontMetricsWidth(fm, "H");
|
||||
playhead_width_ = QtUtils::q_font_metrics_width(fm, "H");
|
||||
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
setMouseTracking(true);
|
||||
|
||||
selection_manager_.SetSnapMask(TimeBasedWidget::kSnapAll);
|
||||
selection_manager_.set_snap_mask(TimeBasedWidget::k_snap_all);
|
||||
|
||||
SetIsTimelineAxes(true);
|
||||
set_is_timeline_axes(true);
|
||||
}
|
||||
|
||||
void SeekableWidget::SetMarkers(TimelineMarkerList *markers)
|
||||
void SeekableWidget::set_markers(TimelineMarkerList *markers)
|
||||
{
|
||||
if (markers_) {
|
||||
selection_manager_.ClearSelection();
|
||||
selection_manager_.clear_selection();
|
||||
|
||||
disconnect(markers_, &TimelineMarkerList::MarkerAdded, viewport(),
|
||||
disconnect(markers_, &TimelineMarkerList::marker_added, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
disconnect(markers_, &TimelineMarkerList::MarkerRemoved, viewport(),
|
||||
disconnect(markers_, &TimelineMarkerList::marker_removed, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
disconnect(markers_, &TimelineMarkerList::MarkerModified, viewport(),
|
||||
disconnect(markers_, &TimelineMarkerList::marker_modified, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
}
|
||||
|
||||
markers_ = markers;
|
||||
|
||||
if (markers_) {
|
||||
connect(markers_, &TimelineMarkerList::MarkerAdded, viewport(),
|
||||
connect(markers_, &TimelineMarkerList::marker_added, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
connect(markers_, &TimelineMarkerList::MarkerRemoved, viewport(),
|
||||
connect(markers_, &TimelineMarkerList::marker_removed, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
connect(markers_, &TimelineMarkerList::MarkerModified, viewport(),
|
||||
connect(markers_, &TimelineMarkerList::marker_modified, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
}
|
||||
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void SeekableWidget::SetWorkArea(TimelineWorkArea *workarea)
|
||||
void SeekableWidget::set_work_area(TimelineWorkArea *workarea)
|
||||
{
|
||||
if (workarea_) {
|
||||
selection_manager_.ClearSelection();
|
||||
selection_manager_.clear_selection();
|
||||
|
||||
disconnect(workarea_, &TimelineWorkArea::RangeChanged, viewport(),
|
||||
disconnect(workarea_, &TimelineWorkArea::range_changed, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
disconnect(workarea_, &TimelineWorkArea::EnabledChanged, viewport(),
|
||||
disconnect(workarea_, &TimelineWorkArea::enabled_changed, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
}
|
||||
|
||||
workarea_ = workarea;
|
||||
|
||||
if (workarea_) {
|
||||
connect(workarea_, &TimelineWorkArea::RangeChanged, viewport(),
|
||||
connect(workarea_, &TimelineWorkArea::range_changed, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
connect(workarea_, &TimelineWorkArea::EnabledChanged, viewport(),
|
||||
connect(workarea_, &TimelineWorkArea::enabled_changed, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
}
|
||||
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void SeekableWidget::DeleteSelected()
|
||||
void SeekableWidget::delete_selected()
|
||||
{
|
||||
if (!selection_manager_.IsDragging()) {
|
||||
if (!selection_manager_.is_dragging()) {
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
foreach (TimelineMarker *marker,
|
||||
selection_manager_.GetSelectedObjects()) {
|
||||
selection_manager_.get_selected_objects()) {
|
||||
command->add_child(new MarkerRemoveCommand(marker));
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->push(
|
||||
command, tr("Deleted %1 Marker(s)")
|
||||
.arg(selection_manager_.GetSelectedObjects().size()));
|
||||
.arg(selection_manager_.get_selected_objects().size()));
|
||||
}
|
||||
}
|
||||
|
||||
bool SeekableWidget::CopySelected(bool cut)
|
||||
bool SeekableWidget::copy_selected(bool cut)
|
||||
{
|
||||
if (!selection_manager_.GetSelectedObjects().empty()) {
|
||||
ProjectSerializer::SaveData sdata(ProjectSerializer::kOnlyMarkers);
|
||||
sdata.SetOnlySerializeMarkers(selection_manager_.GetSelectedObjects());
|
||||
if (!selection_manager_.get_selected_objects().empty()) {
|
||||
ProjectSerializer::SaveData sdata(ProjectSerializer::k_only_markers);
|
||||
sdata.set_only_serialize_markers(selection_manager_.get_selected_objects());
|
||||
|
||||
ProjectSerializer::Copy(sdata);
|
||||
ProjectSerializer::copy(sdata);
|
||||
|
||||
if (cut) {
|
||||
DeleteSelected();
|
||||
delete_selected();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -153,22 +153,22 @@ bool SeekableWidget::CopySelected(bool cut)
|
||||
}
|
||||
}
|
||||
|
||||
bool SeekableWidget::PasteMarkers()
|
||||
bool SeekableWidget::paste_markers()
|
||||
{
|
||||
ProjectSerializer::Result res =
|
||||
ProjectSerializer::Paste(ProjectSerializer::kOnlyMarkers);
|
||||
if (res == ProjectSerializer::kSuccess) {
|
||||
ProjectSerializer::paste(ProjectSerializer::k_only_markers);
|
||||
if (res == ProjectSerializer::k_success) {
|
||||
const std::vector<TimelineMarker *> &markers =
|
||||
res.GetLoadData().markers;
|
||||
res.get_load_data().markers;
|
||||
if (!markers.empty()) {
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
// Normalize markers to start at playhead
|
||||
rational min = RATIONAL_MAX;
|
||||
Rational min = RATIONAL_MAX;
|
||||
for (auto it = markers.cbegin(); it != markers.cend(); it++) {
|
||||
min = std::min(min, (*it)->time().in());
|
||||
}
|
||||
min -= GetViewerNode()->GetPlayhead();
|
||||
min -= get_viewer_node()->get_playhead();
|
||||
|
||||
for (auto it = markers.cbegin(); it != markers.cend(); it++) {
|
||||
TimelineMarker *m = *it;
|
||||
@@ -176,7 +176,7 @@ bool SeekableWidget::PasteMarkers()
|
||||
m->set_time(m->time().in() - min);
|
||||
|
||||
if (TimelineMarker *existing =
|
||||
markers_->GetMarkerAtTime(m->time().in())) {
|
||||
markers_->get_marker_at_time(m->time().in())) {
|
||||
command->add_child(new MarkerRemoveCommand(existing));
|
||||
}
|
||||
|
||||
@@ -196,106 +196,106 @@ void SeekableWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
TimelineMarker *initial;
|
||||
|
||||
if (HandPress(event)) {
|
||||
if (hand_press(event)) {
|
||||
return;
|
||||
} else if (event->modifiers() & Qt::ControlModifier) {
|
||||
selection_manager_.RubberBandStart(event);
|
||||
selection_manager_.rubber_band_start(event);
|
||||
} else if (marker_editing_enabled_ &&
|
||||
(initial = selection_manager_.MousePress(event))) {
|
||||
selection_manager_.DragStart(initial, event);
|
||||
(initial = selection_manager_.mouse_press(event))) {
|
||||
selection_manager_.drag_start(initial, event);
|
||||
} else if (resize_item_) {
|
||||
// Handle selection, even though we won't be using it for dragging
|
||||
if (!(event->modifiers() & Qt::ShiftModifier)) {
|
||||
selection_manager_.ClearSelection();
|
||||
selection_manager_.clear_selection();
|
||||
}
|
||||
if (TimelineMarker *m = dynamic_cast<TimelineMarker *>(resize_item_)) {
|
||||
selection_manager_.Select(m);
|
||||
selection_manager_.select(m);
|
||||
}
|
||||
dragging_ = true;
|
||||
resize_start_ = mapToScene(event->pos());
|
||||
} else if (!selection_manager_.GetObjectAtPoint(event->pos()) &&
|
||||
} else if (!selection_manager_.get_object_at_point(event->pos()) &&
|
||||
event->button() == Qt::LeftButton) {
|
||||
SeekToScenePoint(mapToScene(event->pos()).x());
|
||||
seek_to_scene_point(mapToScene(event->pos()).x());
|
||||
dragging_ = true;
|
||||
|
||||
DeselectAllMarkers();
|
||||
deselect_all_markers();
|
||||
}
|
||||
}
|
||||
|
||||
void SeekableWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (HandMove(event)) {
|
||||
if (hand_move(event)) {
|
||||
return;
|
||||
} else if (selection_manager_.IsRubberBanding()) {
|
||||
selection_manager_.RubberBandMove(event->pos());
|
||||
} else if (selection_manager_.is_rubber_banding()) {
|
||||
selection_manager_.rubber_band_move(event->pos());
|
||||
viewport()->update();
|
||||
} else if (selection_manager_.IsDragging()) {
|
||||
selection_manager_.DragMove(event->pos());
|
||||
} else if (selection_manager_.is_dragging()) {
|
||||
selection_manager_.drag_move(event->pos());
|
||||
} else if (dragging_) {
|
||||
QPointF scene = mapToScene(event->pos());
|
||||
if (resize_item_) {
|
||||
DragResizeHandle(scene);
|
||||
drag_resize_handle(scene);
|
||||
} else {
|
||||
SeekToScenePoint(scene.x());
|
||||
seek_to_scene_point(scene.x());
|
||||
}
|
||||
} else {
|
||||
// Look for resize points
|
||||
if (!last_playhead_shape_.containsPoint(event->pos(),
|
||||
Qt::OddEvenFill) &&
|
||||
!selection_manager_.GetObjectAtPoint(event->pos()) &&
|
||||
FindResizeHandle(event)) {
|
||||
!selection_manager_.get_object_at_point(event->pos()) &&
|
||||
find_resize_handle(event)) {
|
||||
setCursor(Qt::SizeHorCursor);
|
||||
} else {
|
||||
unsetCursor();
|
||||
ClearResizeHandle();
|
||||
clear_resize_handle();
|
||||
}
|
||||
}
|
||||
|
||||
if (event->buttons()) {
|
||||
// Signal cursor pos in case we should scroll to catch up to it
|
||||
emit DragMoved(event->pos().x(), event->pos().y());
|
||||
emit drag_moved(event->pos().x(), event->pos().y());
|
||||
}
|
||||
}
|
||||
|
||||
void SeekableWidget::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (HandRelease(event)) {
|
||||
if (hand_release(event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection_manager_.IsRubberBanding()) {
|
||||
selection_manager_.RubberBandStop();
|
||||
if (selection_manager_.is_rubber_banding()) {
|
||||
selection_manager_.rubber_band_stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection_manager_.IsDragging()) {
|
||||
if (selection_manager_.is_dragging()) {
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
selection_manager_.DragStop(command);
|
||||
selection_manager_.drag_stop(command);
|
||||
Core::instance()->undo_stack()->push(
|
||||
command, tr("Moved %1 Marker(s)")
|
||||
.arg(selection_manager_.GetSelectedObjects().size()));
|
||||
.arg(selection_manager_.get_selected_objects().size()));
|
||||
}
|
||||
|
||||
if (GetSnapService()) {
|
||||
GetSnapService()->HideSnaps();
|
||||
if (get_snap_service()) {
|
||||
get_snap_service()->hide_snaps();
|
||||
}
|
||||
|
||||
if (resize_item_) {
|
||||
CommitResizeHandle();
|
||||
commit_resize_handle();
|
||||
resize_item_ = nullptr;
|
||||
}
|
||||
|
||||
dragging_ = false;
|
||||
emit DragReleased();
|
||||
emit drag_released();
|
||||
}
|
||||
|
||||
void SeekableWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
super::mouseDoubleClickEvent(event);
|
||||
|
||||
if (selection_manager_.GetObjectAtPoint(event->pos()) &&
|
||||
!selection_manager_.GetSelectedObjects().empty()) {
|
||||
ShowMarkerProperties();
|
||||
if (selection_manager_.get_object_at_point(event->pos()) &&
|
||||
!selection_manager_.get_selected_objects().empty()) {
|
||||
show_marker_properties();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,28 +307,28 @@ void SeekableWidget::focusOutEvent(QFocusEvent *event)
|
||||
ignore_next_focus_out_ = false;
|
||||
} else {
|
||||
// Deselect everything when we lose focus
|
||||
DeselectAllMarkers();
|
||||
deselect_all_markers();
|
||||
}
|
||||
}
|
||||
|
||||
void SeekableWidget::DrawMarkers(QPainter *p, int marker_bottom)
|
||||
void SeekableWidget::draw_markers(QPainter *p, int marker_bottom)
|
||||
{
|
||||
selection_manager_.ClearDrawnObjects();
|
||||
selection_manager_.clear_drawn_objects();
|
||||
|
||||
// Draw markers
|
||||
if (markers_ && !markers_->empty() && marker_bottom > 0) {
|
||||
int lim_left = GetLeftLimit();
|
||||
int lim_right = GetRightLimit();
|
||||
int lim_left = get_left_limit();
|
||||
int lim_right = get_right_limit();
|
||||
|
||||
for (auto it = markers_->cbegin(); it != markers_->cend(); it++) {
|
||||
TimelineMarker *marker = *it;
|
||||
|
||||
int marker_right = TimeToScene(marker->time().out());
|
||||
int marker_right = time_to_scene(marker->time().out());
|
||||
if (marker_right < lim_left) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int marker_left = TimeToScene(marker->time().in());
|
||||
int marker_left = time_to_scene(marker->time().in());
|
||||
if (marker_left >= lim_right) {
|
||||
break;
|
||||
}
|
||||
@@ -341,36 +341,36 @@ void SeekableWidget::DrawMarkers(QPainter *p, int marker_bottom)
|
||||
if (next != markers_->cend()) {
|
||||
max_marker_right =
|
||||
std::min(max_marker_right,
|
||||
int(TimeToScene((*next)->time().in())));
|
||||
int(time_to_scene((*next)->time().in())));
|
||||
}
|
||||
}
|
||||
|
||||
QRect marker_rect = marker->Draw(
|
||||
QRect marker_rect = marker->draw(
|
||||
p, QPoint(marker_left, marker_bottom), max_marker_right,
|
||||
GetScale(), selection_manager_.IsSelected(marker));
|
||||
get_scale(), selection_manager_.is_selected(marker));
|
||||
marker_top_ = marker_rect.top();
|
||||
selection_manager_.DeclareDrawnObject(marker, marker_rect);
|
||||
selection_manager_.declare_drawn_object(marker, marker_rect);
|
||||
}
|
||||
}
|
||||
|
||||
marker_bottom_ = marker_bottom;
|
||||
}
|
||||
|
||||
void SeekableWidget::DrawWorkArea(QPainter *p)
|
||||
void SeekableWidget::draw_work_area(QPainter *p)
|
||||
{
|
||||
// Draw in/out workarea
|
||||
if (workarea_ && workarea_->enabled()) {
|
||||
int lim_left = GetLeftLimit();
|
||||
int lim_right = GetRightLimit();
|
||||
int lim_left = get_left_limit();
|
||||
int lim_right = get_right_limit();
|
||||
|
||||
int workarea_left = qMax(qreal(lim_left), TimeToScene(workarea_->in()));
|
||||
int workarea_left = qMax(qreal(lim_left), time_to_scene(workarea_->in()));
|
||||
int workarea_right;
|
||||
|
||||
if (workarea_->out() == TimelineWorkArea::kResetOut) {
|
||||
if (workarea_->out() == TimelineWorkArea::k_reset_out) {
|
||||
workarea_right = lim_right;
|
||||
} else {
|
||||
workarea_right =
|
||||
qMin(qreal(lim_right), TimeToScene(workarea_->out()));
|
||||
qMin(qreal(lim_right), time_to_scene(workarea_->out()));
|
||||
}
|
||||
|
||||
QColor translucent_highlight = palette().highlight().color();
|
||||
@@ -380,62 +380,62 @@ void SeekableWidget::DrawWorkArea(QPainter *p)
|
||||
}
|
||||
}
|
||||
|
||||
void SeekableWidget::DeselectAllMarkers()
|
||||
void SeekableWidget::deselect_all_markers()
|
||||
{
|
||||
selection_manager_.ClearSelection();
|
||||
selection_manager_.clear_selection();
|
||||
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void SeekableWidget::SetMarkerColor(int c)
|
||||
void SeekableWidget::set_marker_color(int c)
|
||||
{
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
foreach (TimelineMarker *marker, selection_manager_.GetSelectedObjects()) {
|
||||
foreach (TimelineMarker *marker, selection_manager_.get_selected_objects()) {
|
||||
command->add_child(new MarkerChangeColorCommand(marker, c));
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->push(
|
||||
command, tr("Changed Color of %1 Marker(s)")
|
||||
.arg(selection_manager_.GetSelectedObjects().size()));
|
||||
.arg(selection_manager_.get_selected_objects().size()));
|
||||
}
|
||||
|
||||
void SeekableWidget::ShowMarkerProperties()
|
||||
void SeekableWidget::show_marker_properties()
|
||||
{
|
||||
MarkerPropertiesDialog mpd(selection_manager_.GetSelectedObjects(),
|
||||
MarkerPropertiesDialog mpd(selection_manager_.get_selected_objects(),
|
||||
timebase(), this);
|
||||
ignore_next_focus_out_ = true;
|
||||
mpd.exec();
|
||||
}
|
||||
|
||||
void SeekableWidget::TimebaseChangedEvent(const rational &t)
|
||||
void SeekableWidget::TimebaseChangedEvent(const Rational &t)
|
||||
{
|
||||
super::TimebaseChangedEvent(t);
|
||||
|
||||
selection_manager_.SetTimebase(t);
|
||||
selection_manager_.set_timebase(t);
|
||||
}
|
||||
|
||||
void SeekableWidget::SeekToScenePoint(qreal scene)
|
||||
void SeekableWidget::seek_to_scene_point(qreal scene)
|
||||
{
|
||||
if (timebase().isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
rational playhead_time = qMax(rational(0), SceneToTime(scene));
|
||||
Rational playhead_time = qMax(Rational(0), scene_to_time(scene));
|
||||
|
||||
if (Core::instance()->snapping() && GetSnapService()) {
|
||||
rational movement;
|
||||
if (Core::instance()->snapping() && get_snap_service()) {
|
||||
Rational movement;
|
||||
|
||||
GetSnapService()->SnapPoint({ playhead_time }, &movement,
|
||||
TimeBasedWidget::kSnapAll &
|
||||
~TimeBasedWidget::kSnapToPlayhead);
|
||||
get_snap_service()->snap_point({ playhead_time }, &movement,
|
||||
TimeBasedWidget::k_snap_all &
|
||||
~TimeBasedWidget::k_snap_to_playhead);
|
||||
|
||||
playhead_time += movement;
|
||||
}
|
||||
|
||||
ViewerOutput *viewer = GetViewerNode();
|
||||
if (viewer && playhead_time != viewer->GetPlayhead()) {
|
||||
viewer->SetPlayhead(playhead_time);
|
||||
ViewerOutput *viewer = get_viewer_node();
|
||||
if (viewer && playhead_time != viewer->get_playhead()) {
|
||||
viewer->set_playhead(playhead_time);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,15 +457,15 @@ void SeekableWidget::CatchUpScrollEvent()
|
||||
{
|
||||
super::CatchUpScrollEvent();
|
||||
|
||||
this->selection_manager_.ForceDragUpdate();
|
||||
this->selection_manager_.force_drag_update();
|
||||
}
|
||||
|
||||
void SeekableWidget::DrawPlayhead(QPainter *p, int x, int y)
|
||||
void SeekableWidget::draw_playhead(QPainter *p, int x, int y)
|
||||
{
|
||||
int half_width = playhead_width_ / 2;
|
||||
|
||||
{
|
||||
int test = x - this->GetScroll();
|
||||
int test = x - this->get_scroll();
|
||||
if (test + half_width < 0 || test - half_width > width()) {
|
||||
return;
|
||||
}
|
||||
@@ -489,37 +489,37 @@ void SeekableWidget::DrawPlayhead(QPainter *p, int x, int y)
|
||||
p->setRenderHint(QPainter::Antialiasing, false);
|
||||
}
|
||||
|
||||
int SeekableWidget::GetLeftLimit() const
|
||||
int SeekableWidget::get_left_limit() const
|
||||
{
|
||||
return GetScroll();
|
||||
return get_scroll();
|
||||
}
|
||||
|
||||
int SeekableWidget::GetRightLimit() const
|
||||
int SeekableWidget::get_right_limit() const
|
||||
{
|
||||
return GetLeftLimit() + width();
|
||||
return get_left_limit() + width();
|
||||
}
|
||||
|
||||
bool SeekableWidget::ShowContextMenu(const QPoint &p)
|
||||
bool SeekableWidget::show_context_menu(const QPoint &p)
|
||||
{
|
||||
if (marker_editing_enabled_ && selection_manager_.GetObjectAtPoint(p) &&
|
||||
!selection_manager_.GetSelectedObjects().empty()) {
|
||||
if (marker_editing_enabled_ && selection_manager_.get_object_at_point(p) &&
|
||||
!selection_manager_.get_selected_objects().empty()) {
|
||||
// Show marker-specific menu
|
||||
Menu m;
|
||||
|
||||
ColorLabelMenu color_coding_menu;
|
||||
connect(&color_coding_menu, &ColorLabelMenu::ColorSelected, this,
|
||||
&SeekableWidget::SetMarkerColor);
|
||||
connect(&color_coding_menu, &ColorLabelMenu::color_selected, this,
|
||||
&SeekableWidget::set_marker_color);
|
||||
m.addMenu(&color_coding_menu);
|
||||
|
||||
m.addSeparator();
|
||||
|
||||
MenuShared::instance()->AddItemsForEditMenu(&m, false);
|
||||
MenuShared::instance()->add_items_for_edit_menu(&m, false);
|
||||
|
||||
m.addSeparator();
|
||||
|
||||
QAction *properties_action = m.addAction(tr("Properties"));
|
||||
connect(properties_action, &QAction::triggered, this,
|
||||
&SeekableWidget::ShowMarkerProperties);
|
||||
&SeekableWidget::show_marker_properties);
|
||||
|
||||
ignore_next_focus_out_ = true;
|
||||
m.exec(mapToGlobal(p));
|
||||
@@ -529,34 +529,34 @@ bool SeekableWidget::ShowContextMenu(const QPoint &p)
|
||||
}
|
||||
}
|
||||
|
||||
bool SeekableWidget::FindResizeHandle(QMouseEvent *event)
|
||||
bool SeekableWidget::find_resize_handle(QMouseEvent *event)
|
||||
{
|
||||
if (!marker_editing_enabled_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ClearResizeHandle();
|
||||
clear_resize_handle();
|
||||
|
||||
QPointF scene = mapToScene(event->pos());
|
||||
const int border = 10;
|
||||
rational min = SceneToTimeNoGrid(scene.x() - border);
|
||||
rational max = SceneToTimeNoGrid(scene.x() + border);
|
||||
Rational min = scene_to_time_no_grid(scene.x() - border);
|
||||
Rational max = scene_to_time_no_grid(scene.x() + border);
|
||||
|
||||
// Test for workarea
|
||||
if (workarea_ && workarea_->enabled()) {
|
||||
if (workarea_->in() >= min && workarea_->in() < max) {
|
||||
resize_mode_ = kResizeIn;
|
||||
resize_mode_ = k_resize_in;
|
||||
} else if (workarea_->out() >= min && workarea_->out() < max) {
|
||||
resize_mode_ = kResizeOut;
|
||||
resize_mode_ = k_resize_out;
|
||||
}
|
||||
}
|
||||
|
||||
if (resize_mode_ != kResizeNone) {
|
||||
if (resize_mode_ != k_resize_none) {
|
||||
if (workarea_) {
|
||||
resize_item_ = workarea_;
|
||||
resize_item_range_ = workarea_->range();
|
||||
resize_snap_mask_ = TimeBasedWidget::kSnapAll &
|
||||
~TimeBasedWidget::kSnapToWorkarea;
|
||||
resize_snap_mask_ = TimeBasedWidget::k_snap_all &
|
||||
~TimeBasedWidget::k_snap_to_workarea;
|
||||
}
|
||||
} else if (event->pos().y() >= marker_top_ &&
|
||||
event->pos().y() < marker_bottom_) {
|
||||
@@ -566,16 +566,16 @@ bool SeekableWidget::FindResizeHandle(QMouseEvent *event)
|
||||
TimelineMarker *m = *it;
|
||||
if (m->time().in() != m->time().out()) {
|
||||
if (m->time().in() >= min && m->time().in() < max) {
|
||||
resize_mode_ = kResizeIn;
|
||||
resize_mode_ = k_resize_in;
|
||||
} else if (m->time().out() >= min &&
|
||||
m->time().out() < max) {
|
||||
resize_mode_ = kResizeOut;
|
||||
resize_mode_ = k_resize_out;
|
||||
}
|
||||
|
||||
if (resize_mode_ != kResizeNone) {
|
||||
if (resize_mode_ != k_resize_none) {
|
||||
resize_item_ = m;
|
||||
resize_item_range_ = m->time();
|
||||
resize_snap_mask_ = TimeBasedWidget::kSnapAll;
|
||||
resize_snap_mask_ = TimeBasedWidget::k_snap_all;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -586,41 +586,41 @@ bool SeekableWidget::FindResizeHandle(QMouseEvent *event)
|
||||
return resize_item_;
|
||||
}
|
||||
|
||||
void SeekableWidget::ClearResizeHandle()
|
||||
void SeekableWidget::clear_resize_handle()
|
||||
{
|
||||
resize_item_ = nullptr;
|
||||
resize_mode_ = kResizeNone;
|
||||
resize_mode_ = k_resize_none;
|
||||
}
|
||||
|
||||
void SeekableWidget::DragResizeHandle(const QPointF &scene)
|
||||
void SeekableWidget::drag_resize_handle(const QPointF &scene)
|
||||
{
|
||||
qreal diff = scene.x() - resize_start_.x();
|
||||
|
||||
rational proposed_time;
|
||||
Rational proposed_time;
|
||||
|
||||
if (resize_mode_ == kResizeIn) {
|
||||
proposed_time = qMax(rational(0), qMin(resize_item_range_.out(),
|
||||
if (resize_mode_ == k_resize_in) {
|
||||
proposed_time = qMax(Rational(0), qMin(resize_item_range_.out(),
|
||||
resize_item_range_.in() +
|
||||
SceneToTimeNoGrid(diff)));
|
||||
scene_to_time_no_grid(diff)));
|
||||
} else {
|
||||
proposed_time =
|
||||
qMax(resize_item_range_.in(),
|
||||
resize_item_range_.out() + SceneToTimeNoGrid(diff));
|
||||
resize_item_range_.out() + scene_to_time_no_grid(diff));
|
||||
}
|
||||
|
||||
rational presnap_time = proposed_time;
|
||||
Rational presnap_time = proposed_time;
|
||||
|
||||
if (Core::instance()->snapping() && GetSnapService()) {
|
||||
rational movement;
|
||||
if (Core::instance()->snapping() && get_snap_service()) {
|
||||
Rational movement;
|
||||
|
||||
GetSnapService()->SnapPoint({ proposed_time }, &movement,
|
||||
get_snap_service()->snap_point({ proposed_time }, &movement,
|
||||
resize_snap_mask_);
|
||||
|
||||
proposed_time += movement;
|
||||
}
|
||||
|
||||
TimeRange new_range = resize_item_range_;
|
||||
if (resize_mode_ == kResizeIn) {
|
||||
if (resize_mode_ == k_resize_in) {
|
||||
// Markers should not have the same time as anything else
|
||||
// NOTE: This code is largely duplicated from TimeBasedViewSelectionManager::DragMove. Not ideal,
|
||||
// but I'm not sure if there's a good way to re-use that code
|
||||
@@ -629,13 +629,13 @@ void SeekableWidget::DragResizeHandle(const QPointF &scene)
|
||||
if (marker->has_sibling_at_time(proposed_time)) {
|
||||
proposed_time = presnap_time;
|
||||
|
||||
if (GetSnapService()) {
|
||||
GetSnapService()->HideSnaps();
|
||||
if (get_snap_service()) {
|
||||
get_snap_service()->hide_snaps();
|
||||
}
|
||||
}
|
||||
|
||||
while (marker->has_sibling_at_time(proposed_time)) {
|
||||
proposed_time += rational(1, 1000);
|
||||
proposed_time += Rational(1, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ void SeekableWidget::DragResizeHandle(const QPointF &scene)
|
||||
}
|
||||
}
|
||||
|
||||
void SeekableWidget::CommitResizeHandle()
|
||||
void SeekableWidget::commit_resize_handle()
|
||||
{
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef SEEKABLEWIDGET_H
|
||||
#define SEEKABLEWIDGET_H
|
||||
#ifndef OAK_SEEKABLEWIDGET_H
|
||||
#define OAK_SEEKABLEWIDGET_H
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QScrollBar>
|
||||
@@ -36,55 +36,55 @@ class SeekableWidget : public TimeBasedView {
|
||||
public:
|
||||
SeekableWidget(QWidget *parent = nullptr);
|
||||
|
||||
int GetScroll() const
|
||||
int get_scroll() const
|
||||
{
|
||||
return horizontalScrollBar()->value();
|
||||
}
|
||||
|
||||
TimelineMarkerList *GetMarkers() const
|
||||
TimelineMarkerList *get_markers() const
|
||||
{
|
||||
return markers_;
|
||||
}
|
||||
TimelineWorkArea *GetWorkArea() const
|
||||
TimelineWorkArea *get_work_area() const
|
||||
{
|
||||
return workarea_;
|
||||
}
|
||||
|
||||
void SetMarkers(TimelineMarkerList *markers);
|
||||
void SetWorkArea(TimelineWorkArea *workarea);
|
||||
void set_markers(TimelineMarkerList *markers);
|
||||
void set_work_area(TimelineWorkArea *workarea);
|
||||
|
||||
virtual bool IsDraggingPlayhead() const override
|
||||
virtual bool is_dragging_playhead() const override
|
||||
{
|
||||
return dragging_;
|
||||
}
|
||||
|
||||
bool IsMarkerEditingEnabled() const
|
||||
bool is_marker_editing_enabled() const
|
||||
{
|
||||
return marker_editing_enabled_;
|
||||
}
|
||||
void SetMarkerEditingEnabled(bool e)
|
||||
void set_marker_editing_enabled(bool e)
|
||||
{
|
||||
marker_editing_enabled_ = e;
|
||||
}
|
||||
|
||||
void DeleteSelected();
|
||||
void delete_selected();
|
||||
|
||||
bool CopySelected(bool cut);
|
||||
bool copy_selected(bool cut);
|
||||
|
||||
bool PasteMarkers();
|
||||
bool paste_markers();
|
||||
|
||||
void DeselectAllMarkers();
|
||||
void deselect_all_markers();
|
||||
|
||||
void SeekToScenePoint(qreal scene);
|
||||
void seek_to_scene_point(qreal scene);
|
||||
|
||||
bool HasItemsSelected() const
|
||||
bool has_items_selected() const
|
||||
{
|
||||
return !selection_manager_.GetSelectedObjects().empty();
|
||||
return !selection_manager_.get_selected_objects().empty();
|
||||
}
|
||||
|
||||
const std::vector<TimelineMarker *> &GetSelectedMarkers() const
|
||||
const std::vector<TimelineMarker *> &get_selected_markers() const
|
||||
{
|
||||
return selection_manager_.GetSelectedObjects();
|
||||
return selection_manager_.get_selected_objects();
|
||||
}
|
||||
|
||||
virtual void SelectionManagerSelectEvent(void *obj) override;
|
||||
@@ -93,17 +93,17 @@ public:
|
||||
virtual void CatchUpScrollEvent() override;
|
||||
|
||||
public slots:
|
||||
void SetScroll(int i)
|
||||
void set_scroll(int i)
|
||||
{
|
||||
horizontalScrollBar()->setValue(i);
|
||||
}
|
||||
|
||||
virtual void TimebaseChangedEvent(const rational &) override;
|
||||
virtual void TimebaseChangedEvent(const Rational &) override;
|
||||
|
||||
signals:
|
||||
void DragMoved(int x, int y);
|
||||
void drag_moved(int x, int y);
|
||||
|
||||
void DragReleased();
|
||||
void drag_released();
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||
@@ -113,10 +113,10 @@ protected:
|
||||
|
||||
virtual void focusOutEvent(QFocusEvent *event) override;
|
||||
|
||||
void DrawMarkers(QPainter *p, int marker_bottom = 0);
|
||||
void DrawWorkArea(QPainter *p);
|
||||
void draw_markers(QPainter *p, int marker_bottom = 0);
|
||||
void draw_work_area(QPainter *p);
|
||||
|
||||
void DrawPlayhead(QPainter *p, int x, int y);
|
||||
void draw_playhead(QPainter *p, int x, int y);
|
||||
|
||||
inline const int &text_height() const
|
||||
{
|
||||
@@ -128,22 +128,22 @@ protected:
|
||||
return playhead_width_;
|
||||
}
|
||||
|
||||
int GetLeftLimit() const;
|
||||
int GetRightLimit() const;
|
||||
int get_left_limit() const;
|
||||
int get_right_limit() const;
|
||||
|
||||
protected slots:
|
||||
virtual bool ShowContextMenu(const QPoint &p);
|
||||
virtual bool show_context_menu(const QPoint &p);
|
||||
|
||||
private:
|
||||
enum ResizeMode { kResizeNone, kResizeIn, kResizeOut };
|
||||
enum ResizeMode { k_resize_none, k_resize_in, k_resize_out };
|
||||
|
||||
bool FindResizeHandle(QMouseEvent *event);
|
||||
bool find_resize_handle(QMouseEvent *event);
|
||||
|
||||
void ClearResizeHandle();
|
||||
void clear_resize_handle();
|
||||
|
||||
void DragResizeHandle(const QPointF &scene_pos);
|
||||
void drag_resize_handle(const QPointF &scene_pos);
|
||||
|
||||
void CommitResizeHandle();
|
||||
void commit_resize_handle();
|
||||
|
||||
TimelineMarkerList *markers_;
|
||||
TimelineWorkArea *workarea_;
|
||||
@@ -172,11 +172,11 @@ private:
|
||||
QPolygon last_playhead_shape_;
|
||||
|
||||
private slots:
|
||||
void SetMarkerColor(int c);
|
||||
void set_marker_color(int c);
|
||||
|
||||
void ShowMarkerProperties();
|
||||
void show_marker_properties();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SEEKABLEWIDGET_H
|
||||
#endif // OAK_SEEKABLEWIDGET_H
|
||||
|
||||
@@ -51,18 +51,18 @@ TimeRuler::TimeRuler(bool text_visible, bool cache_status_visible,
|
||||
|
||||
// Get the "minimum" space allowed between two line markers on the ruler (in screen pixels)
|
||||
// Mediocre but reliable way of scaling UI objects by font/DPI size
|
||||
minimum_gap_between_lines_ = QtUtils::QFontMetricsWidth(fm, "H");
|
||||
minimum_gap_between_lines_ = QtUtils::q_font_metrics_width(fm, "H");
|
||||
|
||||
// Text visibility affects height, so we set that here
|
||||
UpdateHeight();
|
||||
update_height();
|
||||
|
||||
// Force update if the default timecode display mode changes
|
||||
connect(Core::instance(), &Core::TimecodeDisplayChanged, this,
|
||||
connect(Core::instance(), &Core::timecode_display_changed, this,
|
||||
static_cast<void (TimeRuler::*)()>(&TimeRuler::update));
|
||||
|
||||
// Connect context menu
|
||||
connect(this, &TimeRuler::customContextMenuRequested, this,
|
||||
&TimeRuler::ShowContextMenu);
|
||||
&TimeRuler::show_context_menu);
|
||||
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
//horizontalScrollBar()->setVisible(false);
|
||||
@@ -76,32 +76,32 @@ TimeRuler::TimeRuler(bool text_visible, bool cache_status_visible,
|
||||
setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
}
|
||||
|
||||
void TimeRuler::SetCenteredText(bool c)
|
||||
void TimeRuler::set_centered_text(bool c)
|
||||
{
|
||||
centered_text_ = c;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void TimeRuler::SetPlaybackCache(PlaybackCache *cache)
|
||||
void TimeRuler::set_playback_cache(PlaybackCache *cache)
|
||||
{
|
||||
if (!show_cache_status_) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (playback_cache_) {
|
||||
disconnect(playback_cache_, &PlaybackCache::Invalidated, viewport(),
|
||||
disconnect(playback_cache_, &PlaybackCache::invalidated, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
disconnect(playback_cache_, &PlaybackCache::Validated, viewport(),
|
||||
disconnect(playback_cache_, &PlaybackCache::validated, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
}
|
||||
|
||||
playback_cache_ = cache;
|
||||
|
||||
if (playback_cache_) {
|
||||
connect(playback_cache_, &PlaybackCache::Invalidated, viewport(),
|
||||
connect(playback_cache_, &PlaybackCache::invalidated, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
connect(playback_cache_, &PlaybackCache::Validated, viewport(),
|
||||
connect(playback_cache_, &PlaybackCache::validated, viewport(),
|
||||
static_cast<void (QWidget::*)()>(&QWidget::update));
|
||||
}
|
||||
|
||||
@@ -116,16 +116,16 @@ void TimeRuler::drawForeground(QPainter *p, const QRectF &rect)
|
||||
}
|
||||
|
||||
// Draw timeline points if connected
|
||||
int marker_height = TimelineMarker::GetMarkerHeight(p->fontMetrics());
|
||||
DrawWorkArea(p);
|
||||
DrawMarkers(p, marker_height);
|
||||
int marker_height = TimelineMarker::get_marker_height(p->fontMetrics());
|
||||
draw_work_area(p);
|
||||
draw_markers(p, marker_height);
|
||||
|
||||
double width_of_frame = timebase_dbl() * GetScale();
|
||||
double width_of_frame = timebase_dbl() * get_scale();
|
||||
double width_of_second = 0;
|
||||
do {
|
||||
width_of_second += timebase_dbl();
|
||||
} while (width_of_second < 1.0);
|
||||
width_of_second *= GetScale();
|
||||
width_of_second *= get_scale();
|
||||
double width_of_minute = width_of_second * 60;
|
||||
double width_of_hour = width_of_minute * 60;
|
||||
double width_of_day = width_of_hour * 24;
|
||||
@@ -195,7 +195,7 @@ void TimeRuler::drawForeground(QPainter *p, const QRectF &rect)
|
||||
int line_bottom = height();
|
||||
|
||||
if (show_cache_status_) {
|
||||
line_bottom -= PlaybackCache::GetCacheIndicatorHeight();
|
||||
line_bottom -= PlaybackCache::get_cache_indicator_height();
|
||||
}
|
||||
|
||||
int long_height = fm.height();
|
||||
@@ -209,10 +209,10 @@ void TimeRuler::drawForeground(QPainter *p, const QRectF &rect)
|
||||
int last_text_draw = INT_MIN;
|
||||
|
||||
// FIXME: Hardcoded number
|
||||
const int kAverageTextWidth = 200;
|
||||
const int k_average_text_width = 200;
|
||||
|
||||
for (int i = GetScroll() - kAverageTextWidth;
|
||||
i < GetScroll() + width() + kAverageTextWidth; i++) {
|
||||
for (int i = get_scroll() - k_average_text_width;
|
||||
i < get_scroll() + width() + k_average_text_width; i++) {
|
||||
double screen_pt = static_cast<double>(i);
|
||||
|
||||
if (long_interval > -1) {
|
||||
@@ -225,20 +225,20 @@ void TimeRuler::drawForeground(QPainter *p, const QRectF &rect)
|
||||
Qt::Alignment text_align;
|
||||
QString timecode_str =
|
||||
QString::fromStdString(Timecode::time_to_timecode(
|
||||
SceneToTime(i), timebase(),
|
||||
Core::instance()->GetTimecodeDisplay()));
|
||||
scene_to_time(i), timebase(),
|
||||
Core::instance()->get_timecode_display()));
|
||||
int timecode_width =
|
||||
QtUtils::QFontMetricsWidth(fm, timecode_str);
|
||||
QtUtils::q_font_metrics_width(fm, timecode_str);
|
||||
int timecode_left;
|
||||
|
||||
if (centered_text_) {
|
||||
text_rect = QRect(i - kAverageTextWidth / 2,
|
||||
marker_height, kAverageTextWidth,
|
||||
text_rect = QRect(i - k_average_text_width / 2,
|
||||
marker_height, k_average_text_width,
|
||||
fm.height());
|
||||
text_align = Qt::AlignCenter;
|
||||
timecode_left = i - timecode_width / 2;
|
||||
} else {
|
||||
text_rect = QRect(i, marker_height, kAverageTextWidth,
|
||||
text_rect = QRect(i, marker_height, k_average_text_width,
|
||||
fm.height());
|
||||
text_align = Qt::AlignLeft | Qt::AlignVCenter;
|
||||
timecode_left = i;
|
||||
@@ -275,53 +275,53 @@ void TimeRuler::drawForeground(QPainter *p, const QRectF &rect)
|
||||
|
||||
// If cache status is enabled
|
||||
if (show_cache_status_ && playback_cache_ &&
|
||||
playback_cache_->HasValidatedRanges()) {
|
||||
playback_cache_->has_validated_ranges()) {
|
||||
// FIXME: Hardcoded to get video length, if we ever need audio length, this will have to change
|
||||
int h = PlaybackCache::GetCacheIndicatorHeight();
|
||||
int h = PlaybackCache::get_cache_indicator_height();
|
||||
QRect cache_rect(0, height() - h, width(), h);
|
||||
|
||||
if (ViewerOutput *viewer =
|
||||
dynamic_cast<ViewerOutput *>(playback_cache_->parent())) {
|
||||
int right = TimeToScene(viewer->GetVideoLength());
|
||||
int right = time_to_scene(viewer->get_video_length());
|
||||
cache_rect.setWidth(std::max(0, right));
|
||||
}
|
||||
|
||||
if (cache_rect.width() > 0) {
|
||||
playback_cache_->Draw(p, SceneToTime(GetScroll()), GetScale(),
|
||||
playback_cache_->draw(p, scene_to_time(get_scroll()), get_scale(),
|
||||
cache_rect);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the playhead if it's on screen at the moment
|
||||
int playhead_pos = TimeToScene(GetViewerNode()->GetPlayhead());
|
||||
int playhead_pos = time_to_scene(get_viewer_node()->get_playhead());
|
||||
p->setPen(Qt::NoPen);
|
||||
p->setBrush(PLAYHEAD_COLOR);
|
||||
DrawPlayhead(p, playhead_pos, line_bottom);
|
||||
draw_playhead(p, playhead_pos, line_bottom);
|
||||
}
|
||||
|
||||
void TimeRuler::TimebaseChangedEvent(const rational &tb)
|
||||
void TimeRuler::TimebaseChangedEvent(const Rational &tb)
|
||||
{
|
||||
super::TimebaseChangedEvent(tb);
|
||||
|
||||
timebase_flipped_dbl_ = tb.flipped().toDouble();
|
||||
timebase_flipped_dbl_ = tb.flipped().to_double();
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
int TimeRuler::CacheStatusHeight() const
|
||||
int TimeRuler::cache_status_height() const
|
||||
{
|
||||
return fontMetrics().height() / 4;
|
||||
}
|
||||
|
||||
bool TimeRuler::ShowContextMenu(const QPoint &p)
|
||||
bool TimeRuler::show_context_menu(const QPoint &p)
|
||||
{
|
||||
if (super::ShowContextMenu(p)) {
|
||||
if (super::show_context_menu(p)) {
|
||||
return true;
|
||||
} else {
|
||||
Menu m(this);
|
||||
|
||||
MenuShared::instance()->AddItemsForTimeRulerMenu(&m);
|
||||
MenuShared::instance()->AboutToShowTimeRulerActions(timebase());
|
||||
MenuShared::instance()->add_items_for_time_ruler_menu(&m);
|
||||
MenuShared::instance()->about_to_show_time_ruler_actions(timebase());
|
||||
|
||||
m.exec(mapToGlobal(p));
|
||||
|
||||
@@ -329,7 +329,7 @@ bool TimeRuler::ShowContextMenu(const QPoint &p)
|
||||
}
|
||||
}
|
||||
|
||||
void TimeRuler::UpdateHeight()
|
||||
void TimeRuler::update_height()
|
||||
{
|
||||
int height = text_height();
|
||||
|
||||
@@ -340,11 +340,11 @@ void TimeRuler::UpdateHeight()
|
||||
|
||||
// Add cache status height
|
||||
if (show_cache_status_) {
|
||||
height += PlaybackCache::GetCacheIndicatorHeight();
|
||||
height += PlaybackCache::get_cache_indicator_height();
|
||||
}
|
||||
|
||||
// Add marker height
|
||||
height += TimelineMarker::GetMarkerHeight(fontMetrics());
|
||||
height += TimelineMarker::get_marker_height(fontMetrics());
|
||||
|
||||
setFixedHeight(height);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMERULER_H
|
||||
#define TIMERULER_H
|
||||
#ifndef OAK_TIMERULER_H
|
||||
#define OAK_TIMERULER_H
|
||||
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
@@ -37,22 +37,22 @@ public:
|
||||
TimeRuler(bool text_visible = true, bool cache_status_visible = false,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
void SetCenteredText(bool c);
|
||||
void set_centered_text(bool c);
|
||||
|
||||
void SetPlaybackCache(PlaybackCache *cache);
|
||||
void set_playback_cache(PlaybackCache *cache);
|
||||
|
||||
protected:
|
||||
virtual void drawForeground(QPainter *painter, const QRectF &rect) override;
|
||||
|
||||
virtual void TimebaseChangedEvent(const rational &tb) override;
|
||||
virtual void TimebaseChangedEvent(const Rational &tb) override;
|
||||
|
||||
protected slots:
|
||||
virtual bool ShowContextMenu(const QPoint &p) override;
|
||||
virtual bool show_context_menu(const QPoint &p) override;
|
||||
|
||||
private:
|
||||
void UpdateHeight();
|
||||
void update_height();
|
||||
|
||||
int CacheStatusHeight() const;
|
||||
int cache_status_height() const;
|
||||
|
||||
int minimum_gap_between_lines_;
|
||||
|
||||
@@ -69,4 +69,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // TIMERULER_H
|
||||
#endif // OAK_TIMERULER_H
|
||||
|
||||
Reference in New Issue
Block a user