From 8283051869ac8faad57d8c042c836f7ffd28b9ec Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 15 Feb 2019 03:48:53 -0800 Subject: [PATCH] some cleanups from previous refactors --- debian/rules | 4 ---- panels/project.cpp | 7 ++++++- panels/timeline.cpp | 8 ++++---- panels/timeline.h | 2 +- ui/focusfilter.cpp | 4 ++-- ui/scrollarea.cpp | 2 +- ui/timelinewidget.cpp | 18 +++++++++++------- 7 files changed, 25 insertions(+), 20 deletions(-) diff --git a/debian/rules b/debian/rules index 6bb702cee..9a794c695 100755 --- a/debian/rules +++ b/debian/rules @@ -4,10 +4,6 @@ export QT_SELECT := qt5 %: dh $@ -override_dh_auto_configure: - ls -a - dh_auto_configure - override_dh_auto_build: lrelease olive.pro dh_auto_build diff --git a/panels/project.cpp b/panels/project.cpp index b1908b47a..9eb9374cd 100644 --- a/panels/project.cpp +++ b/panels/project.cpp @@ -157,6 +157,12 @@ Project::Project(QWidget *parent) : tree_view->setModel(sorter); verticalLayout->addWidget(tree_view); + // Set the first column width + // I'm not sure if there's a better way to do this, default behavior seems to have all columns fixed width + // and let the last column fill up the remainder when really the opposite would be preferable (having the + // first column fill up the majority of the space). Anyway, this will probably do for now. + tree_view->setColumnWidth(0, tree_view->width()/2); + // icon view icon_view_container = new QWidget(); @@ -202,7 +208,6 @@ Project::Project(QWidget *parent) : connect(directory_up, SIGNAL(clicked(bool)), this, SLOT(go_up_dir())); connect(icon_view, SIGNAL(changed_root()), this, SLOT(set_up_dir_enabled())); - //retranslateUi(Project); setWindowTitle(tr("Project")); update_view_type(); diff --git a/panels/timeline.cpp b/panels/timeline.cpp index 428a6aaa0..3289a6866 100644 --- a/panels/timeline.cpp +++ b/panels/timeline.cpp @@ -731,9 +731,9 @@ void Timeline::set_zoom_value(double v) { center_scroll_to_playhead(horizontalScrollBar, zoom, Olive::ActiveSequence->playhead); } -void Timeline::set_zoom(bool in) { +void Timeline::multiply_zoom(double m) { showing_all = false; - set_zoom_value(zoom * ((in) ? 2 : 0.5)); + set_zoom_value(zoom * m); } void Timeline::decheck_tool_buttons(QObject* sender) { @@ -752,11 +752,11 @@ QVector Timeline::get_tracks_of_linked_clips(int i) { } void Timeline::zoom_in() { - set_zoom(true); + multiply_zoom(true); } void Timeline::zoom_out() { - set_zoom(false); + multiply_zoom(false); } bool is_clip_selected(Clip* clip, bool containing) { diff --git a/panels/timeline.h b/panels/timeline.h index 96ddabedd..34aa9fea7 100644 --- a/panels/timeline.h +++ b/panels/timeline.h @@ -76,7 +76,7 @@ public: ~Timeline(); bool focused(); - void set_zoom(bool in); + void multiply_zoom(double m); void copy(bool del); Clip* split_clip(ComboAction* ca, bool transitions, int p, long frame); Clip* split_clip(ComboAction* ca, bool transitions, int p, long frame, long post_in); diff --git a/ui/focusfilter.cpp b/ui/focusfilter.cpp index b3286a607..6e5ffabca 100644 --- a/ui/focusfilter.cpp +++ b/ui/focusfilter.cpp @@ -213,7 +213,7 @@ void FocusFilter::zoom_in() { } else if (focused_panel == panel_sequence_viewer) { panel_sequence_viewer->set_zoom(true); } else { - panel_timeline->set_zoom(true); + panel_timeline->multiply_zoom(true); } } @@ -226,7 +226,7 @@ void FocusFilter::zoom_out() { } else if (focused_panel == panel_sequence_viewer) { panel_sequence_viewer->set_zoom(false); } else { - panel_timeline->set_zoom(false); + panel_timeline->multiply_zoom(false); } } diff --git a/ui/scrollarea.cpp b/ui/scrollarea.cpp index 6c07728ff..7c9d6e90c 100644 --- a/ui/scrollarea.cpp +++ b/ui/scrollarea.cpp @@ -12,7 +12,7 @@ ScrollArea::ScrollArea(QWidget* parent) : QScrollArea(parent) {} void ScrollArea::wheelEvent(QWheelEvent *e) { if (config.scroll_zooms) { e->ignore(); - if (e->angleDelta().y() != 0) panel_timeline->set_zoom(e->angleDelta().y() > 0); + if (e->angleDelta().y() != 0) panel_timeline->multiply_zoom(e->angleDelta().y() > 0); } else { QScrollArea::wheelEvent(e); } diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp index ff6d71d1e..5beff5f23 100644 --- a/ui/timelinewidget.cpp +++ b/ui/timelinewidget.cpp @@ -1,5 +1,6 @@ #include "timelinewidget.h" +#include "oliveglobal.h" #include "panels/panels.h" #include "project/projectelements.h" @@ -17,6 +18,7 @@ #include "playback/playback.h" #include "ui/cursors.h" #include "ui/menuhelper.h" +#include "ui/focusfilter.h" #include "debug.h" #include "project/effect.h" @@ -68,10 +70,12 @@ void TimelineWidget::show_context_menu(const QPoint& pos) { QMenu menu(this); + // TODO replace with Olive::MenuHelper::make_edit_functions_menu() without losing functionality + QAction* undoAction = menu.addAction(tr("&Undo")); QAction* redoAction = menu.addAction(tr("&Redo")); - connect(undoAction, SIGNAL(triggered(bool)), Olive::MainWindow, SLOT(undo())); - connect(redoAction, SIGNAL(triggered(bool)), Olive::MainWindow, SLOT(redo())); + connect(undoAction, SIGNAL(triggered(bool)), Olive::Global.data(), SLOT(undo())); + connect(redoAction, SIGNAL(triggered(bool)), Olive::Global.data(), SLOT(redo())); undoAction->setEnabled(Olive::UndoStack.canUndo()); redoAction->setEnabled(Olive::UndoStack.canRedo()); menu.addSeparator(); @@ -87,11 +91,11 @@ void TimelineWidget::show_context_menu(const QPoint& pos) { if (!selected_clips.isEmpty()) { // clips are selected - menu.addAction(tr("C&ut"), Olive::MainWindow, SLOT(cut())); - menu.addAction(tr("Cop&y"), Olive::MainWindow, SLOT(copy())); + menu.addAction(tr("C&ut"), &Olive::FocusFilter, SLOT(cut())); + menu.addAction(tr("Cop&y"), &Olive::FocusFilter, SLOT(copy())); } - menu.addAction(tr("&Paste"), Olive::MainWindow, SLOT(paste())); + menu.addAction(tr("&Paste"), Olive::Global.data(), SLOT(paste())); if (selected_clips.isEmpty()) { // no clips are selected @@ -111,7 +115,7 @@ void TimelineWidget::show_context_menu(const QPoint& pos) { if (!selected_clips.isEmpty()) { menu.addSeparator(); - menu.addAction(tr("&Speed/Duration"), Olive::MainWindow, SLOT(open_speed_dialog())); + menu.addAction(tr("&Speed/Duration"), Olive::Global.data(), SLOT(open_speed_dialog())); QAction* autoscaleAction = menu.addAction(tr("Auto-s&cale"), this, SLOT(toggle_autoscale())); autoscaleAction->setCheckable(true); @@ -343,7 +347,7 @@ void TimelineWidget::wheelEvent(QWheelEvent *event) { bool shift = (event->modifiers() & Qt::ShiftModifier); bool in = (scroll_amount > 0); if (config.scroll_zooms != shift) { - panel_timeline->set_zoom(in); + panel_timeline->multiply_zoom(in); } else { QScrollBar* bar = alt ? scrollBar : panel_timeline->horizontalScrollBar;