completed focus filter and menu helpers
This commit is contained in:
@@ -74,6 +74,28 @@ void FocusFilter::go_to_end() {
|
||||
}
|
||||
}
|
||||
|
||||
void FocusFilter::set_viewer_fullscreen() {
|
||||
if (get_focused_panel() == panel_footage_viewer) {
|
||||
panel_footage_viewer->viewer_widget->set_fullscreen();
|
||||
} else {
|
||||
panel_sequence_viewer->viewer_widget->set_fullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
void FocusFilter::set_marker() {
|
||||
if (Olive::ActiveSequence != nullptr) {
|
||||
QDockWidget* focused_panel = get_focused_panel();
|
||||
|
||||
if (focused_panel == panel_footage_viewer) {
|
||||
panel_footage_viewer->set_marker();
|
||||
} else if (focused_panel == panel_sequence_viewer) {
|
||||
panel_sequence_viewer->set_marker();
|
||||
} else {
|
||||
panel_timeline->set_marker();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FocusFilter::playpause() {
|
||||
QDockWidget* focused_panel = get_focused_panel();
|
||||
if (focused_panel == panel_footage_viewer) {
|
||||
|
||||
@@ -26,6 +26,10 @@ public slots:
|
||||
void next_frame();
|
||||
void go_to_end();
|
||||
|
||||
void set_viewer_fullscreen();
|
||||
|
||||
void set_marker();
|
||||
|
||||
void set_in_point();
|
||||
void set_out_point();
|
||||
void clear_in();
|
||||
|
||||
+86
-1
@@ -4,10 +4,15 @@
|
||||
|
||||
#include "ui/focusfilter.h"
|
||||
|
||||
#include "io/config.h"
|
||||
|
||||
#include "panels/panels.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
|
||||
MenuHelper Olive::MenuHelper;
|
||||
|
||||
void MenuHelper::make_new_menu(QMenu *parent) {
|
||||
@@ -40,7 +45,7 @@ void MenuHelper::make_edit_functions_menu(QMenu *parent) {
|
||||
parent->addAction(tr("Paste Insert"), Olive::Global.data(), SLOT(paste_insert()), QKeySequence("Ctrl+Shift+V"))->setProperty("id", "pasteinsert");
|
||||
parent->addAction(tr("Duplicate"), &Olive::FocusFilter, SLOT(duplicate()), QKeySequence("Ctrl+D"))->setProperty("id", "duplicate");
|
||||
parent->addAction(tr("Delete"), &Olive::FocusFilter, SLOT(delete_function()), QKeySequence("Del"))->setProperty("id", "delete");
|
||||
parent->addAction(tr("Ripple Delete"), this, SLOT(ripple_delete()), QKeySequence("Shift+Del"))->setProperty("id", "rippledelete");
|
||||
parent->addAction(tr("Ripple Delete"), panel_timeline, SLOT(ripple_delete()), QKeySequence("Shift+Del"))->setProperty("id", "rippledelete");
|
||||
parent->addAction(tr("Split"), panel_timeline, SLOT(split_at_playhead()), QKeySequence("Ctrl+K"))->setProperty("id", "split");
|
||||
}
|
||||
|
||||
@@ -61,3 +66,83 @@ void MenuHelper::set_int_action_checked(QAction *a, const int& i) {
|
||||
void MenuHelper::set_button_action_checked(QAction *a) {
|
||||
a->setChecked(reinterpret_cast<QPushButton*>(a->data().value<quintptr>())->isChecked());
|
||||
}
|
||||
|
||||
void MenuHelper::toggle_bool_action() {
|
||||
QAction* action = static_cast<QAction*>(sender());
|
||||
bool* variable = reinterpret_cast<bool*>(action->data().value<quintptr>());
|
||||
*variable = !(*variable);
|
||||
update_ui(false);
|
||||
}
|
||||
|
||||
void MenuHelper::set_titlesafe_from_menu() {
|
||||
double tsa = static_cast<QAction*>(sender())->data().toDouble();
|
||||
|
||||
if (qIsNaN(tsa)) {
|
||||
|
||||
// disable title safe area
|
||||
config.show_title_safe_area = false;
|
||||
|
||||
} else {
|
||||
|
||||
// using title safe area
|
||||
config.show_title_safe_area = true;
|
||||
|
||||
// are we using the default area aspect ratio, or a specific one
|
||||
if (qIsNull(tsa)) {
|
||||
|
||||
// default title safe area
|
||||
config.use_custom_title_safe_ratio = false;
|
||||
|
||||
} else {
|
||||
|
||||
// using a specific aspect ratio
|
||||
config.use_custom_title_safe_ratio = true;
|
||||
|
||||
if (tsa < 0.0) {
|
||||
|
||||
// set a custom title safe area
|
||||
QString input;
|
||||
bool invalid = false;
|
||||
QRegExp arTest("[0-9.]+:[0-9.]+");
|
||||
|
||||
do {
|
||||
if (invalid) {
|
||||
QMessageBox::critical(Olive::MainWindow, tr("Invalid aspect ratio"), tr("The aspect ratio '%1' is invalid. Please try again.").arg(input));
|
||||
}
|
||||
|
||||
input = QInputDialog::getText(Olive::MainWindow, tr("Enter custom aspect ratio"), tr("Enter the aspect ratio to use for the title/action safe area (e.g. 16:9):"));
|
||||
invalid = !arTest.exactMatch(input) && !input.isEmpty();
|
||||
} while (invalid);
|
||||
|
||||
if (!input.isEmpty()) {
|
||||
QStringList inputList = input.split(':');
|
||||
config.custom_title_safe_ratio = inputList.at(0).toDouble()/inputList.at(1).toDouble();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// specified tsa is a specific custom aspect ratio
|
||||
config.custom_title_safe_ratio = tsa;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
}
|
||||
|
||||
void MenuHelper::set_autoscroll() {
|
||||
QAction* action = static_cast<QAction*>(sender());
|
||||
config.autoscroll = action->data().toInt();
|
||||
}
|
||||
|
||||
void MenuHelper::menu_click_button() {
|
||||
reinterpret_cast<QPushButton*>(static_cast<QAction*>(sender())->data().value<quintptr>())->click();
|
||||
}
|
||||
|
||||
void MenuHelper::set_timecode_view() {
|
||||
QAction* action = static_cast<QAction*>(sender());
|
||||
config.timecode_view = action->data().toInt();
|
||||
update_ui(false);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,17 @@ public:
|
||||
void set_bool_action_checked(QAction* a);
|
||||
void set_int_action_checked(QAction* a, const int& i);
|
||||
void set_button_action_checked(QAction* a);
|
||||
|
||||
public slots:
|
||||
|
||||
void toggle_bool_action();
|
||||
|
||||
void set_titlesafe_from_menu();
|
||||
|
||||
void set_autoscroll();
|
||||
void menu_click_button();
|
||||
void set_timecode_view();
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user