started translating without restarting
This commit is contained in:
+552
-541
File diff suppressed because it is too large
Load Diff
+46
-46
@@ -35,68 +35,68 @@
|
||||
#include <QSpinBox>
|
||||
|
||||
class KeySequenceEditor : public QKeySequenceEdit {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
KeySequenceEditor(QWidget *parent, QAction* a);
|
||||
void set_action_shortcut();
|
||||
void reset_to_default();
|
||||
QString action_name();
|
||||
QString export_shortcut();
|
||||
KeySequenceEditor(QWidget *parent, QAction* a);
|
||||
void set_action_shortcut();
|
||||
void reset_to_default();
|
||||
QString action_name();
|
||||
QString export_shortcut();
|
||||
private:
|
||||
QAction* action;
|
||||
QAction* action;
|
||||
};
|
||||
|
||||
class PreferencesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PreferencesDialog(QWidget *parent = nullptr);
|
||||
~PreferencesDialog();
|
||||
explicit PreferencesDialog(QWidget *parent = nullptr);
|
||||
~PreferencesDialog();
|
||||
|
||||
void setup_kbd_shortcuts(QMenuBar* menu);
|
||||
void setup_kbd_shortcuts(QMenuBar* menu);
|
||||
|
||||
private slots:
|
||||
void save();
|
||||
void reset_default_shortcut();
|
||||
void reset_all_shortcuts();
|
||||
bool refine_shortcut_list(const QString &, QTreeWidgetItem* parent = nullptr);
|
||||
void load_shortcut_file();
|
||||
void save_shortcut_file();
|
||||
void browse_css_file();
|
||||
void delete_all_previews();
|
||||
void save();
|
||||
void reset_default_shortcut();
|
||||
void reset_all_shortcuts();
|
||||
bool refine_shortcut_list(const QString &, QTreeWidgetItem* parent = nullptr);
|
||||
void load_shortcut_file();
|
||||
void save_shortcut_file();
|
||||
void browse_css_file();
|
||||
void delete_all_previews();
|
||||
|
||||
private:
|
||||
void setup_ui();
|
||||
void setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem* parent);
|
||||
void setup_ui();
|
||||
void setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem* parent);
|
||||
|
||||
// used to delete previews
|
||||
// type can be: 't' for thumbnails, 'w' for waveforms, or 1 for all
|
||||
void delete_previews(char type);
|
||||
// used to delete previews
|
||||
// type can be: 't' for thumbnails, 'w' for waveforms, or 1 for all
|
||||
void delete_previews(char type);
|
||||
|
||||
QLineEdit* custom_css_fn;
|
||||
QLineEdit* imgSeqFormatEdit;
|
||||
QComboBox* recordingComboBox;
|
||||
QRadioButton* accurateSeekButton;
|
||||
QRadioButton* fastSeekButton;
|
||||
QTreeWidget* keyboard_tree;
|
||||
QDoubleSpinBox* upcoming_queue_spinbox;
|
||||
QComboBox* upcoming_queue_type;
|
||||
QDoubleSpinBox* previous_queue_spinbox;
|
||||
QComboBox* previous_queue_type;
|
||||
QSpinBox* effect_textbox_lines_field;
|
||||
QCheckBox* use_software_fallbacks_checkbox;
|
||||
QComboBox* audio_output_devices;
|
||||
QComboBox* audio_input_devices;
|
||||
QComboBox* audio_sample_rate;
|
||||
QComboBox* language_combobox;
|
||||
QSpinBox* thumbnail_res_spinbox;
|
||||
QSpinBox* waveform_res_spinbox;
|
||||
QCheckBox* add_default_effects_to_clips;
|
||||
QLineEdit* custom_css_fn;
|
||||
QLineEdit* imgSeqFormatEdit;
|
||||
QComboBox* recordingComboBox;
|
||||
QRadioButton* accurateSeekButton;
|
||||
QRadioButton* fastSeekButton;
|
||||
QTreeWidget* keyboard_tree;
|
||||
QDoubleSpinBox* upcoming_queue_spinbox;
|
||||
QComboBox* upcoming_queue_type;
|
||||
QDoubleSpinBox* previous_queue_spinbox;
|
||||
QComboBox* previous_queue_type;
|
||||
QSpinBox* effect_textbox_lines_field;
|
||||
QCheckBox* use_software_fallbacks_checkbox;
|
||||
QComboBox* audio_output_devices;
|
||||
QComboBox* audio_input_devices;
|
||||
QComboBox* audio_sample_rate;
|
||||
QComboBox* language_combobox;
|
||||
QSpinBox* thumbnail_res_spinbox;
|
||||
QSpinBox* waveform_res_spinbox;
|
||||
QCheckBox* add_default_effects_to_clips;
|
||||
|
||||
QVector<QAction*> key_shortcut_actions;
|
||||
QVector<QTreeWidgetItem*> key_shortcut_items;
|
||||
QVector<KeySequenceEditor*> key_shortcut_fields;
|
||||
QVector<QAction*> key_shortcut_actions;
|
||||
QVector<QTreeWidgetItem*> key_shortcut_items;
|
||||
QVector<KeySequenceEditor*> key_shortcut_fields;
|
||||
};
|
||||
|
||||
#endif // PREFERENCESDIALOG_H
|
||||
|
||||
+703
-719
File diff suppressed because it is too large
Load Diff
@@ -150,7 +150,8 @@ SOURCES += \
|
||||
oliveglobal.cpp \
|
||||
ui/focusfilter.cpp \
|
||||
project/comboaction.cpp \
|
||||
ui/mediaiconservice.cpp
|
||||
ui/mediaiconservice.cpp \
|
||||
ui/panel.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h \
|
||||
@@ -258,7 +259,8 @@ HEADERS += \
|
||||
project/projectelements.h \
|
||||
ui/focusfilter.h \
|
||||
project/comboaction.h \
|
||||
ui/mediaiconservice.h
|
||||
ui/mediaiconservice.h \
|
||||
ui/panel.h
|
||||
|
||||
FORMS +=
|
||||
|
||||
|
||||
+29
-1
@@ -25,6 +25,7 @@
|
||||
#include "panels/panels.h"
|
||||
|
||||
#include "io/path.h"
|
||||
#include "io/config.h"
|
||||
|
||||
#include "playback/audio.h"
|
||||
|
||||
@@ -41,6 +42,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
|
||||
std::unique_ptr<OliveGlobal> olive::Global;
|
||||
@@ -60,6 +62,9 @@ OliveGlobal::OliveGlobal() {
|
||||
|
||||
// set default value
|
||||
enable_load_project_on_init = false;
|
||||
|
||||
// alloc QTranslator
|
||||
translator = std::unique_ptr<QTranslator>(new QTranslator());
|
||||
}
|
||||
|
||||
const QString &OliveGlobal::get_project_file_filter() {
|
||||
@@ -106,7 +111,30 @@ void OliveGlobal::load_project_on_launch(const QString& s) {
|
||||
}
|
||||
|
||||
QString OliveGlobal::get_recent_project_list_file() {
|
||||
return get_data_dir().filePath("recents");
|
||||
return get_data_dir().filePath("recents");
|
||||
}
|
||||
|
||||
void OliveGlobal::load_translation_from_config() {
|
||||
QString language_file = olive::CurrentRuntimeConfig.external_translation_file.isEmpty() ?
|
||||
olive::CurrentConfig.language_file :
|
||||
olive::CurrentRuntimeConfig.external_translation_file;
|
||||
|
||||
if (!language_file.isEmpty()) {
|
||||
|
||||
// translation files are stored relative to app path (see GitHub issue #454)
|
||||
QString full_language_path = QDir(get_app_path()).filePath(language_file);
|
||||
|
||||
// remove translation
|
||||
QApplication::removeTranslator(translator.get());
|
||||
|
||||
// load translation file
|
||||
if (QFileInfo::exists(full_language_path)
|
||||
&& translator->load(full_language_path)) {
|
||||
QApplication::installTranslator(translator.get());
|
||||
} else {
|
||||
qWarning() << "Failed to load translation file" << full_language_path << ". No language will be loaded.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OliveGlobal::new_project() {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <QTimer>
|
||||
#include <QFile>
|
||||
#include <QTranslator>
|
||||
|
||||
/**
|
||||
* @brief The Olive Global class
|
||||
@@ -108,6 +109,11 @@ public:
|
||||
*/
|
||||
QString get_recent_project_list_file();
|
||||
|
||||
/**
|
||||
* @brief (Re)load translation file from olive::config
|
||||
*/
|
||||
void load_translation_from_config();
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Undo user's last action
|
||||
@@ -290,6 +296,11 @@ private:
|
||||
*/
|
||||
bool enable_load_project_on_init;
|
||||
|
||||
/**
|
||||
* @brief Internal translator object that interfaces with the currently loaded language file
|
||||
*/
|
||||
std::unique_ptr<QTranslator> translator;
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
+33
-19
@@ -52,15 +52,13 @@
|
||||
#include "debug.h"
|
||||
|
||||
EffectControls::EffectControls(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
Panel(parent),
|
||||
multiple(false),
|
||||
zoom(1),
|
||||
panel_name(tr("Effects: ")),
|
||||
mode(kTransitionNone)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
setup_ui();
|
||||
Retranslate();
|
||||
|
||||
clear_effects(false);
|
||||
headers->viewer = panel_sequence_viewer;
|
||||
@@ -277,7 +275,7 @@ void EffectControls::clear_effects(bool clear_cache) {
|
||||
headers->setVisible(false);
|
||||
keyframeView->setEnabled(false);
|
||||
if (clear_cache) selected_clips.clear();
|
||||
setWindowTitle(panel_name + "(none)");
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
void EffectControls::deselect_all_effects(QWidget* sender) {
|
||||
@@ -298,6 +296,14 @@ void EffectControls::open_effect(QVBoxLayout* layout, EffectPtr e) {
|
||||
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
}
|
||||
|
||||
void EffectControls::UpdateTitle() {
|
||||
if (selected_clips.empty()) {
|
||||
setWindowTitle(panel_name + tr("(none)"));
|
||||
} else {
|
||||
setWindowTitle(panel_name + olive::ActiveSequence->clips.at(selected_clips.at(0))->name);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectControls::setup_ui() {
|
||||
QWidget* contents = new QWidget(this);
|
||||
|
||||
@@ -344,27 +350,24 @@ void EffectControls::setup_ui() {
|
||||
veHeaderLayout->setSpacing(0);
|
||||
veHeaderLayout->setMargin(0);
|
||||
|
||||
QPushButton* btnAddVideoEffect = new QPushButton();
|
||||
btnAddVideoEffect = new QPushButton();
|
||||
btnAddVideoEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||
btnAddVideoEffect->setToolTip(tr("Add Video Effect"));
|
||||
veHeaderLayout->addWidget(btnAddVideoEffect);
|
||||
connect(btnAddVideoEffect, SIGNAL(clicked(bool)), this, SLOT(video_effect_click()));
|
||||
|
||||
veHeaderLayout->addStretch();
|
||||
|
||||
QLabel* lblVideoEffects = new QLabel();
|
||||
lblVideoEffects = new QLabel();
|
||||
QFont font;
|
||||
font.setPointSize(9);
|
||||
lblVideoEffects->setFont(font);
|
||||
lblVideoEffects->setAlignment(Qt::AlignCenter);
|
||||
lblVideoEffects->setText(tr("VIDEO EFFECTS"));
|
||||
veHeaderLayout->addWidget(lblVideoEffects);
|
||||
|
||||
veHeaderLayout->addStretch();
|
||||
|
||||
QPushButton* btnAddVideoTransition = new QPushButton();
|
||||
btnAddVideoTransition = new QPushButton();
|
||||
btnAddVideoTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||
btnAddVideoTransition->setToolTip(tr("Add Video Transition"));
|
||||
connect(btnAddVideoTransition, SIGNAL(clicked(bool)), this, SLOT(video_transition_click()));
|
||||
veHeaderLayout->addWidget(btnAddVideoTransition);
|
||||
|
||||
@@ -391,25 +394,22 @@ void EffectControls::setup_ui() {
|
||||
aeHeaderLayout->setSpacing(0);
|
||||
aeHeaderLayout->setMargin(0);
|
||||
|
||||
QPushButton* btnAddAudioEffect = new QPushButton();
|
||||
btnAddAudioEffect = new QPushButton();
|
||||
btnAddAudioEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||
btnAddAudioEffect->setToolTip(tr("Add Audio Effect"));
|
||||
connect(btnAddAudioEffect, SIGNAL(clicked(bool)), this, SLOT(audio_effect_click()));
|
||||
aeHeaderLayout->addWidget(btnAddAudioEffect);
|
||||
|
||||
aeHeaderLayout->addStretch();
|
||||
|
||||
QLabel* lblAudioEffects = new QLabel();
|
||||
lblAudioEffects = new QLabel();
|
||||
lblAudioEffects->setFont(font);
|
||||
lblAudioEffects->setAlignment(Qt::AlignCenter);
|
||||
lblAudioEffects->setText(tr("AUDIO EFFECTS"));
|
||||
aeHeaderLayout->addWidget(lblAudioEffects);
|
||||
|
||||
aeHeaderLayout->addStretch();
|
||||
|
||||
QPushButton* btnAddAudioTransition = new QPushButton();
|
||||
btnAddAudioTransition = new QPushButton();
|
||||
btnAddAudioTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||
btnAddAudioTransition->setToolTip(tr("Add Audio Transition"));
|
||||
connect(btnAddAudioTransition, SIGNAL(clicked(bool)), this, SLOT(audio_transition_click()));
|
||||
aeHeaderLayout->addWidget(btnAddAudioTransition);
|
||||
|
||||
@@ -426,7 +426,6 @@ void EffectControls::setup_ui() {
|
||||
|
||||
lblMultipleClipsSelected = new QLabel();
|
||||
lblMultipleClipsSelected->setAlignment(Qt::AlignCenter);
|
||||
lblMultipleClipsSelected->setText(tr("(Multiple clips selected)"));
|
||||
effects_area_layout->addWidget(lblMultipleClipsSelected);
|
||||
|
||||
effects_area_layout->addStretch();
|
||||
@@ -481,6 +480,20 @@ void EffectControls::setup_ui() {
|
||||
setWidget(contents);
|
||||
}
|
||||
|
||||
void EffectControls::Retranslate() {
|
||||
panel_name = tr("Effects: ");
|
||||
|
||||
btnAddVideoEffect->setToolTip(tr("Add Video Effect"));
|
||||
lblVideoEffects->setText(tr("VIDEO EFFECTS"));
|
||||
btnAddVideoTransition->setToolTip(tr("Add Video Transition"));
|
||||
btnAddAudioEffect->setToolTip(tr("Add Audio Effect"));
|
||||
lblAudioEffects->setText(tr("AUDIO EFFECTS"));
|
||||
btnAddAudioTransition->setToolTip(tr("Add Audio Transition"));
|
||||
lblMultipleClipsSelected->setText(tr("(Multiple clips selected)"));
|
||||
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
void EffectControls::update_scrollbar() {
|
||||
verticalScrollBar->setMaximum(qMax(0, effects_area->height() - keyframeView->height() - headers->height()));
|
||||
verticalScrollBar->setPageStep(verticalScrollBar->height());
|
||||
@@ -525,13 +538,14 @@ void EffectControls::load_effects() {
|
||||
}
|
||||
}
|
||||
if (selected_clips.size() > 0) {
|
||||
setWindowTitle(panel_name + olive::ActiveSequence->clips.at(selected_clips.at(0))->name);
|
||||
keyframeView->setEnabled(true);
|
||||
headers->setVisible(true);
|
||||
|
||||
QTimer::singleShot(50, this, SLOT(queue_post_update()));
|
||||
}
|
||||
}
|
||||
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
void EffectControls::delete_effects() {
|
||||
|
||||
+67
-59
@@ -21,7 +21,6 @@
|
||||
#ifndef EFFECTCONTROLS_H
|
||||
#define EFFECTCONTROLS_H
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QUndoCommand>
|
||||
#include <QMutex>
|
||||
#include <QMenu>
|
||||
@@ -36,88 +35,97 @@
|
||||
#include "ui/keyframeview.h"
|
||||
#include "ui/resizablescrollbar.h"
|
||||
#include "ui/keyframeview.h"
|
||||
#include "ui/panel.h"
|
||||
|
||||
class EffectsArea : public QWidget {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
EffectsArea(QWidget* parent = 0);
|
||||
QScrollArea* parent_widget;
|
||||
KeyframeView* keyframe_area;
|
||||
TimelineHeader* header;
|
||||
EffectsArea(QWidget* parent = 0);
|
||||
QScrollArea* parent_widget;
|
||||
KeyframeView* keyframe_area;
|
||||
TimelineHeader* header;
|
||||
public slots:
|
||||
void receive_wheel_event(QWheelEvent* e);
|
||||
void receive_wheel_event(QWheelEvent* e);
|
||||
};
|
||||
|
||||
class EffectControls : public QDockWidget
|
||||
class EffectControls : public Panel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EffectControls(QWidget *parent = 0);
|
||||
~EffectControls();
|
||||
int get_mode();
|
||||
void set_clips(QVector<int>& clips, int mode);
|
||||
void clear_effects(bool clear_cache);
|
||||
void delete_effects();
|
||||
bool is_focused();
|
||||
void reload_clips();
|
||||
void set_zoom(bool in);
|
||||
bool keyframe_focus();
|
||||
void delete_selected_keyframes();
|
||||
bool multiple;
|
||||
void scroll_to_frame(long frame);
|
||||
explicit EffectControls(QWidget *parent = 0);
|
||||
~EffectControls();
|
||||
int get_mode();
|
||||
void set_clips(QVector<int>& clips, int mode);
|
||||
void clear_effects(bool clear_cache);
|
||||
void delete_effects();
|
||||
bool is_focused();
|
||||
void reload_clips();
|
||||
void set_zoom(bool in);
|
||||
bool keyframe_focus();
|
||||
void delete_selected_keyframes();
|
||||
bool multiple;
|
||||
void scroll_to_frame(long frame);
|
||||
|
||||
QVector<int> selected_clips;
|
||||
QVector<int> selected_clips;
|
||||
|
||||
double zoom;
|
||||
double zoom;
|
||||
|
||||
ResizableScrollBar* horizontalScrollBar;
|
||||
QScrollBar* verticalScrollBar;
|
||||
ResizableScrollBar* horizontalScrollBar;
|
||||
QScrollBar* verticalScrollBar;
|
||||
|
||||
QMutex effects_loaded;
|
||||
QMutex effects_loaded;
|
||||
|
||||
void add_effect_paste_action(QMenu* menu);
|
||||
void add_effect_paste_action(QMenu* menu);
|
||||
public slots:
|
||||
void cut();
|
||||
void copy(bool del = false);
|
||||
void update_keyframes();
|
||||
void cut();
|
||||
void copy(bool del = false);
|
||||
void update_keyframes();
|
||||
private slots:
|
||||
void menu_select(QAction* q);
|
||||
void menu_select(QAction* q);
|
||||
|
||||
void video_effect_click();
|
||||
void audio_effect_click();
|
||||
void video_transition_click();
|
||||
void audio_transition_click();
|
||||
void video_effect_click();
|
||||
void audio_effect_click();
|
||||
void video_transition_click();
|
||||
void audio_transition_click();
|
||||
|
||||
void deselect_all_effects(QWidget*);
|
||||
void deselect_all_effects(QWidget*);
|
||||
|
||||
void update_scrollbar();
|
||||
void queue_post_update();
|
||||
void update_scrollbar();
|
||||
void queue_post_update();
|
||||
|
||||
void effects_area_context_menu();
|
||||
void effects_area_context_menu();
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
virtual void Retranslate() override;
|
||||
private:
|
||||
void show_effect_menu(int type, int subtype);
|
||||
void load_effects();
|
||||
void load_keyframes();
|
||||
void open_effect(QVBoxLayout* hlayout, EffectPtr e);
|
||||
void show_effect_menu(int type, int subtype);
|
||||
void load_effects();
|
||||
void load_keyframes();
|
||||
void open_effect(QVBoxLayout* hlayout, EffectPtr e);
|
||||
void UpdateTitle();
|
||||
|
||||
void setup_ui();
|
||||
void setup_ui();
|
||||
|
||||
int effect_menu_type;
|
||||
int effect_menu_subtype;
|
||||
QString panel_name;
|
||||
int mode;
|
||||
int effect_menu_type;
|
||||
int effect_menu_subtype;
|
||||
QString panel_name;
|
||||
int mode;
|
||||
|
||||
TimelineHeader* headers;
|
||||
EffectsArea* effects_area;
|
||||
QScrollArea* scrollArea;
|
||||
QLabel* lblMultipleClipsSelected;
|
||||
KeyframeView* keyframeView;
|
||||
QWidget* video_effect_area;
|
||||
QWidget* audio_effect_area;
|
||||
QWidget* vcontainer;
|
||||
QWidget* acontainer;
|
||||
QPushButton* btnAddVideoEffect;
|
||||
QLabel* lblVideoEffects;
|
||||
QPushButton* btnAddVideoTransition;
|
||||
QPushButton* btnAddAudioEffect;
|
||||
QPushButton* btnAddAudioTransition;
|
||||
QLabel* lblMultipleClipsSelected;
|
||||
QLabel* lblAudioEffects;
|
||||
TimelineHeader* headers;
|
||||
EffectsArea* effects_area;
|
||||
QScrollArea* scrollArea;
|
||||
KeyframeView* keyframeView;
|
||||
QWidget* video_effect_area;
|
||||
QWidget* audio_effect_area;
|
||||
QWidget* vcontainer;
|
||||
QWidget* acontainer;
|
||||
};
|
||||
|
||||
#endif // EFFECTCONTROLS_H
|
||||
|
||||
+167
-159
@@ -37,218 +37,226 @@
|
||||
#include "panels.h"
|
||||
#include "debug.h"
|
||||
|
||||
GraphEditor::GraphEditor(QWidget* parent) : QDockWidget(parent), row(nullptr) {
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
GraphEditor::GraphEditor(QWidget* parent) : Panel(parent), row(nullptr) {
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
setWindowTitle(tr("Graph Editor"));
|
||||
resize(720, 480);
|
||||
resize(720, 480);
|
||||
|
||||
QWidget* main_widget = new QWidget(this);
|
||||
QVBoxLayout* layout = new QVBoxLayout(main_widget);
|
||||
setWidget(main_widget);
|
||||
QWidget* main_widget = new QWidget(this);
|
||||
QVBoxLayout* layout = new QVBoxLayout(main_widget);
|
||||
setWidget(main_widget);
|
||||
|
||||
QWidget* tool_widget = new QWidget();
|
||||
tool_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
|
||||
QHBoxLayout* tools = new QHBoxLayout(tool_widget);
|
||||
QWidget* tool_widget = new QWidget();
|
||||
tool_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
|
||||
QHBoxLayout* tools = new QHBoxLayout(tool_widget);
|
||||
|
||||
QWidget* left_tool_widget = new QWidget();
|
||||
QHBoxLayout* left_tool_layout = new QHBoxLayout(left_tool_widget);
|
||||
left_tool_layout->setSpacing(0);
|
||||
left_tool_layout->setMargin(0);
|
||||
tools->addWidget(left_tool_widget);
|
||||
QWidget* center_tool_widget = new QWidget();
|
||||
QHBoxLayout* center_tool_layout = new QHBoxLayout(center_tool_widget);
|
||||
center_tool_layout->setSpacing(0);
|
||||
center_tool_layout->setMargin(0);
|
||||
tools->addWidget(center_tool_widget);
|
||||
QWidget* right_tool_widget = new QWidget();
|
||||
QHBoxLayout* right_tool_layout = new QHBoxLayout(right_tool_widget);
|
||||
right_tool_layout->setSpacing(0);
|
||||
right_tool_layout->setMargin(0);
|
||||
tools->addWidget(right_tool_widget);
|
||||
QWidget* left_tool_widget = new QWidget();
|
||||
QHBoxLayout* left_tool_layout = new QHBoxLayout(left_tool_widget);
|
||||
left_tool_layout->setSpacing(0);
|
||||
left_tool_layout->setMargin(0);
|
||||
tools->addWidget(left_tool_widget);
|
||||
QWidget* center_tool_widget = new QWidget();
|
||||
QHBoxLayout* center_tool_layout = new QHBoxLayout(center_tool_widget);
|
||||
center_tool_layout->setSpacing(0);
|
||||
center_tool_layout->setMargin(0);
|
||||
tools->addWidget(center_tool_widget);
|
||||
QWidget* right_tool_widget = new QWidget();
|
||||
QHBoxLayout* right_tool_layout = new QHBoxLayout(right_tool_widget);
|
||||
right_tool_layout->setSpacing(0);
|
||||
right_tool_layout->setMargin(0);
|
||||
tools->addWidget(right_tool_widget);
|
||||
|
||||
keyframe_nav = new KeyframeNavigator(nullptr, false);
|
||||
keyframe_nav->enable_keyframes(true);
|
||||
keyframe_nav->enable_keyframe_toggle(false);
|
||||
left_tool_layout->addWidget(keyframe_nav);
|
||||
left_tool_layout->addStretch();
|
||||
keyframe_nav = new KeyframeNavigator(nullptr, false);
|
||||
keyframe_nav->enable_keyframes(true);
|
||||
keyframe_nav->enable_keyframe_toggle(false);
|
||||
left_tool_layout->addWidget(keyframe_nav);
|
||||
left_tool_layout->addStretch();
|
||||
|
||||
linear_button = new QPushButton(tr("Linear"));
|
||||
linear_button->setProperty("type", EFFECT_KEYFRAME_LINEAR);
|
||||
linear_button->setCheckable(true);
|
||||
bezier_button = new QPushButton(tr("Bezier"));
|
||||
bezier_button->setProperty("type", EFFECT_KEYFRAME_BEZIER);
|
||||
bezier_button->setCheckable(true);
|
||||
hold_button = new QPushButton(tr("Hold"));
|
||||
hold_button->setProperty("type", EFFECT_KEYFRAME_HOLD);
|
||||
hold_button->setCheckable(true);
|
||||
linear_button = new QPushButton();
|
||||
linear_button->setProperty("type", EFFECT_KEYFRAME_LINEAR);
|
||||
linear_button->setCheckable(true);
|
||||
bezier_button = new QPushButton();
|
||||
bezier_button->setProperty("type", EFFECT_KEYFRAME_BEZIER);
|
||||
bezier_button->setCheckable(true);
|
||||
hold_button = new QPushButton();
|
||||
hold_button->setProperty("type", EFFECT_KEYFRAME_HOLD);
|
||||
hold_button->setCheckable(true);
|
||||
|
||||
center_tool_layout->addStretch();
|
||||
center_tool_layout->addWidget(linear_button);
|
||||
center_tool_layout->addWidget(bezier_button);
|
||||
center_tool_layout->addWidget(hold_button);
|
||||
center_tool_layout->addStretch();
|
||||
center_tool_layout->addWidget(linear_button);
|
||||
center_tool_layout->addWidget(bezier_button);
|
||||
center_tool_layout->addWidget(hold_button);
|
||||
|
||||
layout->addWidget(tool_widget);
|
||||
layout->addWidget(tool_widget);
|
||||
|
||||
QWidget* central_widget = new QWidget();
|
||||
QVBoxLayout* central_layout = new QVBoxLayout(central_widget);
|
||||
central_layout->setSpacing(0);
|
||||
central_layout->setMargin(0);
|
||||
header = new TimelineHeader();
|
||||
header->viewer = panel_sequence_viewer;
|
||||
central_layout->addWidget(header);
|
||||
view = new GraphView();
|
||||
central_layout->addWidget(view);
|
||||
QWidget* central_widget = new QWidget();
|
||||
QVBoxLayout* central_layout = new QVBoxLayout(central_widget);
|
||||
central_layout->setSpacing(0);
|
||||
central_layout->setMargin(0);
|
||||
header = new TimelineHeader();
|
||||
header->viewer = panel_sequence_viewer;
|
||||
central_layout->addWidget(header);
|
||||
view = new GraphView();
|
||||
central_layout->addWidget(view);
|
||||
|
||||
layout->addWidget(central_widget);
|
||||
layout->addWidget(central_widget);
|
||||
|
||||
QWidget* value_widget = new QWidget();
|
||||
value_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
|
||||
QHBoxLayout* values = new QHBoxLayout(value_widget);
|
||||
values->addStretch();
|
||||
QWidget* value_widget = new QWidget();
|
||||
value_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
|
||||
QHBoxLayout* values = new QHBoxLayout(value_widget);
|
||||
values->addStretch();
|
||||
|
||||
QWidget* central_value_widget = new QWidget();
|
||||
value_layout = new QHBoxLayout(central_value_widget);
|
||||
value_layout->setMargin(0);
|
||||
value_layout->addWidget(new QLabel("")); // a spacer so the layout doesn't jump
|
||||
values->addWidget(central_value_widget);
|
||||
QWidget* central_value_widget = new QWidget();
|
||||
value_layout = new QHBoxLayout(central_value_widget);
|
||||
value_layout->setMargin(0);
|
||||
value_layout->addWidget(new QLabel("")); // a spacer so the layout doesn't jump
|
||||
values->addWidget(central_value_widget);
|
||||
|
||||
values->addStretch();
|
||||
layout->addWidget(value_widget);
|
||||
values->addStretch();
|
||||
layout->addWidget(value_widget);
|
||||
|
||||
current_row_desc = new QLabel();
|
||||
current_row_desc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
|
||||
current_row_desc->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(current_row_desc);
|
||||
current_row_desc = new QLabel();
|
||||
current_row_desc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
|
||||
current_row_desc->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(current_row_desc);
|
||||
|
||||
connect(view, SIGNAL(zoom_changed(double, double)), header, SLOT(update_zoom(double)));
|
||||
connect(view, SIGNAL(x_scroll_changed(int)), header, SLOT(set_scroll(int)));
|
||||
connect(view, SIGNAL(selection_changed(bool, int)), this, SLOT(set_key_button_enabled(bool, int)));
|
||||
connect(view, SIGNAL(zoom_changed(double, double)), header, SLOT(update_zoom(double)));
|
||||
connect(view, SIGNAL(x_scroll_changed(int)), header, SLOT(set_scroll(int)));
|
||||
connect(view, SIGNAL(selection_changed(bool, int)), this, SLOT(set_key_button_enabled(bool, int)));
|
||||
|
||||
connect(linear_button, SIGNAL(clicked(bool)), this, SLOT(set_keyframe_type()));
|
||||
connect(bezier_button, SIGNAL(clicked(bool)), this, SLOT(set_keyframe_type()));
|
||||
connect(hold_button, SIGNAL(clicked(bool)), this, SLOT(set_keyframe_type()));
|
||||
connect(linear_button, SIGNAL(clicked(bool)), this, SLOT(set_keyframe_type()));
|
||||
connect(bezier_button, SIGNAL(clicked(bool)), this, SLOT(set_keyframe_type()));
|
||||
connect(hold_button, SIGNAL(clicked(bool)), this, SLOT(set_keyframe_type()));
|
||||
|
||||
Retranslate();
|
||||
}
|
||||
|
||||
void GraphEditor::Retranslate() {
|
||||
setWindowTitle(tr("Graph Editor"));
|
||||
linear_button->setText(tr("Linear"));
|
||||
bezier_button->setText(tr("Bezier"));
|
||||
hold_button->setText(tr("Hold"));
|
||||
}
|
||||
|
||||
void GraphEditor::update_panel() {
|
||||
if (isVisible()) {
|
||||
if (row != nullptr) {
|
||||
int slider_index = 0;
|
||||
for (int i=0;i<row->fieldCount();i++) {
|
||||
EffectField* field = row->field(i);
|
||||
if (field->type == EFFECT_FIELD_DOUBLE) {
|
||||
slider_proxies.at(slider_index)->set_value(row->field(i)->get_current_data().toDouble(), false);
|
||||
slider_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isVisible()) {
|
||||
if (row != nullptr) {
|
||||
int slider_index = 0;
|
||||
for (int i=0;i<row->fieldCount();i++) {
|
||||
EffectField* field = row->field(i);
|
||||
if (field->type == EFFECT_FIELD_DOUBLE) {
|
||||
slider_proxies.at(slider_index)->set_value(row->field(i)->get_current_data().toDouble(), false);
|
||||
slider_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header->update();
|
||||
view->update();
|
||||
}
|
||||
header->update();
|
||||
view->update();
|
||||
}
|
||||
}
|
||||
|
||||
void GraphEditor::set_row(EffectRow *r) {
|
||||
for (int i=0;i<slider_proxies.size();i++) {
|
||||
delete slider_proxies.at(i);
|
||||
delete slider_proxy_buttons.at(i);
|
||||
}
|
||||
slider_proxies.clear();
|
||||
slider_proxy_buttons.clear();
|
||||
slider_proxy_sources.clear();
|
||||
for (int i=0;i<slider_proxies.size();i++) {
|
||||
delete slider_proxies.at(i);
|
||||
delete slider_proxy_buttons.at(i);
|
||||
}
|
||||
slider_proxies.clear();
|
||||
slider_proxy_buttons.clear();
|
||||
slider_proxy_sources.clear();
|
||||
|
||||
if (row != nullptr) {
|
||||
// clear old row connections
|
||||
disconnect(keyframe_nav, SIGNAL(goto_previous_key()), row, SLOT(goto_previous_key()));
|
||||
disconnect(keyframe_nav, SIGNAL(toggle_key()), row, SLOT(toggle_key()));
|
||||
disconnect(keyframe_nav, SIGNAL(goto_next_key()), row, SLOT(goto_next_key()));
|
||||
}
|
||||
if (row != nullptr) {
|
||||
// clear old row connections
|
||||
disconnect(keyframe_nav, SIGNAL(goto_previous_key()), row, SLOT(goto_previous_key()));
|
||||
disconnect(keyframe_nav, SIGNAL(toggle_key()), row, SLOT(toggle_key()));
|
||||
disconnect(keyframe_nav, SIGNAL(goto_next_key()), row, SLOT(goto_next_key()));
|
||||
}
|
||||
|
||||
bool found_vals = false;
|
||||
bool found_vals = false;
|
||||
|
||||
if (r != nullptr && r->isKeyframing()) {
|
||||
for (int i=0;i<r->fieldCount();i++) {
|
||||
EffectField* field = r->field(i);
|
||||
if (field->type == EFFECT_FIELD_DOUBLE) {
|
||||
QPushButton* slider_button = new QPushButton();
|
||||
slider_button->setCheckable(true);
|
||||
slider_button->setChecked(field->is_enabled());
|
||||
slider_button->setIcon(QIcon(":/icons/record.png"));
|
||||
slider_button->setProperty("field", i);
|
||||
slider_button->setIconSize(slider_button->iconSize()*0.5);
|
||||
connect(slider_button, SIGNAL(toggled(bool)), this, SLOT(set_field_visibility(bool)));
|
||||
slider_proxy_buttons.append(slider_button);
|
||||
value_layout->addWidget(slider_button);
|
||||
if (r != nullptr && r->isKeyframing()) {
|
||||
for (int i=0;i<r->fieldCount();i++) {
|
||||
EffectField* field = r->field(i);
|
||||
if (field->type == EFFECT_FIELD_DOUBLE) {
|
||||
QPushButton* slider_button = new QPushButton();
|
||||
slider_button->setCheckable(true);
|
||||
slider_button->setChecked(field->is_enabled());
|
||||
slider_button->setIcon(QIcon(":/icons/record.png"));
|
||||
slider_button->setProperty("field", i);
|
||||
slider_button->setIconSize(slider_button->iconSize()*0.5);
|
||||
connect(slider_button, SIGNAL(toggled(bool)), this, SLOT(set_field_visibility(bool)));
|
||||
slider_proxy_buttons.append(slider_button);
|
||||
value_layout->addWidget(slider_button);
|
||||
|
||||
LabelSlider* slider = new LabelSlider();
|
||||
slider->set_color(get_curve_color(i, r->fieldCount()).name());
|
||||
connect(slider, SIGNAL(valueChanged()), this, SLOT(passthrough_slider_value()));
|
||||
slider_proxies.append(slider);
|
||||
value_layout->addWidget(slider);
|
||||
LabelSlider* slider = new LabelSlider();
|
||||
slider->set_color(get_curve_color(i, r->fieldCount()).name());
|
||||
connect(slider, SIGNAL(valueChanged()), this, SLOT(passthrough_slider_value()));
|
||||
slider_proxies.append(slider);
|
||||
value_layout->addWidget(slider);
|
||||
|
||||
slider_proxy_sources.append(static_cast<LabelSlider*>(field->ui_element));
|
||||
slider_proxy_sources.append(static_cast<LabelSlider*>(field->ui_element));
|
||||
|
||||
found_vals = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
found_vals = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found_vals) {
|
||||
row = r;
|
||||
current_row_desc->setText(row->parent_effect->parent_clip->name + " :: " + row->parent_effect->meta->name + " :: " + row->get_name());
|
||||
header->set_visible_in(r->parent_effect->parent_clip->timeline_in);
|
||||
if (found_vals) {
|
||||
row = r;
|
||||
current_row_desc->setText(row->parent_effect->parent_clip->name + " :: " + row->parent_effect->meta->name + " :: " + row->get_name());
|
||||
header->set_visible_in(r->parent_effect->parent_clip->timeline_in);
|
||||
|
||||
connect(keyframe_nav, SIGNAL(goto_previous_key()), row, SLOT(goto_previous_key()));
|
||||
connect(keyframe_nav, SIGNAL(toggle_key()), row, SLOT(toggle_key()));
|
||||
connect(keyframe_nav, SIGNAL(goto_next_key()), row, SLOT(goto_next_key()));
|
||||
} else {
|
||||
row = nullptr;
|
||||
current_row_desc->setText(nullptr);
|
||||
}
|
||||
view->set_row(row);
|
||||
update_panel();
|
||||
connect(keyframe_nav, SIGNAL(goto_previous_key()), row, SLOT(goto_previous_key()));
|
||||
connect(keyframe_nav, SIGNAL(toggle_key()), row, SLOT(toggle_key()));
|
||||
connect(keyframe_nav, SIGNAL(goto_next_key()), row, SLOT(goto_next_key()));
|
||||
} else {
|
||||
row = nullptr;
|
||||
current_row_desc->setText(nullptr);
|
||||
}
|
||||
view->set_row(row);
|
||||
update_panel();
|
||||
}
|
||||
|
||||
bool GraphEditor::view_is_focused() {
|
||||
return view->hasFocus() || header->hasFocus();
|
||||
return view->hasFocus() || header->hasFocus();
|
||||
}
|
||||
|
||||
bool GraphEditor::view_is_under_mouse() {
|
||||
return view->underMouse() || header->underMouse();
|
||||
return view->underMouse() || header->underMouse();
|
||||
}
|
||||
|
||||
void GraphEditor::delete_selected_keys() {
|
||||
view->delete_selected_keys();
|
||||
view->delete_selected_keys();
|
||||
}
|
||||
|
||||
void GraphEditor::select_all() {
|
||||
view->select_all();
|
||||
view->select_all();
|
||||
}
|
||||
|
||||
void GraphEditor::set_key_button_enabled(bool e, int type) {
|
||||
linear_button->setEnabled(e);
|
||||
linear_button->setChecked(type == EFFECT_KEYFRAME_LINEAR);
|
||||
bezier_button->setEnabled(e);
|
||||
bezier_button->setChecked(type == EFFECT_KEYFRAME_BEZIER);
|
||||
hold_button->setEnabled(e);
|
||||
hold_button->setChecked(type == EFFECT_KEYFRAME_HOLD);
|
||||
linear_button->setEnabled(e);
|
||||
linear_button->setChecked(type == EFFECT_KEYFRAME_LINEAR);
|
||||
bezier_button->setEnabled(e);
|
||||
bezier_button->setChecked(type == EFFECT_KEYFRAME_BEZIER);
|
||||
hold_button->setEnabled(e);
|
||||
hold_button->setChecked(type == EFFECT_KEYFRAME_HOLD);
|
||||
}
|
||||
|
||||
void GraphEditor::passthrough_slider_value() {
|
||||
for (int i=0;i<slider_proxies.size();i++) {
|
||||
if (slider_proxies.at(i) == sender()) {
|
||||
slider_proxy_sources.at(i)->set_value(slider_proxies.at(i)->value(), true);
|
||||
}
|
||||
}
|
||||
for (int i=0;i<slider_proxies.size();i++) {
|
||||
if (slider_proxies.at(i) == sender()) {
|
||||
slider_proxy_sources.at(i)->set_value(slider_proxies.at(i)->value(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GraphEditor::set_keyframe_type() {
|
||||
linear_button->setChecked(linear_button == sender());
|
||||
bezier_button->setChecked(bezier_button == sender());
|
||||
hold_button->setChecked(hold_button == sender());
|
||||
view->set_selected_keyframe_type(sender()->property("type").toInt());
|
||||
linear_button->setChecked(linear_button == sender());
|
||||
bezier_button->setChecked(bezier_button == sender());
|
||||
hold_button->setChecked(hold_button == sender());
|
||||
view->set_selected_keyframe_type(sender()->property("type").toInt());
|
||||
}
|
||||
|
||||
void GraphEditor::set_field_visibility(bool b) {
|
||||
view->set_field_visibility(sender()->property("field").toInt(), b);
|
||||
view->set_field_visibility(sender()->property("field").toInt(), b);
|
||||
}
|
||||
|
||||
+29
-26
@@ -21,45 +21,48 @@
|
||||
#ifndef GRAPHEDITOR_H
|
||||
#define GRAPHEDITOR_H
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QPushButton>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
#include "ui/panel.h"
|
||||
#include "ui/graphview.h"
|
||||
#include "ui/timelineheader.h"
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/keyframenavigator.h"
|
||||
#include "project/effectrow.h"
|
||||
|
||||
class GraphEditor : public QDockWidget {
|
||||
Q_OBJECT
|
||||
class GraphEditor : public Panel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GraphEditor(QWidget* parent = nullptr);
|
||||
void update_panel();
|
||||
void set_row(EffectRow* r);
|
||||
bool view_is_focused();
|
||||
bool view_is_under_mouse();
|
||||
void delete_selected_keys();
|
||||
void select_all();
|
||||
GraphEditor(QWidget* parent = nullptr);
|
||||
|
||||
void update_panel();
|
||||
void set_row(EffectRow* r);
|
||||
bool view_is_focused();
|
||||
bool view_is_under_mouse();
|
||||
void delete_selected_keys();
|
||||
void select_all();
|
||||
protected:
|
||||
virtual void Retranslate() override;
|
||||
private:
|
||||
GraphView* view;
|
||||
TimelineHeader* header;
|
||||
QHBoxLayout* value_layout;
|
||||
QVector<LabelSlider*> slider_proxies;
|
||||
QVector<QPushButton*> slider_proxy_buttons;
|
||||
QVector<LabelSlider*> slider_proxy_sources;
|
||||
QLabel* current_row_desc;
|
||||
EffectRow* row;
|
||||
KeyframeNavigator* keyframe_nav;
|
||||
QPushButton* linear_button;
|
||||
QPushButton* bezier_button;
|
||||
QPushButton* hold_button;
|
||||
GraphView* view;
|
||||
TimelineHeader* header;
|
||||
QHBoxLayout* value_layout;
|
||||
QVector<LabelSlider*> slider_proxies;
|
||||
QVector<QPushButton*> slider_proxy_buttons;
|
||||
QVector<LabelSlider*> slider_proxy_sources;
|
||||
QLabel* current_row_desc;
|
||||
EffectRow* row;
|
||||
KeyframeNavigator* keyframe_nav;
|
||||
QPushButton* linear_button;
|
||||
QPushButton* bezier_button;
|
||||
QPushButton* hold_button;
|
||||
private slots:
|
||||
void set_key_button_enabled(bool e, int type);
|
||||
void passthrough_slider_value();
|
||||
void set_keyframe_type();
|
||||
void set_field_visibility(bool b);
|
||||
void set_key_button_enabled(bool e, int type);
|
||||
void passthrough_slider_value();
|
||||
void set_keyframe_type();
|
||||
void set_field_visibility(bool b);
|
||||
};
|
||||
|
||||
#endif // GRAPHEDITOR_H
|
||||
|
||||
+149
-149
@@ -39,175 +39,175 @@ Timeline* panel_timeline = nullptr;
|
||||
GraphEditor* panel_graph_editor = nullptr;
|
||||
|
||||
void update_effect_controls() {
|
||||
// SEND CLIPS TO EFFECT CONTROLS
|
||||
// find out how many clips are selected
|
||||
// limits to one video clip and one audio clip and only if they're linked
|
||||
// one of these days it might be nice to have multiple clips in the effects panel
|
||||
bool multiple = false;
|
||||
int vclip = -1;
|
||||
int aclip = -1;
|
||||
QVector<int> selected_clips;
|
||||
int mode = kTransitionNone;
|
||||
if (olive::ActiveSequence != nullptr) {
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
ClipPtr clip = olive::ActiveSequence->clips.at(i);
|
||||
if (clip != nullptr) {
|
||||
for (int j=0;j<olive::ActiveSequence->selections.size();j++) {
|
||||
const Selection& s = olive::ActiveSequence->selections.at(j);
|
||||
bool add = true;
|
||||
if (clip->timeline_in >= s.in && clip->timeline_out <= s.out && clip->track == s.track) {
|
||||
mode = kTransitionNone;
|
||||
} else if (selection_contains_transition(s, clip, kTransitionOpening)) {
|
||||
mode = kTransitionOpening;
|
||||
} else if (selection_contains_transition(s, clip, kTransitionClosing)) {
|
||||
mode = kTransitionClosing;
|
||||
} else {
|
||||
add = false;
|
||||
}
|
||||
// SEND CLIPS TO EFFECT CONTROLS
|
||||
// find out how many clips are selected
|
||||
// limits to one video clip and one audio clip and only if they're linked
|
||||
// one of these days it might be nice to have multiple clips in the effects panel
|
||||
bool multiple = false;
|
||||
int vclip = -1;
|
||||
int aclip = -1;
|
||||
QVector<int> selected_clips;
|
||||
int mode = kTransitionNone;
|
||||
if (olive::ActiveSequence != nullptr) {
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
ClipPtr clip = olive::ActiveSequence->clips.at(i);
|
||||
if (clip != nullptr) {
|
||||
for (int j=0;j<olive::ActiveSequence->selections.size();j++) {
|
||||
const Selection& s = olive::ActiveSequence->selections.at(j);
|
||||
bool add = true;
|
||||
if (clip->timeline_in >= s.in && clip->timeline_out <= s.out && clip->track == s.track) {
|
||||
mode = kTransitionNone;
|
||||
} else if (selection_contains_transition(s, clip, kTransitionOpening)) {
|
||||
mode = kTransitionOpening;
|
||||
} else if (selection_contains_transition(s, clip, kTransitionClosing)) {
|
||||
mode = kTransitionClosing;
|
||||
} else {
|
||||
add = false;
|
||||
}
|
||||
|
||||
if (add) {
|
||||
if (clip->track < 0 && vclip == -1) {
|
||||
vclip = i;
|
||||
} else if (clip->track >= 0 && aclip == -1) {
|
||||
aclip = i;
|
||||
} else {
|
||||
vclip = -2;
|
||||
aclip = -2;
|
||||
multiple = true;
|
||||
multiple = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (add) {
|
||||
if (clip->track < 0 && vclip == -1) {
|
||||
vclip = i;
|
||||
} else if (clip->track >= 0 && aclip == -1) {
|
||||
aclip = i;
|
||||
} else {
|
||||
vclip = -2;
|
||||
aclip = -2;
|
||||
multiple = true;
|
||||
multiple = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!multiple) {
|
||||
// check if aclip is linked to vclip
|
||||
if (vclip >= 0) selected_clips.append(vclip);
|
||||
if (aclip >= 0) selected_clips.append(aclip);
|
||||
if (vclip >= 0 && aclip >= 0) {
|
||||
bool found = false;
|
||||
ClipPtr vclip_ref = olive::ActiveSequence->clips.at(vclip);
|
||||
for (int i=0;i<vclip_ref->linked.size();i++) {
|
||||
if (vclip_ref->linked.at(i) == aclip) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
// only display multiple clips if they're linked
|
||||
selected_clips.clear();
|
||||
multiple = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!multiple) {
|
||||
// check if aclip is linked to vclip
|
||||
if (vclip >= 0) selected_clips.append(vclip);
|
||||
if (aclip >= 0) selected_clips.append(aclip);
|
||||
if (vclip >= 0 && aclip >= 0) {
|
||||
bool found = false;
|
||||
ClipPtr vclip_ref = olive::ActiveSequence->clips.at(vclip);
|
||||
for (int i=0;i<vclip_ref->linked.size();i++) {
|
||||
if (vclip_ref->linked.at(i) == aclip) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
// only display multiple clips if they're linked
|
||||
selected_clips.clear();
|
||||
multiple = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool same = (selected_clips.size() == panel_effect_controls->selected_clips.size()
|
||||
&& panel_effect_controls->get_mode() == mode);
|
||||
if (same) {
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
if (selected_clips.at(i) != panel_effect_controls->selected_clips.at(i)) {
|
||||
same = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool same = (selected_clips.size() == panel_effect_controls->selected_clips.size()
|
||||
&& panel_effect_controls->get_mode() == mode);
|
||||
if (same) {
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
if (selected_clips.at(i) != panel_effect_controls->selected_clips.at(i)) {
|
||||
same = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (panel_effect_controls->multiple != multiple || !same) {
|
||||
panel_effect_controls->multiple = multiple;
|
||||
if (panel_effect_controls->multiple != multiple || !same) {
|
||||
panel_effect_controls->multiple = multiple;
|
||||
|
||||
panel_effect_controls->set_clips(selected_clips, mode);
|
||||
}
|
||||
panel_effect_controls->set_clips(selected_clips, mode);
|
||||
}
|
||||
}
|
||||
|
||||
void update_ui(bool modified) {
|
||||
if (modified) {
|
||||
update_effect_controls();
|
||||
}
|
||||
panel_effect_controls->update_keyframes();
|
||||
panel_timeline->repaint_timeline();
|
||||
panel_sequence_viewer->update_viewer();
|
||||
panel_graph_editor->update_panel();
|
||||
if (modified) {
|
||||
update_effect_controls();
|
||||
}
|
||||
panel_effect_controls->update_keyframes();
|
||||
panel_timeline->repaint_timeline();
|
||||
panel_sequence_viewer->update_viewer();
|
||||
panel_graph_editor->update_panel();
|
||||
}
|
||||
|
||||
QDockWidget *get_focused_panel(bool force_hover) {
|
||||
QDockWidget* w = nullptr;
|
||||
if (olive::CurrentConfig.hover_focus || force_hover) {
|
||||
if (panel_project->underMouse()) {
|
||||
w = panel_project;
|
||||
} else if (panel_effect_controls->underMouse()) {
|
||||
w = panel_effect_controls;
|
||||
} else if (panel_sequence_viewer->underMouse()) {
|
||||
w = panel_sequence_viewer;
|
||||
} else if (panel_footage_viewer->underMouse()) {
|
||||
w = panel_footage_viewer;
|
||||
} else if (panel_timeline->underMouse()) {
|
||||
w = panel_timeline;
|
||||
} else if (panel_graph_editor->view_is_under_mouse()) {
|
||||
w = panel_graph_editor;
|
||||
}
|
||||
}
|
||||
if (w == nullptr) {
|
||||
if (panel_project->is_focused()) {
|
||||
w = panel_project;
|
||||
} else if (panel_effect_controls->keyframe_focus() || panel_effect_controls->is_focused()) {
|
||||
w = panel_effect_controls;
|
||||
} else if (panel_sequence_viewer->is_focused()) {
|
||||
w = panel_sequence_viewer;
|
||||
} else if (panel_footage_viewer->is_focused()) {
|
||||
w = panel_footage_viewer;
|
||||
} else if (panel_timeline->focused()) {
|
||||
w = panel_timeline;
|
||||
} else if (panel_graph_editor->view_is_focused()) {
|
||||
w = panel_graph_editor;
|
||||
}
|
||||
}
|
||||
return w;
|
||||
QDockWidget* w = nullptr;
|
||||
if (olive::CurrentConfig.hover_focus || force_hover) {
|
||||
if (panel_project->underMouse()) {
|
||||
w = panel_project;
|
||||
} else if (panel_effect_controls->underMouse()) {
|
||||
w = panel_effect_controls;
|
||||
} else if (panel_sequence_viewer->underMouse()) {
|
||||
w = panel_sequence_viewer;
|
||||
} else if (panel_footage_viewer->underMouse()) {
|
||||
w = panel_footage_viewer;
|
||||
} else if (panel_timeline->underMouse()) {
|
||||
w = panel_timeline;
|
||||
} else if (panel_graph_editor->view_is_under_mouse()) {
|
||||
w = panel_graph_editor;
|
||||
}
|
||||
}
|
||||
if (w == nullptr) {
|
||||
if (panel_project->is_focused()) {
|
||||
w = panel_project;
|
||||
} else if (panel_effect_controls->keyframe_focus() || panel_effect_controls->is_focused()) {
|
||||
w = panel_effect_controls;
|
||||
} else if (panel_sequence_viewer->is_focused()) {
|
||||
w = panel_sequence_viewer;
|
||||
} else if (panel_footage_viewer->is_focused()) {
|
||||
w = panel_footage_viewer;
|
||||
} else if (panel_timeline->focused()) {
|
||||
w = panel_timeline;
|
||||
} else if (panel_graph_editor->view_is_focused()) {
|
||||
w = panel_graph_editor;
|
||||
}
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
void alloc_panels(QWidget* parent) {
|
||||
// TODO maybe replace these with non-pointers later on?
|
||||
panel_sequence_viewer = new Viewer(parent);
|
||||
panel_sequence_viewer->setObjectName("seq_viewer");
|
||||
panel_sequence_viewer->set_panel_name(QCoreApplication::translate("Viewer", "Sequence Viewer"));
|
||||
panel_footage_viewer = new Viewer(parent);
|
||||
panel_footage_viewer->setObjectName("footage_viewer");
|
||||
panel_footage_viewer->set_panel_name(QCoreApplication::translate("Viewer", "Media Viewer"));
|
||||
panel_project = new Project(parent);
|
||||
panel_project->setObjectName("proj_root");
|
||||
panel_effect_controls = new EffectControls(parent);
|
||||
init_effects();
|
||||
panel_effect_controls->setObjectName("fx_controls");
|
||||
panel_timeline = new Timeline(parent);
|
||||
panel_timeline->setObjectName("timeline");
|
||||
panel_graph_editor = new GraphEditor(parent);
|
||||
panel_graph_editor->setObjectName("graph_editor");
|
||||
// TODO maybe replace these with non-pointers later on?
|
||||
panel_sequence_viewer = new Viewer(parent);
|
||||
panel_sequence_viewer->setObjectName("seq_viewer");
|
||||
panel_sequence_viewer->set_panel_name(QCoreApplication::translate("Viewer", "Sequence Viewer"));
|
||||
panel_footage_viewer = new Viewer(parent);
|
||||
panel_footage_viewer->setObjectName("footage_viewer");
|
||||
panel_footage_viewer->set_panel_name(QCoreApplication::translate("Viewer", "Media Viewer"));
|
||||
panel_project = new Project(parent);
|
||||
panel_project->setObjectName("proj_root");
|
||||
panel_effect_controls = new EffectControls(parent);
|
||||
init_effects();
|
||||
panel_effect_controls->setObjectName("fx_controls");
|
||||
panel_timeline = new Timeline(parent);
|
||||
panel_timeline->setObjectName("timeline");
|
||||
panel_graph_editor = new GraphEditor(parent);
|
||||
panel_graph_editor->setObjectName("graph_editor");
|
||||
}
|
||||
|
||||
void free_panels() {
|
||||
delete panel_sequence_viewer;
|
||||
panel_sequence_viewer = nullptr;
|
||||
delete panel_footage_viewer;
|
||||
panel_footage_viewer = nullptr;
|
||||
delete panel_project;
|
||||
panel_project = nullptr;
|
||||
delete panel_effect_controls;
|
||||
panel_effect_controls = nullptr;
|
||||
delete panel_timeline;
|
||||
panel_timeline = nullptr;
|
||||
delete panel_sequence_viewer;
|
||||
panel_sequence_viewer = nullptr;
|
||||
delete panel_footage_viewer;
|
||||
panel_footage_viewer = nullptr;
|
||||
delete panel_project;
|
||||
panel_project = nullptr;
|
||||
delete panel_effect_controls;
|
||||
panel_effect_controls = nullptr;
|
||||
delete panel_timeline;
|
||||
panel_timeline = nullptr;
|
||||
}
|
||||
|
||||
void scroll_to_frame_internal(QScrollBar* bar, long frame, double zoom, int area_width) {
|
||||
int screen_point = getScreenPointFromFrame(zoom, frame) - bar->value();
|
||||
int min_x = area_width*0.1;
|
||||
int max_x = area_width-min_x;
|
||||
if (screen_point < min_x) {
|
||||
bar->setValue(getScreenPointFromFrame(zoom, frame) - min_x);
|
||||
} else if (screen_point > max_x) {
|
||||
bar->setValue(getScreenPointFromFrame(zoom, frame) - max_x);
|
||||
}
|
||||
int screen_point = getScreenPointFromFrame(zoom, frame) - bar->value();
|
||||
int min_x = area_width*0.1;
|
||||
int max_x = area_width-min_x;
|
||||
if (screen_point < min_x) {
|
||||
bar->setValue(getScreenPointFromFrame(zoom, frame) - min_x);
|
||||
} else if (screen_point > max_x) {
|
||||
bar->setValue(getScreenPointFromFrame(zoom, frame) - max_x);
|
||||
}
|
||||
}
|
||||
|
||||
+993
-989
File diff suppressed because it is too large
Load Diff
+60
-56
@@ -21,7 +21,6 @@
|
||||
#ifndef PROJECT_H
|
||||
#define PROJECT_H
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QVector>
|
||||
#include <QTimer>
|
||||
#include <QDir>
|
||||
@@ -35,6 +34,7 @@
|
||||
#include "project/projectelements.h"
|
||||
#include "project/undo.h"
|
||||
#include "project/sourcescommon.h"
|
||||
#include "ui/panel.h"
|
||||
#include "ui/sourceiconview.h"
|
||||
|
||||
#include "ui/sourcetable.h"
|
||||
@@ -50,75 +50,79 @@ SequencePtr create_sequence_from_media(QVector<Media *> &media_list);
|
||||
QString get_channel_layout_name(int channels, uint64_t layout);
|
||||
QString get_interlacing_name(int interlacing);
|
||||
|
||||
class Project : public QDockWidget {
|
||||
Q_OBJECT
|
||||
class Project : public Panel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Project(QWidget *parent = nullptr);
|
||||
~Project();
|
||||
bool is_focused();
|
||||
void clear();
|
||||
Media* create_sequence_internal(ComboAction *ca, SequencePtr s, bool open, Media* parent);
|
||||
QString get_next_sequence_name(QString start = nullptr);
|
||||
void process_file_list(QStringList& files, bool recursive = false, Media* replace = nullptr, Media *parent = nullptr);
|
||||
void replace_media(Media* item, QString filename);
|
||||
Media* get_selected_folder();
|
||||
bool reveal_media(Media *media, QModelIndex parent = QModelIndex());
|
||||
void add_recent_project(QString url);
|
||||
explicit Project(QWidget *parent = nullptr);
|
||||
~Project();
|
||||
|
||||
void new_project();
|
||||
void load_project(bool autorecovery);
|
||||
void save_project(bool autorecovery);
|
||||
bool is_focused();
|
||||
void clear();
|
||||
Media* create_sequence_internal(ComboAction *ca, SequencePtr s, bool open, Media* parent);
|
||||
QString get_next_sequence_name(QString start = nullptr);
|
||||
void process_file_list(QStringList& files, bool recursive = false, Media* replace = nullptr, Media *parent = nullptr);
|
||||
void replace_media(Media* item, QString filename);
|
||||
Media* get_selected_folder();
|
||||
bool reveal_media(Media *media, QModelIndex parent = QModelIndex());
|
||||
void add_recent_project(QString url);
|
||||
|
||||
Media* create_folder_internal(QString name);
|
||||
Media* item_to_media(const QModelIndex& index);
|
||||
void new_project();
|
||||
void load_project(bool autorecovery);
|
||||
void save_project(bool autorecovery);
|
||||
|
||||
void save_recent_projects();
|
||||
Media* create_folder_internal(QString name);
|
||||
Media* item_to_media(const QModelIndex& index);
|
||||
|
||||
QVector<Media*> list_all_project_sequences();
|
||||
void save_recent_projects();
|
||||
|
||||
SourceTable* tree_view;
|
||||
SourceIconView* icon_view;
|
||||
SourcesCommon* sources_common;
|
||||
QVector<Media*> list_all_project_sequences();
|
||||
|
||||
ProjectFilter* sorter;
|
||||
SourceTable* tree_view;
|
||||
SourceIconView* icon_view;
|
||||
SourcesCommon* sources_common;
|
||||
|
||||
QVector<Media*> last_imported_media;
|
||||
ProjectFilter* sorter;
|
||||
|
||||
QModelIndexList get_current_selected();
|
||||
QVector<Media*> last_imported_media;
|
||||
|
||||
void start_preview_generator(Media* item, bool replacing);
|
||||
void get_all_media_from_table(QList<Media *> &items, QList<Media *> &list, int type = -1);
|
||||
QModelIndexList get_current_selected();
|
||||
|
||||
QWidget* toolbar_widget;
|
||||
void start_preview_generator(Media* item, bool replacing);
|
||||
void get_all_media_from_table(QList<Media *> &items, QList<Media *> &list, int type = -1);
|
||||
|
||||
QWidget* toolbar_widget;
|
||||
protected:
|
||||
virtual void Retranslate() override;
|
||||
public slots:
|
||||
void import_dialog();
|
||||
void delete_selected_media();
|
||||
void duplicate_selected();
|
||||
void delete_clips_using_selected_media();
|
||||
void replace_selected_file();
|
||||
void replace_clip_media();
|
||||
void open_properties();
|
||||
void new_folder();
|
||||
void new_sequence();
|
||||
void import_dialog();
|
||||
void delete_selected_media();
|
||||
void duplicate_selected();
|
||||
void delete_clips_using_selected_media();
|
||||
void replace_selected_file();
|
||||
void replace_clip_media();
|
||||
void open_properties();
|
||||
void new_folder();
|
||||
void new_sequence();
|
||||
private:
|
||||
void save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex &parent = QModelIndex());
|
||||
int folder_id;
|
||||
int media_id;
|
||||
int sequence_id;
|
||||
void list_all_sequences_worker(QVector<Media *> *list, Media* parent);
|
||||
QString get_file_name_from_path(const QString &path);
|
||||
QDir proj_dir;
|
||||
QWidget* icon_view_container;
|
||||
QPushButton* directory_up;
|
||||
void save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex &parent = QModelIndex());
|
||||
int folder_id;
|
||||
int media_id;
|
||||
int sequence_id;
|
||||
void list_all_sequences_worker(QVector<Media *> *list, Media* parent);
|
||||
QString get_file_name_from_path(const QString &path);
|
||||
QDir proj_dir;
|
||||
QWidget* icon_view_container;
|
||||
QPushButton* directory_up;
|
||||
QLineEdit* toolbar_search;
|
||||
private slots:
|
||||
void update_view_type();
|
||||
void set_icon_view();
|
||||
void set_tree_view();
|
||||
void clear_recent_projects();
|
||||
void set_icon_view_size(int);
|
||||
void set_up_dir_enabled();
|
||||
void go_up_dir();
|
||||
void make_new_menu();
|
||||
void update_view_type();
|
||||
void set_icon_view();
|
||||
void set_tree_view();
|
||||
void clear_recent_projects();
|
||||
void set_icon_view_size(int);
|
||||
void set_up_dir_enabled();
|
||||
void go_up_dir();
|
||||
void make_new_menu();
|
||||
};
|
||||
|
||||
#endif // PROJECT_H
|
||||
|
||||
+1587
-1576
File diff suppressed because it is too large
Load Diff
+193
-190
@@ -21,6 +21,11 @@
|
||||
#ifndef TIMELINE_H
|
||||
#define TIMELINE_H
|
||||
|
||||
#include <QVector>
|
||||
#include <QTime>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ui/timelinewidget.h"
|
||||
#include "ui/timelinetools.h"
|
||||
#include "project/selection.h"
|
||||
#include "project/clip.h"
|
||||
@@ -28,12 +33,7 @@
|
||||
#include "ui/timelineheader.h"
|
||||
#include "ui/resizablescrollbar.h"
|
||||
#include "ui/audiomonitor.h"
|
||||
#include "ui/timelinewidget.h"
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QVector>
|
||||
#include <QTime>
|
||||
#include <QPushButton>
|
||||
#include "ui/panel.h"
|
||||
|
||||
#define TRACK_DEFAULT_HEIGHT 40
|
||||
|
||||
@@ -52,236 +52,239 @@ void move_clip(ComboAction *ca, ClipPtr c, long iin, long iout, long iclip_in, i
|
||||
void ripple_clips(ComboAction *ca, SequencePtr s, long point, long length, const QVector<int>& ignore = QVector<int>());
|
||||
|
||||
struct Ghost {
|
||||
int clip;
|
||||
long in;
|
||||
long out;
|
||||
int track;
|
||||
long clip_in;
|
||||
int clip;
|
||||
long in;
|
||||
long out;
|
||||
int track;
|
||||
long clip_in;
|
||||
|
||||
long old_in;
|
||||
long old_out;
|
||||
int old_track;
|
||||
long old_clip_in;
|
||||
long old_in;
|
||||
long old_out;
|
||||
int old_track;
|
||||
long old_clip_in;
|
||||
|
||||
// importing variables
|
||||
Media* media;
|
||||
int media_stream;
|
||||
// importing variables
|
||||
Media* media;
|
||||
int media_stream;
|
||||
|
||||
// other variables
|
||||
long ghost_length;
|
||||
long media_length;
|
||||
bool trim_in;
|
||||
bool trimming;
|
||||
// other variables
|
||||
long ghost_length;
|
||||
long media_length;
|
||||
bool trim_in;
|
||||
bool trimming;
|
||||
|
||||
// transition trimming
|
||||
TransitionPtr transition;
|
||||
// transition trimming
|
||||
TransitionPtr transition;
|
||||
};
|
||||
|
||||
class Timeline : public QDockWidget
|
||||
class Timeline : public Panel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Timeline(QWidget *parent = nullptr);
|
||||
~Timeline();
|
||||
explicit Timeline(QWidget *parent = nullptr);
|
||||
~Timeline();
|
||||
|
||||
bool focused();
|
||||
void multiply_zoom(double m);
|
||||
void copy(bool del);
|
||||
ClipPtr split_clip(ComboAction* ca, bool transitions, int p, long frame);
|
||||
ClipPtr split_clip(ComboAction* ca, bool transitions, int p, long frame, long post_in);
|
||||
bool split_selection(ComboAction* ca);
|
||||
bool split_all_clips_at_point(ComboAction *ca, long point);
|
||||
bool split_clip_and_relink(ComboAction* ca, int clip, long frame, bool relink);
|
||||
void clean_up_selections(QVector<Selection>& areas);
|
||||
void deselect_area(long in, long out, int track);
|
||||
void delete_areas_and_relink(ComboAction *ca, QVector<Selection>& areas, bool deselect_areas);
|
||||
void relink_clips_using_ids(QVector<int>& old_clips, QVector<ClipPtr>& new_clips);
|
||||
void update_sequence();
|
||||
bool focused();
|
||||
void multiply_zoom(double m);
|
||||
void copy(bool del);
|
||||
ClipPtr split_clip(ComboAction* ca, bool transitions, int p, long frame);
|
||||
ClipPtr split_clip(ComboAction* ca, bool transitions, int p, long frame, long post_in);
|
||||
bool split_selection(ComboAction* ca);
|
||||
bool split_all_clips_at_point(ComboAction *ca, long point);
|
||||
bool split_clip_and_relink(ComboAction* ca, int clip, long frame, bool relink);
|
||||
void clean_up_selections(QVector<Selection>& areas);
|
||||
void deselect_area(long in, long out, int track);
|
||||
void delete_areas_and_relink(ComboAction *ca, QVector<Selection>& areas, bool deselect_areas);
|
||||
void relink_clips_using_ids(QVector<int>& old_clips, QVector<ClipPtr>& new_clips);
|
||||
void update_sequence();
|
||||
|
||||
QVector<int> get_tracks_of_linked_clips(int i);
|
||||
bool has_clip_been_split(int c);
|
||||
void edit_to_point_internal(bool in, bool ripple);
|
||||
void delete_in_out_internal(bool ripple);
|
||||
QVector<int> get_tracks_of_linked_clips(int i);
|
||||
bool has_clip_been_split(int c);
|
||||
void edit_to_point_internal(bool in, bool ripple);
|
||||
void delete_in_out_internal(bool ripple);
|
||||
|
||||
void create_ghosts_from_media(SequencePtr seq, long entry_point, QVector<Media *> &media_list);
|
||||
void add_clips_from_ghosts(ComboAction *ca, SequencePtr s);
|
||||
void create_ghosts_from_media(SequencePtr seq, long entry_point, QVector<Media *> &media_list);
|
||||
void add_clips_from_ghosts(ComboAction *ca, SequencePtr s);
|
||||
|
||||
int getTimelineScreenPointFromFrame(long frame);
|
||||
long getTimelineFrameFromScreenPoint(int x);
|
||||
int getDisplayScreenPointFromFrame(long frame);
|
||||
long getDisplayFrameFromScreenPoint(int x);
|
||||
int getTimelineScreenPointFromFrame(long frame);
|
||||
long getTimelineFrameFromScreenPoint(int x);
|
||||
int getDisplayScreenPointFromFrame(long frame);
|
||||
long getDisplayFrameFromScreenPoint(int x);
|
||||
|
||||
int get_snap_range();
|
||||
bool snap_to_point(long point, long* l);
|
||||
bool snap_to_timeline(long* l, bool use_playhead, bool use_markers, bool use_workarea);
|
||||
void set_marker();
|
||||
int get_snap_range();
|
||||
bool snap_to_point(long point, long* l);
|
||||
bool snap_to_timeline(long* l, bool use_playhead, bool use_markers, bool use_workarea);
|
||||
void set_marker();
|
||||
|
||||
// shared information
|
||||
int tool;
|
||||
long cursor_frame;
|
||||
int cursor_track;
|
||||
double zoom;
|
||||
bool zoom_just_changed;
|
||||
long drag_frame_start;
|
||||
int drag_track_start;
|
||||
void update_effect_controls();
|
||||
bool showing_all;
|
||||
double old_zoom;
|
||||
// shared information
|
||||
int tool;
|
||||
long cursor_frame;
|
||||
int cursor_track;
|
||||
double zoom;
|
||||
bool zoom_just_changed;
|
||||
long drag_frame_start;
|
||||
int drag_track_start;
|
||||
void update_effect_controls();
|
||||
bool showing_all;
|
||||
double old_zoom;
|
||||
|
||||
QVector<int> video_track_heights;
|
||||
QVector<int> audio_track_heights;
|
||||
int get_track_height_size(bool video);
|
||||
int calculate_track_height(int track, int height);
|
||||
QVector<int> video_track_heights;
|
||||
QVector<int> audio_track_heights;
|
||||
int get_track_height_size(bool video);
|
||||
int calculate_track_height(int track, int height);
|
||||
|
||||
// snapping
|
||||
bool snapping;
|
||||
bool snapped;
|
||||
long snap_point;
|
||||
// snapping
|
||||
bool snapping;
|
||||
bool snapped;
|
||||
long snap_point;
|
||||
|
||||
// selecting functions
|
||||
bool selecting;
|
||||
int selection_offset;
|
||||
void delete_selection(QVector<Selection> &selections, bool ripple);
|
||||
void select_all();
|
||||
bool rect_select_init;
|
||||
bool rect_select_proc;
|
||||
int rect_select_x;
|
||||
int rect_select_y;
|
||||
int rect_select_w;
|
||||
int rect_select_h;
|
||||
// selecting functions
|
||||
bool selecting;
|
||||
int selection_offset;
|
||||
void delete_selection(QVector<Selection> &selections, bool ripple);
|
||||
void select_all();
|
||||
bool rect_select_init;
|
||||
bool rect_select_proc;
|
||||
int rect_select_x;
|
||||
int rect_select_y;
|
||||
int rect_select_w;
|
||||
int rect_select_h;
|
||||
|
||||
// moving
|
||||
bool moving_init;
|
||||
bool moving_proc;
|
||||
QVector<Ghost> ghosts;
|
||||
bool video_ghosts;
|
||||
bool audio_ghosts;
|
||||
bool move_insert;
|
||||
// moving
|
||||
bool moving_init;
|
||||
bool moving_proc;
|
||||
QVector<Ghost> ghosts;
|
||||
bool video_ghosts;
|
||||
bool audio_ghosts;
|
||||
bool move_insert;
|
||||
|
||||
// trimming
|
||||
int trim_target;
|
||||
bool trim_in_point;
|
||||
int transition_select;
|
||||
// trimming
|
||||
int trim_target;
|
||||
bool trim_in_point;
|
||||
int transition_select;
|
||||
|
||||
// splitting
|
||||
bool splitting;
|
||||
QVector<int> split_tracks;
|
||||
QVector<int> split_cache;
|
||||
// splitting
|
||||
bool splitting;
|
||||
QVector<int> split_tracks;
|
||||
QVector<int> split_cache;
|
||||
|
||||
// importing
|
||||
bool importing;
|
||||
bool importing_files;
|
||||
// importing
|
||||
bool importing;
|
||||
bool importing_files;
|
||||
|
||||
// creating variables
|
||||
bool creating;
|
||||
int creating_object;
|
||||
// creating variables
|
||||
bool creating;
|
||||
int creating_object;
|
||||
|
||||
// transition variables
|
||||
bool transition_tool_init;
|
||||
bool transition_tool_proc;
|
||||
int transition_tool_pre_clip;
|
||||
int transition_tool_post_clip;
|
||||
int transition_tool_type;
|
||||
const EffectMeta* transition_tool_meta;
|
||||
int transition_tool_side;
|
||||
// transition variables
|
||||
bool transition_tool_init;
|
||||
bool transition_tool_proc;
|
||||
int transition_tool_pre_clip;
|
||||
int transition_tool_post_clip;
|
||||
int transition_tool_type;
|
||||
const EffectMeta* transition_tool_meta;
|
||||
int transition_tool_side;
|
||||
|
||||
// hand tool variables
|
||||
bool hand_moving;
|
||||
int drag_x_start;
|
||||
int drag_y_start;
|
||||
// hand tool variables
|
||||
bool hand_moving;
|
||||
int drag_x_start;
|
||||
int drag_y_start;
|
||||
|
||||
bool block_repaints;
|
||||
bool block_repaints;
|
||||
|
||||
TimelineHeader* headers;
|
||||
AudioMonitor* audio_monitor;
|
||||
ResizableScrollBar* horizontalScrollBar;
|
||||
TimelineHeader* headers;
|
||||
AudioMonitor* audio_monitor;
|
||||
ResizableScrollBar* horizontalScrollBar;
|
||||
|
||||
QPushButton* toolArrowButton;
|
||||
QPushButton* toolEditButton;
|
||||
QPushButton* toolRippleButton;
|
||||
QPushButton* toolRazorButton;
|
||||
QPushButton* toolSlipButton;
|
||||
QPushButton* toolSlideButton;
|
||||
QPushButton* toolHandButton;
|
||||
QPushButton* toolTransitionButton;
|
||||
QPushButton* snappingButton;
|
||||
QPushButton* toolArrowButton;
|
||||
QPushButton* toolEditButton;
|
||||
QPushButton* toolRippleButton;
|
||||
QPushButton* toolRazorButton;
|
||||
QPushButton* toolSlipButton;
|
||||
QPushButton* toolSlideButton;
|
||||
QPushButton* toolHandButton;
|
||||
QPushButton* toolTransitionButton;
|
||||
QPushButton* snappingButton;
|
||||
|
||||
void scroll_to_frame(long frame);
|
||||
void select_from_playhead();
|
||||
void scroll_to_frame(long frame);
|
||||
void select_from_playhead();
|
||||
|
||||
bool can_ripple_empty_space(long frame, int track);
|
||||
bool can_ripple_empty_space(long frame, int track);
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
protected:
|
||||
virtual void Retranslate() override;
|
||||
public slots:
|
||||
void paste(bool insert = false);
|
||||
void repaint_timeline();
|
||||
void toggle_show_all();
|
||||
void deselect();
|
||||
void toggle_links();
|
||||
void split_at_playhead();
|
||||
void ripple_delete();
|
||||
void ripple_delete_empty_space();
|
||||
void toggle_enable_on_selected_clips();
|
||||
void paste(bool insert = false);
|
||||
void repaint_timeline();
|
||||
void toggle_show_all();
|
||||
void deselect();
|
||||
void toggle_links();
|
||||
void split_at_playhead();
|
||||
void ripple_delete();
|
||||
void ripple_delete_empty_space();
|
||||
void toggle_enable_on_selected_clips();
|
||||
|
||||
void delete_inout();
|
||||
void ripple_delete_inout();
|
||||
void delete_inout();
|
||||
void ripple_delete_inout();
|
||||
|
||||
void ripple_to_in_point();
|
||||
void ripple_to_out_point();
|
||||
void edit_to_in_point();
|
||||
void edit_to_out_point();
|
||||
void ripple_to_in_point();
|
||||
void ripple_to_out_point();
|
||||
void edit_to_in_point();
|
||||
void edit_to_out_point();
|
||||
|
||||
void increase_track_height();
|
||||
void decrease_track_height();
|
||||
void increase_track_height();
|
||||
void decrease_track_height();
|
||||
|
||||
void previous_cut();
|
||||
void next_cut();
|
||||
void previous_cut();
|
||||
void next_cut();
|
||||
|
||||
void add_transition();
|
||||
void add_transition();
|
||||
|
||||
void nest();
|
||||
void nest();
|
||||
|
||||
void zoom_in();
|
||||
void zoom_out();
|
||||
void zoom_in();
|
||||
void zoom_out();
|
||||
|
||||
private slots:
|
||||
void snapping_clicked(bool checked);
|
||||
void add_btn_click();
|
||||
void add_menu_item(QAction*);
|
||||
void setScroll(int);
|
||||
void record_btn_click();
|
||||
void transition_tool_click();
|
||||
void transition_menu_select(QAction*);
|
||||
void resize_move(double d);
|
||||
void set_tool();
|
||||
void snapping_clicked(bool checked);
|
||||
void add_btn_click();
|
||||
void add_menu_item(QAction*);
|
||||
void setScroll(int);
|
||||
void record_btn_click();
|
||||
void transition_tool_click();
|
||||
void transition_menu_select(QAction*);
|
||||
void resize_move(double d);
|
||||
void set_tool();
|
||||
|
||||
private:
|
||||
void set_zoom_value(double v);
|
||||
QVector<QPushButton*> tool_buttons;
|
||||
void decheck_tool_buttons(QObject* sender);
|
||||
void set_tool(int tool);
|
||||
int scroll;
|
||||
void set_sb_max();
|
||||
void set_zoom_value(double v);
|
||||
QVector<QPushButton*> tool_buttons;
|
||||
void decheck_tool_buttons(QObject* sender);
|
||||
void set_tool(int tool);
|
||||
int scroll;
|
||||
void set_sb_max();
|
||||
void UpdateTitle();
|
||||
|
||||
void setup_ui();
|
||||
void setup_ui();
|
||||
|
||||
int default_track_height;
|
||||
int default_track_height;
|
||||
|
||||
// ripple delete empty space variables
|
||||
long rc_ripple_min;
|
||||
long rc_ripple_max;
|
||||
// ripple delete empty space variables
|
||||
long rc_ripple_min;
|
||||
long rc_ripple_max;
|
||||
|
||||
QWidget* timeline_area;
|
||||
TimelineWidget* video_area;
|
||||
TimelineWidget* audio_area;
|
||||
QWidget* editAreas;
|
||||
QScrollBar* videoScrollbar;
|
||||
QScrollBar* audioScrollbar;
|
||||
QPushButton* zoomInButton;
|
||||
QPushButton* zoomOutButton;
|
||||
QPushButton* recordButton;
|
||||
QPushButton* addButton;
|
||||
QWidget* tool_button_widget;
|
||||
QWidget* timeline_area;
|
||||
TimelineWidget* video_area;
|
||||
TimelineWidget* audio_area;
|
||||
QWidget* editAreas;
|
||||
QScrollBar* videoScrollbar;
|
||||
QScrollBar* audioScrollbar;
|
||||
QPushButton* zoomInButton;
|
||||
QPushButton* zoomOutButton;
|
||||
QPushButton* recordButton;
|
||||
QPushButton* addButton;
|
||||
QWidget* tool_button_widget;
|
||||
};
|
||||
|
||||
#endif // TIMELINE_H
|
||||
|
||||
+5
-1
@@ -56,7 +56,7 @@ extern "C" {
|
||||
#include <QPushButton>
|
||||
|
||||
Viewer::Viewer(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
Panel(parent),
|
||||
playing(false),
|
||||
just_played(false),
|
||||
media(nullptr),
|
||||
@@ -99,6 +99,10 @@ Viewer::Viewer(QWidget *parent) :
|
||||
|
||||
Viewer::~Viewer() {}
|
||||
|
||||
void Viewer::Retranslate() {
|
||||
update_window_title();
|
||||
}
|
||||
|
||||
bool Viewer::is_focused() {
|
||||
return headers->hasFocus()
|
||||
|| viewer_widget->hasFocus()
|
||||
|
||||
+96
-92
@@ -21,7 +21,6 @@
|
||||
#ifndef VIEWER_H
|
||||
#define VIEWER_H
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QTimer>
|
||||
#include <QIcon>
|
||||
#include <QLabel>
|
||||
@@ -30,6 +29,7 @@
|
||||
#include "project/marker.h"
|
||||
#include "project/media.h"
|
||||
|
||||
#include "ui/panel.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "ui/timelinewidget.h"
|
||||
#include "ui/timelineheader.h"
|
||||
@@ -40,123 +40,127 @@ bool frame_rate_is_droppable(float rate);
|
||||
long timecode_to_frame(const QString& s, int view, double frame_rate);
|
||||
QString frame_to_timecode(long f, int view, double frame_rate);
|
||||
|
||||
class Viewer : public QDockWidget
|
||||
class Viewer : public Panel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Viewer(QWidget *parent = nullptr);
|
||||
~Viewer();
|
||||
explicit Viewer(QWidget *parent = nullptr);
|
||||
~Viewer();
|
||||
|
||||
bool is_focused();
|
||||
bool is_main_sequence();
|
||||
void set_main_sequence();
|
||||
void set_media(Media *m);
|
||||
void compose();
|
||||
void set_playpause_icon(bool play);
|
||||
void update_playhead_timecode(long p);
|
||||
void update_end_timecode();
|
||||
void update_header_zoom();
|
||||
void clear_in();
|
||||
void clear_out();
|
||||
void clear_inout_point();
|
||||
void set_in_point();
|
||||
void set_out_point();
|
||||
void set_zoom(bool in);
|
||||
void set_panel_name(const QString& n);
|
||||
bool is_focused();
|
||||
bool is_main_sequence();
|
||||
void set_main_sequence();
|
||||
void set_media(Media *m);
|
||||
void compose();
|
||||
void set_playpause_icon(bool play);
|
||||
void update_playhead_timecode(long p);
|
||||
void update_end_timecode();
|
||||
void update_header_zoom();
|
||||
void clear_in();
|
||||
void clear_out();
|
||||
void clear_inout_point();
|
||||
void set_in_point();
|
||||
void set_out_point();
|
||||
void set_zoom(bool in);
|
||||
void set_panel_name(const QString& n);
|
||||
|
||||
// playback functions
|
||||
void seek(long p);
|
||||
void play(bool in_to_out = false);
|
||||
void pause();
|
||||
bool playing;
|
||||
long playhead_start;
|
||||
qint64 start_msecs;
|
||||
QTimer playback_updater;
|
||||
bool just_played;
|
||||
// playback functions
|
||||
void seek(long p);
|
||||
void play(bool in_to_out = false);
|
||||
void pause();
|
||||
bool playing;
|
||||
long playhead_start;
|
||||
qint64 start_msecs;
|
||||
QTimer playback_updater;
|
||||
bool just_played;
|
||||
|
||||
void cue_recording(long start, long end, int track);
|
||||
void uncue_recording();
|
||||
bool is_recording_cued();
|
||||
long recording_start;
|
||||
long recording_end;
|
||||
int recording_track;
|
||||
void cue_recording(long start, long end, int track);
|
||||
void uncue_recording();
|
||||
bool is_recording_cued();
|
||||
long recording_start;
|
||||
long recording_end;
|
||||
int recording_track;
|
||||
|
||||
void reset_all_audio();
|
||||
void update_parents(bool reload_fx = false);
|
||||
void reset_all_audio();
|
||||
void update_parents(bool reload_fx = false);
|
||||
|
||||
int get_playback_speed();
|
||||
int get_playback_speed();
|
||||
|
||||
ViewerWidget* viewer_widget;
|
||||
ViewerWidget* viewer_widget;
|
||||
|
||||
Media* media;
|
||||
SequencePtr seq;
|
||||
QVector<Marker>* marker_ref;
|
||||
Media* media;
|
||||
SequencePtr seq;
|
||||
QVector<Marker>* marker_ref;
|
||||
|
||||
void set_marker();
|
||||
void set_marker();
|
||||
|
||||
TimelineHeader* headers;
|
||||
TimelineHeader* headers;
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
protected:
|
||||
virtual void Retranslate() override;
|
||||
|
||||
public slots:
|
||||
void play_wake();
|
||||
void go_to_start();
|
||||
void go_to_in();
|
||||
void previous_frame();
|
||||
void toggle_play();
|
||||
void increase_speed();
|
||||
void decrease_speed();
|
||||
void next_frame();
|
||||
void go_to_out();
|
||||
void go_to_end();
|
||||
void close_media();
|
||||
void update_viewer();
|
||||
void play_wake();
|
||||
void go_to_start();
|
||||
void go_to_in();
|
||||
void previous_frame();
|
||||
void toggle_play();
|
||||
void increase_speed();
|
||||
void decrease_speed();
|
||||
void next_frame();
|
||||
void go_to_out();
|
||||
void go_to_end();
|
||||
void close_media();
|
||||
void update_viewer();
|
||||
|
||||
private slots:
|
||||
void update_playhead();
|
||||
void timer_update();
|
||||
void recording_flasher_update();
|
||||
void resize_move(double d);
|
||||
void update_playhead();
|
||||
void timer_update();
|
||||
void recording_flasher_update();
|
||||
void resize_move(double d);
|
||||
|
||||
private:
|
||||
void update_window_title();
|
||||
void clean_created_seq();
|
||||
void set_sequence(bool main, SequencePtr s);
|
||||
bool main_sequence;
|
||||
bool created_sequence;
|
||||
long cached_end_frame;
|
||||
QString panel_name;
|
||||
double minimum_zoom;
|
||||
bool playing_in_to_out;
|
||||
long last_playhead;
|
||||
void set_zoom_value(double d);
|
||||
void set_sb_max();
|
||||
void set_playback_speed(int s);
|
||||
|
||||
long get_seq_in();
|
||||
long get_seq_out();
|
||||
void update_window_title();
|
||||
void clean_created_seq();
|
||||
void set_sequence(bool main, SequencePtr s);
|
||||
bool main_sequence;
|
||||
bool created_sequence;
|
||||
long cached_end_frame;
|
||||
QString panel_name;
|
||||
double minimum_zoom;
|
||||
bool playing_in_to_out;
|
||||
long last_playhead;
|
||||
void set_zoom_value(double d);
|
||||
void set_sb_max();
|
||||
void set_playback_speed(int s);
|
||||
|
||||
QIcon playIcon;
|
||||
long get_seq_in();
|
||||
long get_seq_out();
|
||||
|
||||
void setup_ui();
|
||||
QIcon playIcon;
|
||||
|
||||
ResizableScrollBar* horizontal_bar;
|
||||
ViewerContainer* viewer_container;
|
||||
LabelSlider* current_timecode_slider;
|
||||
QLabel* end_timecode;
|
||||
void setup_ui();
|
||||
|
||||
QPushButton* go_to_start_button;
|
||||
QPushButton* prev_frame_button;
|
||||
QPushButton* play_button;
|
||||
QPushButton* next_frame_button;
|
||||
QPushButton* go_to_end_frame;
|
||||
ResizableScrollBar* horizontal_bar;
|
||||
ViewerContainer* viewer_container;
|
||||
LabelSlider* current_timecode_slider;
|
||||
QLabel* end_timecode;
|
||||
|
||||
bool cue_recording_internal;
|
||||
QTimer recording_flasher;
|
||||
QPushButton* go_to_start_button;
|
||||
QPushButton* prev_frame_button;
|
||||
QPushButton* play_button;
|
||||
QPushButton* next_frame_button;
|
||||
QPushButton* go_to_end_frame;
|
||||
|
||||
long previous_playhead;
|
||||
int playback_speed;
|
||||
bool cue_recording_internal;
|
||||
QTimer recording_flasher;
|
||||
|
||||
long previous_playhead;
|
||||
int playback_speed;
|
||||
};
|
||||
|
||||
#endif // VIEWER_H
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "panel.h"
|
||||
|
||||
#include <QEvent>
|
||||
|
||||
Panel::Panel(QWidget *parent) : QDockWidget (parent) {
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
bool Panel::event(QEvent *e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
Retranslate();
|
||||
return true;
|
||||
}
|
||||
return QDockWidget::event(e);
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef PANEL_H
|
||||
#define PANEL_H
|
||||
|
||||
#include <QDockWidget>
|
||||
|
||||
class Panel : public QDockWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Panel(QWidget* parent = nullptr);
|
||||
virtual bool event(QEvent* e) override;
|
||||
protected:
|
||||
virtual void Retranslate() = 0;
|
||||
};
|
||||
|
||||
#endif // PANEL_H
|
||||
+2433
-2433
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user