sequence duplication for #97

This commit is contained in:
itsmattkc
2018-07-04 01:21:32 +01:00
parent b3d1199fd3
commit d7a891fdd6
13 changed files with 74 additions and 3 deletions
+4
View File
@@ -11,3 +11,7 @@ void CrossDissolveTransition::process_transition(float progress) {
glGetFloatv(GL_CURRENT_COLOR, color);
glColor4f(1.0, 1.0, 1.0, color[3]*progress);
}
Transition* CrossDissolveTransition::copy() {
return new CrossDissolveTransition();
}
+4
View File
@@ -4,4 +4,8 @@ Transition::Transition() {
length = 30;
}
Transition* Transition::copy() {
return new Transition();
}
void Transition::process_transition(float) {}
+2
View File
@@ -10,12 +10,14 @@ public:
int length;
QString name;
virtual void process_transition(float);
virtual Transition* copy();
};
class CrossDissolveTransition : public Transition {
public:
CrossDissolveTransition();
void process_transition(float);
Transition* copy();
};
#endif // TRANSITION_H
+6
View File
@@ -504,3 +504,9 @@ void MainWindow::on_actionEdit_Tool_Selects_Links_triggered() {
void MainWindow::on_actionEdit_Tool_Also_Seeks_triggered() {
panel_timeline->edit_tool_also_seeks = !panel_timeline->edit_tool_also_seeks;
}
void MainWindow::on_actionDuplicate_triggered() {
if (panel_project->is_focused()) {
panel_project->duplicate_selected();
}
}
+2
View File
@@ -129,6 +129,8 @@ private slots:
void toolMenu_About_To_Be_Shown();
void on_actionDuplicate_triggered();
private:
Ui::MainWindow *ui;
void setup_layout();
+9
View File
@@ -60,6 +60,7 @@
<addaction name="actionCu_t"/>
<addaction name="actionCop_y"/>
<addaction name="action_Paste"/>
<addaction name="actionDuplicate"/>
<addaction name="actionDelete"/>
<addaction name="actionRipple_Delete"/>
<addaction name="separator"/>
@@ -529,6 +530,14 @@
<string>Edit Tool Selects Links</string>
</property>
</action>
<action name="actionDuplicate">
<property name="text">
<string>Duplicate</string>
</property>
<property name="shortcut">
<string>Ctrl+D</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
+13
View File
@@ -71,6 +71,19 @@ QString Project::get_next_sequence_name() {
void Project::rename_media(QTreeWidgetItem* item, int column) {
Media* m = get_media_from_tree(item);
m->name = item->text(column);
if (m->type == MEDIA_TYPE_SEQUENCE) {
m->sequence->name = m->name;
}
}
void Project::duplicate_selected() {
QList<QTreeWidgetItem*> items = ui->treeWidget->selectedItems();
for (int i=0;i<items.size();i++) {
Media* m = get_media_from_tree(items.at(i));
if (m->type == MEDIA_TYPE_SEQUENCE) {
new_sequence(m->sequence->copy());
}
}
}
void Project::new_sequence(Sequence *s) {
+1
View File
@@ -34,6 +34,7 @@ public:
void delete_media(QTreeWidgetItem* item);
void delete_selected_media();
void process_file_list(QStringList& files);
void duplicate_selected();
void new_project();
void load_project();
+4
View File
@@ -1,6 +1,7 @@
#include "clip.h"
#include "project/effect.h"
#include "effects/transition.h"
#include "io/media.h"
#include "playback/playback.h"
#include "playback/cacher.h"
@@ -46,6 +47,9 @@ Clip* Clip::copy() {
copy->effects.append(effects.at(i)->copy(copy));
}
if (opening_transition != NULL) copy->opening_transition = opening_transition->copy();
if (closing_transition != NULL) copy->closing_transition = closing_transition->copy();
return copy;
}
+19
View File
@@ -17,6 +17,25 @@ Sequence::~Sequence() {
}
}
Sequence* Sequence::copy() {
Sequence* s = new Sequence();
s->name = name + " (copy)";
s->width = width;
s->height = height;
s->frame_rate = frame_rate;
s->audio_frequency = audio_frequency;
s->audio_layout = audio_layout;
for (int i=0;i<clip_count();i++) {
Clip* c = get_clip(i);
if (c != NULL) {
Clip* copy = c->copy();
copy->linked = c->linked;
s->add_clip(copy);
}
}
return s;
}
void Sequence::add_clip(Clip* c) {
c->id = clip_count();
clips.append(c);
+1
View File
@@ -11,6 +11,7 @@ struct Sequence {
public:
Sequence();
~Sequence();
Sequence* copy();
QString name;
void add_clip(Clip* c);
int clip_count();
+8 -3
View File
@@ -18,12 +18,17 @@ SourceTable::SourceTable(QWidget* parent) : QTreeWidget(parent) {
rename_timer.setInterval(500);
connect(&rename_timer, SIGNAL(timeout()), this, SLOT(rename_interval()));
connect(this, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(item_click(QTreeWidgetItem*,int)));
// connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(stop_rename_timer()));
// connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, )
}
void SourceTable::rename_interval() {
void SourceTable::stop_rename_timer() {
rename_timer.stop();
}
void SourceTable::rename_interval() {
stop_rename_timer();
if (hasFocus() && editing_item != NULL) {
editItem(editing_item, 0);
}
@@ -36,7 +41,7 @@ void SourceTable::item_click(QTreeWidgetItem* item, int column) {
}
void SourceTable::mousePressEvent(QMouseEvent* event) {
rename_timer.stop();
stop_rename_timer();
QTreeWidget::mousePressEvent(event);
}
@@ -49,7 +54,7 @@ void SourceTable::mouseDoubleClickEvent(QMouseEvent* ) {
if (m->type == MEDIA_TYPE_SEQUENCE) {
set_sequence(m->sequence);
}
}
}
}
void SourceTable::dragEnterEvent(QDragEnterEvent *event) {
+1
View File
@@ -23,6 +23,7 @@ private:
private slots:
void rename_interval();
void item_click(QTreeWidgetItem* item, int column);
void stop_rename_timer();
};
#endif // SOURCETABLE_H