some cleanups from previous refactors

This commit is contained in:
itsmattkc
2019-02-15 03:48:53 -08:00
parent 671000836e
commit 8283051869
7 changed files with 25 additions and 20 deletions
-4
View File
@@ -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
+6 -1
View File
@@ -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();
+4 -4
View File
@@ -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<int> 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) {
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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);
}
}
+1 -1
View File
@@ -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);
}
+11 -7
View File
@@ -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;