implemented translating without restarting #514

This commit is contained in:
itsmattkc
2019-02-25 20:40:23 -08:00
parent c3373524b1
commit 47d0065eff
29 changed files with 7306 additions and 7404 deletions
+213 -84
View File
@@ -32,142 +32,271 @@
#include <QMessageBox>
#include <QInputDialog>
#include <QPushButton>
#include <QMenuBar>
MenuHelper olive::MenuHelper;
void MenuHelper::InitializeSharedMenus()
{
new_project_ = create_menu_action(nullptr, "newproj", olive::Global.get(), SLOT(new_project()), QKeySequence("Ctrl+N"));
new_project_->setParent(this);
new_sequence_ = create_menu_action(nullptr, "newseq", panel_project, SLOT(new_sequence()), QKeySequence("Ctrl+Shift+N"));
new_sequence_->setParent(this);
new_folder_ = create_menu_action(nullptr, "newfolder", panel_project, SLOT(new_folder()));
new_folder_->setParent(this);
set_in_point_ = create_menu_action(nullptr, "setinpoint", &olive::FocusFilter, SLOT(set_in_point()), QKeySequence("I"));
set_in_point_->setParent(this);
set_out_point_ = create_menu_action(nullptr, "setoutpoint", &olive::FocusFilter, SLOT(set_out_point()), QKeySequence("O"));
set_out_point_->setParent(this);
reset_in_point_ = create_menu_action(nullptr, "resetin", &olive::FocusFilter, SLOT(clear_in()));
reset_in_point_->setParent(this);
reset_out_point_ = create_menu_action(nullptr, "resetout", &olive::FocusFilter, SLOT(clear_out()));
reset_out_point_->setParent(this);
clear_inout_point = create_menu_action(nullptr, "clearinout", &olive::FocusFilter, SLOT(clear_inout()), QKeySequence("G"));
clear_inout_point->setParent(this);
add_default_transition_ = create_menu_action(nullptr, "deftransition", panel_timeline, SLOT(add_transition()), QKeySequence("Ctrl+Shift+D"));
add_default_transition_->setParent(this);
link_unlink_ = create_menu_action(nullptr, "linkunlink", panel_timeline, SLOT(toggle_links()), QKeySequence("Ctrl+L"));
link_unlink_->setParent(this);
enable_disable_ = create_menu_action(nullptr, "enabledisable", panel_timeline, SLOT(toggle_enable_on_selected_clips()), QKeySequence("Shift+E"));
enable_disable_->setParent(this);
nest_ = create_menu_action(nullptr, "nest", panel_timeline, SLOT(nest()));
nest_->setParent(this);
cut_ = create_menu_action(nullptr, "cut", &olive::FocusFilter, SLOT(cut()), QKeySequence("Ctrl+X"));
cut_->setParent(this);
copy_ = create_menu_action(nullptr, "copy", &olive::FocusFilter, SLOT(copy()), QKeySequence("Ctrl+C"));
copy_->setParent(this);
paste_ = create_menu_action(nullptr, "paste", olive::Global.get(), SLOT(paste()), QKeySequence("Ctrl+V"));
paste_->setParent(this);
paste_insert_ = create_menu_action(nullptr, "pasteinsert", olive::Global.get(), SLOT(paste_insert()), QKeySequence("Ctrl+Shift+V"));
paste_insert_->setParent(this);
duplicate_ = create_menu_action(nullptr, "duplicate", &olive::FocusFilter, SLOT(duplicate()), QKeySequence("Ctrl+D"));
duplicate_->setParent(this);
delete_ = create_menu_action(nullptr, "delete", &olive::FocusFilter, SLOT(delete_function()), QKeySequence("Del"));
delete_->setParent(this);
ripple_delete_ = create_menu_action(nullptr, "rippledelete", panel_timeline, SLOT(ripple_delete()), QKeySequence("Shift+Del"));
ripple_delete_->setParent(this);
split_ = create_menu_action(nullptr, "split", panel_timeline, SLOT(split_at_playhead()), QKeySequence("Ctrl+K"));
split_->setParent(this);
Retranslate();
}
void MenuHelper::make_new_menu(QMenu *parent) {
parent->addAction(tr("&Project"), olive::Global.get(), SLOT(new_project()), QKeySequence("Ctrl+N"))->setProperty("id", "newproj");
parent->addSeparator();
parent->addAction(tr("&Sequence"), panel_project, SLOT(new_sequence()), QKeySequence("Ctrl+Shift+N"))->setProperty("id", "newseq");
parent->addAction(tr("&Folder"), panel_project, SLOT(new_folder()))->setProperty("id", "newfolder");
parent->addAction(new_project_);
parent->addSeparator();
parent->addAction(new_sequence_);
parent->addAction(new_folder_);
}
void MenuHelper::make_inout_menu(QMenu *parent) {
parent->addAction(tr("Set In Point"), &olive::FocusFilter, SLOT(set_in_point()), QKeySequence("I"))->setProperty("id", "setinpoint");
parent->addAction(tr("Set Out Point"), &olive::FocusFilter, SLOT(set_out_point()), QKeySequence("O"))->setProperty("id", "setoutpoint");
parent->addSeparator();
parent->addAction(tr("Reset In Point"), &olive::FocusFilter, SLOT(clear_in()))->setProperty("id", "resetin");
parent->addAction(tr("Reset Out Point"), &olive::FocusFilter, SLOT(clear_out()))->setProperty("id", "resetout");
parent->addAction(tr("Clear In/Out Point"), &olive::FocusFilter, SLOT(clear_inout()), QKeySequence("G"))->setProperty("id", "clearinout");
parent->addAction(set_in_point_);
parent->addAction(set_out_point_);
parent->addSeparator();
parent->addAction(reset_in_point_);
parent->addAction(reset_out_point_);
parent->addAction(clear_inout_point);
}
void MenuHelper::make_clip_functions_menu(QMenu *parent) {
parent->addAction(tr("Add Default Transition"), panel_timeline, SLOT(add_transition()), QKeySequence("Ctrl+Shift+D"))->setProperty("id", "deftransition");
parent->addAction(tr("Link/Unlink"), panel_timeline, SLOT(toggle_links()), QKeySequence("Ctrl+L"))->setProperty("id", "linkunlink");
parent->addAction(tr("Enable/Disable"), panel_timeline, SLOT(toggle_enable_on_selected_clips()), QKeySequence("Shift+E"))->setProperty("id", "enabledisable");
parent->addAction(tr("Nest"), panel_timeline, SLOT(nest()))->setProperty("id", "nest");
parent->addAction(add_default_transition_);
parent->addAction(link_unlink_);
parent->addAction(enable_disable_);
parent->addAction(nest_);
}
void MenuHelper::make_edit_functions_menu(QMenu *parent) {
parent->addAction(tr("Cu&t"), &olive::FocusFilter, SLOT(cut()), QKeySequence("Ctrl+X"))->setProperty("id", "cut");
parent->addAction(tr("Cop&y"), &olive::FocusFilter, SLOT(copy()), QKeySequence("Ctrl+C"))->setProperty("id", "copy");
parent->addAction(tr("&Paste"), olive::Global.get(), SLOT(paste()), QKeySequence("Ctrl+V"))->setProperty("id", "paste");
parent->addAction(tr("Paste Insert"), olive::Global.get(), 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"), 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");
parent->addAction(cut_);
parent->addAction(copy_);
parent->addAction(paste_);
parent->addAction(paste_insert_);
parent->addAction(duplicate_);
parent->addAction(delete_);
parent->addAction(ripple_delete_);
parent->addAction(split_);
}
void MenuHelper::set_bool_action_checked(QAction *a) {
if (!a->data().isNull()) {
bool* variable = reinterpret_cast<bool*>(a->data().value<quintptr>());
a->setChecked(*variable);
}
if (!a->data().isNull()) {
bool* variable = reinterpret_cast<bool*>(a->data().value<quintptr>());
a->setChecked(*variable);
}
}
void MenuHelper::set_int_action_checked(QAction *a, const int& i) {
if (!a->data().isNull()) {
a->setChecked(a->data() == i);
}
if (!a->data().isNull()) {
a->setChecked(a->data() == i);
}
}
#include <QPushButton>
void MenuHelper::set_button_action_checked(QAction *a) {
a->setChecked(reinterpret_cast<QPushButton*>(a->data().value<quintptr>())->isChecked());
a->setChecked(reinterpret_cast<QPushButton*>(a->data().value<quintptr>())->isChecked());
}
void MenuHelper::Retranslate()
{
new_project_->setText(tr("&Project"));
new_sequence_->setText(tr("&Sequence"));
new_folder_->setText(tr("&Folder"));
set_in_point_->setText(tr("Set In Point"));
set_out_point_->setText(tr("Set Out Point"));
reset_in_point_->setText(tr("Reset In Point"));
reset_out_point_->setText(tr("Reset Out Point"));
clear_inout_point->setText(tr("Clear In/Out Point"));
add_default_transition_->setText(tr("Add Default Transition"));
link_unlink_->setText(tr("Link/Unlink"));
enable_disable_->setText(tr("Enable/Disable"));
nest_->setText(tr("Nest"));
cut_->setText(tr("Cu&t"));
copy_->setText(tr("Cop&y"));
paste_->setText(tr("&Paste"));
paste_insert_->setText(tr("Paste Insert"));
duplicate_->setText(tr("Duplicate"));
delete_->setText(tr("Delete"));
ripple_delete_->setText(tr("Ripple Delete"));
split_->setText(tr("Split"));
}
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);
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();
double tsa = static_cast<QAction*>(sender())->data().toDouble();
if (qIsNaN(tsa)) {
if (qIsNaN(tsa)) {
// disable title safe area
olive::CurrentConfig.show_title_safe_area = false;
// disable title safe area
olive::CurrentConfig.show_title_safe_area = false;
} else {
// using title safe area
olive::CurrentConfig.show_title_safe_area = true;
// are we using the default area aspect ratio, or a specific one
if (qIsNull(tsa)) {
// default title safe area
olive::CurrentConfig.use_custom_title_safe_ratio = false;
} else {
// using title safe area
olive::CurrentConfig.show_title_safe_area = true;
// using a specific aspect ratio
olive::CurrentConfig.use_custom_title_safe_ratio = true;
// are we using the default area aspect ratio, or a specific one
if (qIsNull(tsa)) {
if (tsa < 0.0) {
// default title safe area
olive::CurrentConfig.use_custom_title_safe_ratio = false;
// set a custom title safe area
QString input;
bool invalid = false;
QRegExp arTest("[0-9.]+:[0-9.]+");
} else {
do {
if (invalid) {
QMessageBox::critical(olive::MainWindow, tr("Invalid aspect ratio"), tr("The aspect ratio '%1' is invalid. Please try again.").arg(input));
}
// using a specific aspect ratio
olive::CurrentConfig.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(':');
olive::CurrentConfig.custom_title_safe_ratio = inputList.at(0).toDouble()/inputList.at(1).toDouble();
}
} else {
// specified tsa is a specific custom aspect ratio
olive::CurrentConfig.custom_title_safe_ratio = tsa;
}
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(':');
olive::CurrentConfig.custom_title_safe_ratio = inputList.at(0).toDouble()/inputList.at(1).toDouble();
}
} else {
// specified tsa is a specific custom aspect ratio
olive::CurrentConfig.custom_title_safe_ratio = tsa;
}
}
panel_sequence_viewer->viewer_widget->update();
}
panel_sequence_viewer->viewer_widget->update();
}
void MenuHelper::set_autoscroll() {
QAction* action = static_cast<QAction*>(sender());
olive::CurrentConfig.autoscroll = action->data().toInt();
QAction* action = static_cast<QAction*>(sender());
olive::CurrentConfig.autoscroll = action->data().toInt();
}
void MenuHelper::menu_click_button() {
reinterpret_cast<QPushButton*>(static_cast<QAction*>(sender())->data().value<quintptr>())->click();
reinterpret_cast<QPushButton*>(static_cast<QAction*>(sender())->data().value<quintptr>())->click();
}
void MenuHelper::set_timecode_view() {
QAction* action = static_cast<QAction*>(sender());
olive::CurrentConfig.timecode_view = action->data().toInt();
update_ui(false);
QAction* action = static_cast<QAction*>(sender());
olive::CurrentConfig.timecode_view = action->data().toInt();
update_ui(false);
}
void MenuHelper::open_recent_from_menu() {
int index = static_cast<QAction*>(sender())->data().toInt();
olive::Global.get()->open_recent(index);
int index = static_cast<QAction*>(sender())->data().toInt();
olive::Global.get()->open_recent(index);
}
QMenu* MenuHelper::create_submenu(QMenuBar* parent,
const QObject *receiver,
const char *member) {
QMenu* menu = new QMenu(parent);
parent->addMenu(menu);
if (receiver != nullptr) {
QObject::connect(menu, SIGNAL(aboutToShow()), receiver, member);
}
return menu;
}
QMenu* MenuHelper::create_submenu(QMenu* parent) {
QMenu* menu = new QMenu(parent);
parent->addMenu(menu);
return menu;
}
QAction* MenuHelper::create_menu_action(QWidget *parent,
const char* id,
const QObject *receiver,
const char *member,
const QKeySequence &shortcut) {
QAction* action = new QAction(parent);
action->setProperty("id", id);
action->setShortcut(shortcut);
if (receiver != nullptr) {
QObject::connect(action, SIGNAL(triggered(bool)), receiver, member);
}
if (parent != nullptr) {
parent->addAction(action);
}
return action;
}
+171 -132
View File
@@ -25,151 +25,190 @@
#include <QMenu>
class MenuHelper : public QObject {
Q_OBJECT
Q_OBJECT
public:
/**
* @brief Creates a menu of new items that can be created
*
* Adds the full set of creatable items to a QMenu (e.g. new project,
* new sequence, new folder, etc.)
*
* @param parent
*
* The menu to add items to.
*/
void make_new_menu(QMenu* parent);
void InitializeSharedMenus();
/**
* @brief Creates a menu of options for working with in/out points
*
* Adds a set of options for working with sequence/footage in/out points,
* e.g. setting in/out points, clearing in/out points, etc.
*
* @param parent
*
* The menu to add items to.
*/
void make_inout_menu(QMenu* parent);
/**
* @brief Creates a menu of new items that can be created
*
* Adds the full set of creatable items to a QMenu (e.g. new project,
* new sequence, new folder, etc.)
*
* @param parent
*
* The menu to add items to.
*/
void make_new_menu(QMenu* parent);
/**
* @brief Creates a menu of clip functions
*
* Adds a set of clip functions including:
* * Add Default Transition
* * Link/Unlink
* * Enable/Disable
* * Nest
*
* @param parent
*
* The menu to add items to.
*/
void make_clip_functions_menu(QMenu* parent);
/**
* @brief Creates a menu of options for working with in/out points
*
* Adds a set of options for working with sequence/footage in/out points,
* e.g. setting in/out points, clearing in/out points, etc.
*
* @param parent
*
* The menu to add items to.
*/
void make_inout_menu(QMenu* parent);
/**
* @brief Creates standard edit menu (cut, copy, paste, etc.)
*
* @param parent
*
* The menu to add items to.
*/
void make_edit_functions_menu(QMenu* parent);
/**
* @brief Creates a menu of clip functions
*
* Adds a set of clip functions including:
* * Add Default Transition
* * Link/Unlink
* * Enable/Disable
* * Nest
*
* @param parent
*
* The menu to add items to.
*/
void make_clip_functions_menu(QMenu* parent);
/**
* @brief Sets the checked state of a menu item based on a Boolean variable.
*
* Many menu items simply toggle a Boolean variable. This is a convenience function, assuming the QAction's data
* variable is a pointer to a Boolean variable, that sets the checked state of the QAction to the enabled state
* of the Boolean. Used heavily in functions like toolMenu_About_To_Be_Shown()
*
* @param a
*
* The QAction to set the checked state of.
*/
void set_bool_action_checked(QAction* a);
/**
* @brief Creates standard edit menu (cut, copy, paste, etc.)
*
* @param parent
*
* The menu to add items to.
*/
void make_edit_functions_menu(QMenu* parent);
/**
* @brief Sets the checked state of a menu item based on an integer variable.
*
* Many menu items simply set a variable to a particular integer. This is a convenience function, assuming the
* QAction's data variable is an integer to set a variable to, that sets the checked state of the QAction to
* whether the QAction's integer equals the integer variable. Used heavily in functions like
* viewMenu_About_To_Be_Shown()
*
* @param a
*
* The QAction to set the checked state of
*
* @param i
*
* The integer variable to compare the QAction's integer to
*/
void set_int_action_checked(QAction* a, const int& i);
/**
* @brief Sets the checked state of a menu item based on a Boolean variable.
*
* Many menu items simply toggle a Boolean variable. This is a convenience function, assuming the QAction's data
* variable is a pointer to a Boolean variable, that sets the checked state of the QAction to the enabled state
* of the Boolean. Used heavily in functions like toolMenu_About_To_Be_Shown()
*
* @param a
*
* The QAction to set the checked state of.
*/
void set_bool_action_checked(QAction* a);
/**
* @brief Sets the checked state of a menu item based on a QPushButton.
*
* Some menu items function largely as a proxy to a QPushButton. Assuming the QAction's data variable is a
* pointer to a QPushButton, this sets a QAction's checked state to the checked state of the QPushButton.
*
* @param a
*/
void set_button_action_checked(QAction* a);
/**
* @brief Sets the checked state of a menu item based on an integer variable.
*
* Many menu items simply set a variable to a particular integer. This is a convenience function, assuming the
* QAction's data variable is an integer to set a variable to, that sets the checked state of the QAction to
* whether the QAction's integer equals the integer variable. Used heavily in functions like
* viewMenu_About_To_Be_Shown()
*
* @param a
*
* The QAction to set the checked state of
*
* @param i
*
* The integer variable to compare the QAction's integer to
*/
void set_int_action_checked(QAction* a, const int& i);
/**
* @brief Sets the checked state of a menu item based on a QPushButton.
*
* Some menu items function largely as a proxy to a QPushButton. Assuming the QAction's data variable is a
* pointer to a QPushButton, this sets a QAction's checked state to the checked state of the QPushButton.
*
* @param a
*/
void set_button_action_checked(QAction* a);
void Retranslate();
static QMenu* create_submenu(QMenuBar* parent,
const QObject *receiver = nullptr,
const char *member = nullptr);
static QMenu* create_submenu(QMenu* parent);
static QAction* create_menu_action(QWidget *parent,
const char* id,
const QObject *receiver = nullptr,
const char *member = nullptr,
const QKeySequence &shortcut = 0);
public slots:
/**
* @brief Sets a QAction's Boolean reference to the opposite of its current value
*
* Many menu items simply toggle a Boolean variable. This is a convenience function, assuming the QAction's data
* variable is a pointer to a Boolean variable, that sets the Boolean variable to the opposite of its current value.
*/
void toggle_bool_action();
/**
* @brief Sets a QAction's Boolean reference to the opposite of its current value
*
* Many menu items simply toggle a Boolean variable. This is a convenience function, assuming the QAction's data
* variable is a pointer to a Boolean variable, that sets the Boolean variable to the opposite of its current value.
*/
void toggle_bool_action();
/**
* @brief Set Title/Action Safe Area from QAction
*
* A receiver for several Title/Action Safe Area setting items. Assumes the sender() is a QAction with a data
* variable as a `double`. The `double` can be the following values:
* * NaN (qSNaN()) - Disable Title/Action Safe Area
* * 0 - Enable Title/Action Safe Area, default aspect ratio (match current active Sequence's aspect ratio).
* * Negative Value - Enable Title/Action Safe Area, any negative number assumes a custom aspect ratio. Will ask
* the user to enter an aspect ratio and will use the result.
* * Positive Value - Enable Title/Action Safe Area, use value as the aspect ratio.
*/
void set_titlesafe_from_menu();
/**
* @brief Set Title/Action Safe Area from QAction
*
* A receiver for several Title/Action Safe Area setting items. Assumes the sender() is a QAction with a data
* variable as a `double`. The `double` can be the following values:
* * NaN (qSNaN()) - Disable Title/Action Safe Area
* * 0 - Enable Title/Action Safe Area, default aspect ratio (match current active Sequence's aspect ratio).
* * Negative Value - Enable Title/Action Safe Area, any negative number assumes a custom aspect ratio. Will ask
* the user to enter an aspect ratio and will use the result.
* * Positive Value - Enable Title/Action Safe Area, use value as the aspect ratio.
*/
void set_titlesafe_from_menu();
/**
* @brief Set Autoscroll setting from QAction
*
* Assumes the sender() is a QAction with an integer as its data variable. The data variable should be
* `AUTOSCROLL_NO_SCROLL`, `AUTOSCROLL_PAGE_SCROLL` (default) or `AUTOSCROLL_SMOOTH_SCROLL`.
*/
void set_autoscroll();
/**
* @brief Set Autoscroll setting from QAction
*
* Assumes the sender() is a QAction with an integer as its data variable. The data variable should be
* `AUTOSCROLL_NO_SCROLL`, `AUTOSCROLL_PAGE_SCROLL` (default) or `AUTOSCROLL_SMOOTH_SCROLL`.
*/
void set_autoscroll();
/**
* @brief Clicks a QPushButton referenced by a QAction when triggered.
*
* Some menu items function largely as a proxy to a QPushButton. Assuming the QAction's data variable is a
* pointer to a QPushButton, this triggers a click() event on that QPushButton.
*/
void menu_click_button();
/**
* @brief Clicks a QPushButton referenced by a QAction when triggered.
*
* Some menu items function largely as a proxy to a QPushButton. Assuming the QAction's data variable is a
* pointer to a QPushButton, this triggers a click() event on that QPushButton.
*/
void menu_click_button();
/**
* @brief Sets the current timecode setting
*
* Assumes the sender() is a QAction with an integer as its data variable. The data variable should be
* `AUTOSCROLL_NO_AUTOSCROLL`, `AUTOSCROLL_PAGE_AUTOSCROLL` (default) or `AUTOSCROLL_SMOOTH_AUTOSCROLL`.
*/
void set_timecode_view();
/**
* @brief Sets the current timecode setting
*
* Assumes the sender() is a QAction with an integer as its data variable. The data variable should be
* `AUTOSCROLL_NO_AUTOSCROLL`, `AUTOSCROLL_PAGE_AUTOSCROLL` (default) or `AUTOSCROLL_SMOOTH_AUTOSCROLL`.
*/
void set_timecode_view();
/**
* @brief Calls open_recent() in Olive::Global using the index from a QAction
*
* Assumes the sender() is a QAction with an integer as its data variable. The data variable is an index of
* the internal auto-recovery project list.
*/
void open_recent_from_menu();
/**
* @brief Calls open_recent() in Olive::Global using the index from a QAction
*
* Assumes the sender() is a QAction with an integer as its data variable. The data variable is an index of
* the internal auto-recovery project list.
*/
void open_recent_from_menu();
private:
QAction* new_project_;
QAction* new_sequence_;
QAction* new_folder_;
QAction* set_in_point_;
QAction* set_out_point_;
QAction* reset_in_point_;
QAction* reset_out_point_;
QAction* clear_inout_point;
QAction* add_default_transition_;
QAction* link_unlink_;
QAction* enable_disable_;
QAction* nest_;
QAction* cut_;
QAction* copy_;
QAction* paste_;
QAction* paste_insert_;
QAction* duplicate_;
QAction* delete_;
QAction* ripple_delete_;
QAction* split_;
private slots:
@@ -177,10 +216,10 @@ private slots:
};
namespace olive {
/**
/**
* @brief A global MenuHelper object to assist menu creation throughout Olive.
*/
extern MenuHelper MenuHelper;
extern MenuHelper MenuHelper;
}
#endif // MENUHELPER_H
-9
View File
@@ -1,9 +0,0 @@
#include "otreeview.h"
OTreeView::OTreeView(QWidget *parent) : QTreeView(parent) {
setSortingEnabled(true);
sortByColumn(0, Qt::AscendingOrder);
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&)));
}
-16
View File
@@ -1,16 +0,0 @@
#ifndef OTREEVIEW_H
#define OTREEVIEW_H
#include <QTreeView>
#include "ui/sourcetable.h"
class OTreeView : public QTreeView {
Q_OBJECT
public:
OTreeView(QWidget* parent = 0);
private:
};
#endif // OTREEVIEW_H
+11 -4
View File
@@ -21,6 +21,7 @@
#include "panel.h"
#include <QEvent>
#include <QDebug>
QVector<Panel*> olive::panels;
@@ -35,10 +36,16 @@ Panel::~Panel()
olive::panels.removeAll(this);
}
bool Panel::event(QEvent *e) {
void Panel::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
Retranslate();
return true;
// Retranslate();
} else {
QDockWidget::changeEvent(e);
}
return QDockWidget::event(e);
}
void Panel::Retranslate()
{
qDebug() << "like what?";
}
+2 -2
View File
@@ -28,9 +28,9 @@ class Panel : public QDockWidget {
public:
Panel(QWidget* parent = nullptr);
virtual ~Panel() override;
virtual bool event(QEvent* e) override;
virtual void Retranslate();
protected:
virtual void Retranslate() = 0;
virtual void changeEvent(QEvent* e) override;
};
namespace olive {