Merge branch 'master' of https://github.com/olive-editor/olive into blendmodefix

This commit is contained in:
itsmattkc
2019-01-28 17:28:06 +11:00
11 changed files with 119 additions and 72 deletions
+20 -16
View File
@@ -120,7 +120,7 @@ void PreferencesDialog::save() {
return;
}
bool needs_restart = false;
// save settings from UI to backend
config.css_path = custom_css_fn->text();
mainWindow->load_css_from_file(config.css_path);
@@ -133,24 +133,28 @@ void PreferencesDialog::save() {
config.previous_queue_size = previous_queue_spinbox->value();
config.previous_queue_type = previous_queue_type->currentIndex();
if (config.effect_textbox_lines != effect_textbox_lines_field->value()) {
needs_restart = true;
}
// the following settings may require a restart of Olive to take effect:
bool needs_restart = false;
if (config.effect_textbox_lines != effect_textbox_lines_field->value()) {
needs_restart = true;
}
config.effect_textbox_lines = effect_textbox_lines_field->value();
if (config.use_software_fallback != use_software_fallbacks_checkbox->isChecked()) {
needs_restart = true;
}
config.use_software_fallback = use_software_fallbacks_checkbox->isChecked();
if (config.use_software_fallback != use_software_fallbacks_checkbox->isChecked()) {
needs_restart = true;
}
config.use_software_fallback = use_software_fallbacks_checkbox->isChecked();
// save keyboard shortcuts
for (int i=0;i<key_shortcut_fields.size();i++) {
key_shortcut_fields.at(i)->set_action_shortcut();
}
if (needs_restart) {
QMessageBox::information(this, tr("Warning"), tr("Some changed settings will require restarting Olive to take effect"));
}
if (needs_restart) {
QMessageBox::information(this, tr("Warning"), tr("Some changed settings will require restarting Olive to take effect"));
}
accept();
}
@@ -319,11 +323,11 @@ void PreferencesDialog::setup_ui() {
effect_textbox_lines_field->setValue(config.effect_textbox_lines);
general_layout->addWidget(effect_textbox_lines_field, 3, 1, 1, 2);
// General -> Use Software Fallbacks When Possible
use_software_fallbacks_checkbox = new QCheckBox(general_tab);
use_software_fallbacks_checkbox->setText(tr("Use Software Fallbacks When Possible"));
use_software_fallbacks_checkbox->setChecked(config.use_software_fallback);
general_layout->addWidget(use_software_fallbacks_checkbox, 4, 0, 1, 1);
// General -> Use Software Fallbacks When Possible
use_software_fallbacks_checkbox = new QCheckBox(general_tab);
use_software_fallbacks_checkbox->setText(tr("Use Software Fallbacks When Possible"));
use_software_fallbacks_checkbox->setChecked(config.use_software_fallback);
general_layout->addWidget(use_software_fallbacks_checkbox, 4, 0, 1, 1);
tabWidget->addTab(general_tab, tr("General"));
+1 -1
View File
@@ -61,7 +61,7 @@ private:
QDoubleSpinBox* previous_queue_spinbox;
QComboBox* previous_queue_type;
QSpinBox* effect_textbox_lines_field;
QCheckBox* use_software_fallbacks_checkbox;
QCheckBox* use_software_fallbacks_checkbox;
QVector<QAction*> key_shortcut_actions;
QVector<QTreeWidgetItem*> key_shortcut_items;
+6 -1
View File
@@ -47,7 +47,8 @@ Config::Config()
loop(true),
seek_also_selects(false),
effect_textbox_lines(3),
use_software_fallback(false)
use_software_fallback(false),
center_timeline_timecodes(true)
{}
void Config::load(QString path) {
@@ -169,6 +170,9 @@ void Config::load(QString path) {
} else if (stream.name() == "UseSoftwareFallback") {
stream.readNext();
use_software_fallback = (stream.text() == "1");
} else if (stream.name() == "CenterTimelineTimecodes") {
stream.readNext();
center_timeline_timecodes = (stream.text() == "1");
}
}
}
@@ -230,6 +234,7 @@ void Config::save(QString path) {
stream.writeTextElement("CSSPath", css_path);
stream.writeTextElement("EffectTextboxLines", QString::number(effect_textbox_lines));
stream.writeTextElement("UseSoftwareFallback", QString::number(use_software_fallback));
stream.writeTextElement("CenterTimelineTimecodes", QString::number(center_timeline_timecodes));
stream.writeEndElement(); // configuration
stream.writeEndDocument(); // doc
+1
View File
@@ -63,6 +63,7 @@ struct Config {
QString css_path;
int effect_textbox_lines;
bool use_software_fallback;
bool center_timeline_timecodes;
void load(QString path);
void save(QString path);
+9 -1
View File
@@ -436,7 +436,15 @@ void MainWindow::export_dialog() {
}
void MainWindow::ripple_delete() {
if (sequence != nullptr) panel_timeline->delete_selection(sequence->selections, true);
if (sequence != nullptr) {
if (sequence->selections.size() > 0) {
panel_timeline->delete_selection(sequence->selections, true);
} else if (config.hover_focus && get_focused_panel() == panel_timeline) {
if (panel_timeline->can_ripple_empty_space(panel_timeline->cursor_frame, panel_timeline->cursor_track)) {
panel_timeline->ripple_delete_empty_space();
}
}
}
}
void MainWindow::editMenu_About_To_Be_Shown() {
+6 -5
View File
@@ -39,6 +39,8 @@ public slots:
void nest();
void toggle_full_screen();
void toggle_bool_action();
protected:
void closeEvent(QCloseEvent *);
void paintEvent(QPaintEvent *event);
@@ -126,7 +128,6 @@ private slots:
void edit_to_in_point();
void edit_to_out_point();
void paste_insert();
void toggle_bool_action();
void set_autoscroll();
void menu_click_button();
void toggle_panel_visibility();
@@ -142,6 +143,10 @@ private:
bool can_close_project();
void setup_menus();
void set_bool_action_checked(QAction* a);
void set_int_action_checked(QAction* a, const int& i);
void set_button_action_checked(QAction* a);
// menu bar menus
QMenu* window_menu;
@@ -196,10 +201,6 @@ private:
QAction* undo_action;
QAction* redo_action;
void set_bool_action_checked(QAction* a);
void set_int_action_checked(QAction* a, const int& i);
void set_button_action_checked(QAction* a);
bool enable_launch_with_project;
QString appName;
+41
View File
@@ -484,6 +484,47 @@ void Timeline::select_from_playhead() {
}
}
bool Timeline::can_ripple_empty_space(long frame, int track) {
bool can_ripple_delete = true;
bool at_end_of_sequence = true;
rc_ripple_min = 0;
rc_ripple_max = LONG_MAX;
for (int i=0;i<sequence->clips.size();i++) {
Clip* c = sequence->clips.at(i);
if (c != nullptr) {
if (c->timeline_in > frame || c->timeline_out > frame) {
at_end_of_sequence = false;
}
if (c->track == track) {
if (c->timeline_in <= frame && c->timeline_out >= frame) {
can_ripple_delete = false;
break;
} else if (c->timeline_out < frame) {
rc_ripple_min = qMax(rc_ripple_min, c->timeline_out);
} else if (c->timeline_in > frame) {
rc_ripple_max = qMin(rc_ripple_max, c->timeline_in);
}
}
}
}
return (can_ripple_delete && !at_end_of_sequence);
}
void Timeline::ripple_delete_empty_space() {
QVector<Selection> sels;
Selection s;
s.in = rc_ripple_min;
s.out = rc_ripple_max;
s.track = panel_timeline->cursor_track;
sels.append(s);
panel_timeline->delete_selection(sels, true);
}
void Timeline::resizeEvent(QResizeEvent *) {
// adjust maximum scrollbar
if (sequence != nullptr) set_sb_max();
+8 -1
View File
@@ -72,7 +72,7 @@ class Timeline : public QDockWidget
{
Q_OBJECT
public:
explicit Timeline(QWidget *parent = 0);
explicit Timeline(QWidget *parent = nullptr);
~Timeline();
bool focused();
@@ -204,6 +204,8 @@ public:
void scroll_to_frame(long frame);
void select_from_playhead();
bool can_ripple_empty_space(long frame, int track);
void resizeEvent(QResizeEvent *event);
public slots:
void paste(bool insert = false);
@@ -212,6 +214,7 @@ public slots:
void deselect();
void toggle_links();
void split_at_playhead();
void ripple_delete_empty_space();
private slots:
void zoom_in();
@@ -238,6 +241,10 @@ private:
int default_track_height;
// ripple delete empty space variables
long rc_ripple_min;
long rc_ripple_max;
QWidget* timeline_area;
TimelineWidget* video_area;
TimelineWidget* audio_area;
+21 -2
View File
@@ -22,6 +22,9 @@
#define SUBLINE_MIN_PADDING 50 // TODO play with this
#define MARKER_SIZE 4
// used only if center_timeline_timecodes is FALSE
#define TEXT_PADDING_FROM_LINE 4
bool center_scroll_to_playhead(QScrollBar* bar, double zoom, long playhead) {
// returns true is the scroll was changed, false if not
int target_scroll = qMin(bar->maximum(), qMax(0, getScreenPointFromFrame(zoom, playhead)-(bar->width()>>1)));
@@ -351,7 +354,16 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
timecode = frame_to_timecode(frame + in_visible, config.timecode_view, viewer->seq->frame_rate);
fullTextWidth = fm.width(timecode);
textWidth = fullTextWidth>>1;
text_x = lineX-textWidth;
text_x = lineX;
// centers the text to that point on the timeline, LEFT aligns it if not
if (config.center_timeline_timecodes) {
text_x -= textWidth;
} else {
text_x += TEXT_PADDING_FROM_LINE;
}
lastTextBoundary = lineX+textWidth;
if (lastTextBoundary >= 0) {
draw_text = true;
@@ -366,7 +378,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
// draw line markers
p.setPen(Qt::gray);
p.drawLine(lineX, yoff, lineX, height());
p.drawLine(lineX, (!config.center_timeline_timecodes && draw_text) ? 0 : yoff, lineX, height());
// draw sub-line markers
for (int j=1;j<sublineCount;j++) {
@@ -443,6 +455,13 @@ void TimelineHeader::show_context_menu(const QPoint &pos) {
mainWindow->make_inout_menu(&menu);
menu.addSeparator();
QAction* center_timecodes = menu.addAction(tr("Center Timecodes"), mainWindow, SLOT(toggle_bool_action()));
center_timecodes->setCheckable(true);
center_timecodes->setChecked(config.center_timeline_timecodes);
center_timecodes->setData(reinterpret_cast<quintptr>(&config.center_timeline_timecodes));
menu.exec(mapToGlobal(pos));
}
+4 -39
View File
@@ -66,19 +66,6 @@ TimelineWidget::TimelineWidget(QWidget *parent) : QWidget(parent) {
connect(&tooltip_timer, SIGNAL(timeout()), this, SLOT(tooltip_timer_timeout()));
}
void TimelineWidget::right_click_ripple() {
QVector<Selection> sels;
Selection s;
s.in = rc_ripple_min;
s.out = rc_ripple_max;
s.track = panel_timeline->cursor_track;
sels.append(s);
panel_timeline->delete_selection(sels, true);
}
void TimelineWidget::show_context_menu(const QPoint& pos) {
if (sequence != nullptr) {
// hack because sometimes right clicking doesn't trigger mouse release event
@@ -114,36 +101,14 @@ void TimelineWidget::show_context_menu(const QPoint& pos) {
if (selected_clips.isEmpty()) {
// no clips are selected
// determine if we can perform a ripple empty space
panel_timeline->cursor_frame = panel_timeline->getTimelineFrameFromScreenPoint(pos.x());
panel_timeline->cursor_track = getTrackFromScreenPoint(pos.y());
bool can_ripple_delete = true;
bool at_end_of_sequence = true;
rc_ripple_min = 0;
rc_ripple_max = LONG_MAX;
for (int i=0;i<sequence->clips.size();i++) {
Clip* c = sequence->clips.at(i);
if (c != nullptr) {
if (c->timeline_in > panel_timeline->cursor_frame || c->timeline_out > panel_timeline->cursor_frame) {
at_end_of_sequence = false;
}
if (c->track == panel_timeline->cursor_track) {
if (c->timeline_in <= panel_timeline->cursor_frame && c->timeline_out >= panel_timeline->cursor_frame) {
can_ripple_delete = false;
break;
} else if (c->timeline_out < panel_timeline->cursor_frame) {
rc_ripple_min = qMax(rc_ripple_min, c->timeline_out);
} else if (c->timeline_in > panel_timeline->cursor_frame) {
rc_ripple_max = qMin(rc_ripple_max, c->timeline_in);
}
}
}
}
if (can_ripple_delete && !at_end_of_sequence) {
if (panel_timeline->can_ripple_empty_space(panel_timeline->cursor_frame, panel_timeline->cursor_track)) {
QAction* ripple_delete_action = menu.addAction("R&ipple Delete");
connect(ripple_delete_action, SIGNAL(triggered(bool)), this, SLOT(right_click_ripple()));
connect(ripple_delete_action, SIGNAL(triggered(bool)), panel_timeline, SLOT(ripple_delete_empty_space()));
}
QAction* seq_settings = menu.addAction("Sequence Settings");
+2 -6
View File
@@ -63,13 +63,10 @@ private:
QVector<Clip*> pre_clips;
QVector<Clip*> post_clips;
Sequence* self_created_sequence;
// used for "right click ripple"
long rc_ripple_min;
long rc_ripple_max;
Media* rc_reveal_media;
Sequence* self_created_sequence;
QTimer tooltip_timer;
int tooltip_clip;
@@ -83,7 +80,6 @@ public slots:
private slots:
void reveal_media();
void right_click_ripple();
void show_context_menu(const QPoint& pos);
void toggle_autoscale();
void tooltip_timer_timeout();