nicer effects panel, improved split selection
This commit is contained in:
+49
-13
@@ -14,6 +14,7 @@
|
||||
#include "project/sequence.h"
|
||||
#include "project/undo.h"
|
||||
#include "panels/project.h"
|
||||
#include "panels/timeline.h"
|
||||
|
||||
EffectControls::EffectControls(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
@@ -33,26 +34,51 @@ EffectControls::~EffectControls()
|
||||
void EffectControls::menu_select(QAction* q) {
|
||||
TimelineAction* ta = new TimelineAction();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
if ((sequence->get_clip(selected_clips.at(i))->track < 0) == video_menu) {
|
||||
ta->add_effect(sequence, selected_clips.at(i), q->data().toInt());
|
||||
Clip* c = sequence->get_clip(selected_clips.at(i));
|
||||
if (c->track < 0 == video_menu) {
|
||||
if (transition_menu) {
|
||||
if (c->opening_transition == NULL) {
|
||||
ta->add_transition(sequence, selected_clips.at(i), q->data().toInt(), TA_OPENING_TRANSITION);
|
||||
}
|
||||
if (c->closing_transition == NULL) {
|
||||
ta->add_transition(sequence, selected_clips.at(i), q->data().toInt(), TA_CLOSING_TRANSITION);
|
||||
}
|
||||
} else {
|
||||
ta->add_effect(sequence, selected_clips.at(i), q->data().toInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
undo_stack.push(ta);
|
||||
reload_clips();
|
||||
if (transition_menu) {
|
||||
panel_timeline->redraw_all_clips(true);
|
||||
} else {
|
||||
reload_clips();
|
||||
}
|
||||
}
|
||||
|
||||
void EffectControls::show_menu(bool video) {
|
||||
void EffectControls::show_effect_menu(bool video, bool transitions) {
|
||||
video_menu = video;
|
||||
transition_menu = transitions;
|
||||
|
||||
int lim;
|
||||
QVector<QString>* effect_names;
|
||||
if (video) {
|
||||
lim = VIDEO_EFFECT_COUNT;
|
||||
effect_names = &video_effect_names;
|
||||
} else {
|
||||
lim = AUDIO_EFFECT_COUNT;
|
||||
effect_names = &audio_effect_names;
|
||||
}
|
||||
if (transitions) {
|
||||
if (video) {
|
||||
lim = VIDEO_TRANSITION_COUNT;
|
||||
effect_names = &video_transition_names;
|
||||
} else {
|
||||
lim = AUDIO_TRANSITION_COUNT;
|
||||
effect_names = &audio_transition_names;
|
||||
}
|
||||
} else {
|
||||
if (video) {
|
||||
lim = VIDEO_EFFECT_COUNT;
|
||||
effect_names = &video_effect_names;
|
||||
} else {
|
||||
lim = AUDIO_EFFECT_COUNT;
|
||||
effect_names = &audio_effect_names;
|
||||
}
|
||||
}
|
||||
|
||||
QMenu effects_menu(this);
|
||||
|
||||
@@ -168,12 +194,22 @@ void EffectControls::set_clips(QVector<int>& clips) {
|
||||
|
||||
void EffectControls::on_add_video_effect_button_clicked()
|
||||
{
|
||||
show_menu(true);
|
||||
show_effect_menu(true, false);
|
||||
}
|
||||
|
||||
void EffectControls::on_add_audio_effect_button_clicked()
|
||||
{
|
||||
show_menu(false);
|
||||
show_effect_menu(false, false);
|
||||
}
|
||||
|
||||
void EffectControls::on_add_video_transition_button_clicked()
|
||||
{
|
||||
show_effect_menu(true, true);
|
||||
}
|
||||
|
||||
void EffectControls::on_add_audio_transition_button_clicked()
|
||||
{
|
||||
show_effect_menu(false, true);
|
||||
}
|
||||
|
||||
bool EffectControls::is_focused() {
|
||||
|
||||
@@ -19,7 +19,6 @@ class EffectControls : public QDockWidget
|
||||
public:
|
||||
explicit EffectControls(QWidget *parent = 0);
|
||||
~EffectControls();
|
||||
// void set_clip(Clip* c);
|
||||
void set_clips(QVector<int>& clips);
|
||||
void clear_effects(bool clear_cache);
|
||||
void delete_effects();
|
||||
@@ -28,20 +27,22 @@ public:
|
||||
|
||||
private slots:
|
||||
void menu_select(QAction* q);
|
||||
|
||||
void on_add_video_effect_button_clicked();
|
||||
|
||||
void on_add_audio_effect_button_clicked();
|
||||
void deselect_all_effects(QWidget*);
|
||||
|
||||
void deselect_all_effects(QWidget*);
|
||||
void on_add_video_transition_button_clicked();
|
||||
|
||||
void on_add_audio_transition_button_clicked();
|
||||
|
||||
private:
|
||||
Ui::EffectControls *ui;
|
||||
QVector<int> selected_clips;
|
||||
void show_menu(bool video);
|
||||
void show_effect_menu(bool video, bool transitions);
|
||||
void load_effects();
|
||||
|
||||
bool video_menu;
|
||||
bool transition_menu;
|
||||
};
|
||||
|
||||
/*class EffectAddCommand : public QUndoCommand {
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<widget class="QPushButton" name="add_video_transition_button">
|
||||
<property name="toolTip">
|
||||
<string>Add Video Transition</string>
|
||||
</property>
|
||||
@@ -318,7 +318,7 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<widget class="QPushButton" name="add_audio_transition_button">
|
||||
<property name="toolTip">
|
||||
<string>Add Audio Transition</string>
|
||||
</property>
|
||||
|
||||
+19
-4
@@ -50,7 +50,7 @@ Timeline::Timeline(QWidget *parent) :
|
||||
ui(new Ui::Timeline),
|
||||
last_frame(0)
|
||||
{
|
||||
default_track_height = (QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96) * default_track_height;
|
||||
default_track_height = (QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96) * TRACK_DEFAULT_HEIGHT;
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -215,7 +215,7 @@ int Timeline::calculate_track_height(int track, int value) {
|
||||
int index = (track < 0) ? qAbs(track + 1) : track;
|
||||
QVector<int>& vector = (track < 0) ? video_track_heights : audio_track_heights;
|
||||
while (vector.size() < index+1) {
|
||||
vector.append(TRACK_DEFAULT_HEIGHT);
|
||||
vector.append(default_track_height);
|
||||
}
|
||||
if (value > -1) {
|
||||
vector[index] = value;
|
||||
@@ -837,19 +837,34 @@ bool Timeline::split_selection(TimelineAction* ta) {
|
||||
for (int i=0;i<selections.size();i++) {
|
||||
const Selection& s = selections.at(i);
|
||||
if (s.track == clip->track) {
|
||||
if (clip->timeline_in < s.in && clip->timeline_out > s.out) {
|
||||
if (clip->timeline_in < s.in && clip->timeline_out > s.out) {
|
||||
Clip* split_A = clip->copy(sequence);
|
||||
split_A->clip_in += (s.in - clip->timeline_in);
|
||||
split_A->timeline_in = s.in;
|
||||
split_A->timeline_out = s.out;
|
||||
pre_splits.append(j);
|
||||
post_splits.append(split_A);
|
||||
post_splits.append(split_A);
|
||||
|
||||
Clip* split_B = clip->copy(sequence);
|
||||
split_B->clip_in += (s.out - clip->timeline_in);
|
||||
split_B->timeline_in = s.out;
|
||||
secondary_post_splits.append(split_B);
|
||||
|
||||
if (clip->opening_transition != NULL) {
|
||||
delete split_B->opening_transition;
|
||||
split_B->opening_transition = NULL;
|
||||
|
||||
delete split_A->opening_transition;
|
||||
split_A->opening_transition = NULL;
|
||||
}
|
||||
|
||||
if (clip->closing_transition != NULL) {
|
||||
ta->delete_transition(sequence, j, TA_CLOSING_TRANSITION);
|
||||
|
||||
delete split_A->closing_transition;
|
||||
split_A->closing_transition = NULL;
|
||||
}
|
||||
|
||||
ta->set_timeline_out(sequence, j, s.in);
|
||||
split = true;
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -2,6 +2,7 @@
|
||||
#define TIMELINE_H
|
||||
|
||||
#include "ui/timelinetools.h"
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QVector>
|
||||
#include <QTime>
|
||||
@@ -68,7 +69,6 @@ class Timeline;
|
||||
class Timeline : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Timeline(QWidget *parent = 0);
|
||||
~Timeline();
|
||||
|
||||
+12
-6
@@ -33,7 +33,7 @@
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -272,7 +272,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>819</width>
|
||||
<height>551</height>
|
||||
<height>557</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
@@ -309,6 +309,12 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="opaqueResize">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QScrollArea" name="videoScrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
@@ -327,8 +333,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>802</width>
|
||||
<height>266</height>
|
||||
<width>805</width>
|
||||
<height>269</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@@ -378,8 +384,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>802</width>
|
||||
<height>265</height>
|
||||
<width>805</width>
|
||||
<height>269</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
|
||||
Reference in New Issue
Block a user