completed focus filter and menu helpers
This commit is contained 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user