timeline: show timecode on block items and started copy function
This commit is contained in:
@@ -120,6 +120,26 @@ void TimelinePanel::ToggleLinks()
|
|||||||
static_cast<TimelineWidget*>(GetTimeBasedWidget())->ToggleLinksOnSelected();
|
static_cast<TimelineWidget*>(GetTimeBasedWidget())->ToggleLinksOnSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TimelinePanel::CutSelected()
|
||||||
|
{
|
||||||
|
static_cast<TimelineWidget*>(GetTimeBasedWidget())->CopySelected(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TimelinePanel::CopySelected()
|
||||||
|
{
|
||||||
|
static_cast<TimelineWidget*>(GetTimeBasedWidget())->CopySelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TimelinePanel::Paste()
|
||||||
|
{
|
||||||
|
static_cast<TimelineWidget*>(GetTimeBasedWidget())->Paste(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TimelinePanel::PasteInsert()
|
||||||
|
{
|
||||||
|
static_cast<TimelineWidget*>(GetTimeBasedWidget())->Paste(true);
|
||||||
|
}
|
||||||
|
|
||||||
void TimelinePanel::InsertFootageAtPlayhead(const QList<Footage *> &footage)
|
void TimelinePanel::InsertFootageAtPlayhead(const QList<Footage *> &footage)
|
||||||
{
|
{
|
||||||
static_cast<TimelineWidget*>(GetTimeBasedWidget())->InsertFootageAtPlayhead(footage);
|
static_cast<TimelineWidget*>(GetTimeBasedWidget())->InsertFootageAtPlayhead(footage);
|
||||||
|
|||||||
@@ -63,6 +63,14 @@ public:
|
|||||||
|
|
||||||
virtual void ToggleLinks() override;
|
virtual void ToggleLinks() override;
|
||||||
|
|
||||||
|
virtual void CutSelected() override;
|
||||||
|
|
||||||
|
virtual void CopySelected() override;
|
||||||
|
|
||||||
|
virtual void Paste() override;
|
||||||
|
|
||||||
|
virtual void PasteInsert() override;
|
||||||
|
|
||||||
void InsertFootageAtPlayhead(const QList<Footage *> &footage);
|
void InsertFootageAtPlayhead(const QList<Footage *> &footage);
|
||||||
|
|
||||||
void OverwriteFootageAtPlayhead(const QList<Footage *> &footage);
|
void OverwriteFootageAtPlayhead(const QList<Footage *> &footage);
|
||||||
|
|||||||
@@ -153,6 +153,14 @@ void TimelineWidget::TimebaseChangedEvent(const rational &timebase)
|
|||||||
|
|
||||||
timecode_label_->setVisible(!timebase.isNull());
|
timecode_label_->setVisible(!timebase.isNull());
|
||||||
|
|
||||||
|
QMap<Block*, TimelineViewBlockItem*>::const_iterator iterator;
|
||||||
|
|
||||||
|
for (iterator=block_items_.begin();iterator!=block_items_.end();iterator++) {
|
||||||
|
if (iterator.value()) {
|
||||||
|
iterator.value()->SetTimebase(timebase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (TimelineAndTrackView* view, views_) {
|
foreach (TimelineAndTrackView* view, views_) {
|
||||||
view->view()->SetTimebase(timebase);
|
view->view()->SetTimebase(timebase);
|
||||||
}
|
}
|
||||||
@@ -179,12 +187,10 @@ void TimelineWidget::ScaleChangedEvent(const double &scale)
|
|||||||
{
|
{
|
||||||
TimeBasedWidget::ScaleChangedEvent(scale);
|
TimeBasedWidget::ScaleChangedEvent(scale);
|
||||||
|
|
||||||
QMapIterator<Block*, TimelineViewBlockItem*> iterator(block_items_);
|
QMap<Block*, TimelineViewBlockItem*>::const_iterator iterator;
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
for (iterator=block_items_.begin();iterator!=block_items_.end();iterator++) {
|
||||||
iterator.next();
|
if (iterator.value()) {
|
||||||
|
|
||||||
if (iterator.value() != nullptr) {
|
|
||||||
iterator.value()->SetScale(scale);
|
iterator.value()->SetScale(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -496,6 +502,61 @@ void TimelineWidget::ToggleLinksOnSelected()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TimelineWidget::CopySelected(bool cut)
|
||||||
|
{
|
||||||
|
if (!GetConnectedNode()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<TimelineViewBlockItem*> selected = GetSelectedBlocks();
|
||||||
|
|
||||||
|
if (selected.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<Node*> selected_nodes;
|
||||||
|
|
||||||
|
foreach (TimelineViewBlockItem* item, selected) {
|
||||||
|
Node* block = item->block();
|
||||||
|
|
||||||
|
selected_nodes.append(block);
|
||||||
|
|
||||||
|
QList<Node*> deps = block->GetDependencies();
|
||||||
|
|
||||||
|
foreach (Node* d, deps) {
|
||||||
|
if (!selected_nodes.contains(d)) {
|
||||||
|
selected_nodes.append(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::instance()->CopyNodesToClipboard(selected_nodes);
|
||||||
|
|
||||||
|
if (cut) {
|
||||||
|
DeleteSelected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TimelineWidget::Paste(bool insert)
|
||||||
|
{
|
||||||
|
if (!GetConnectedNode()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<Node*> pasted = Core::instance()->PasteNodesFromClipboard(static_cast<Sequence*>(GetConnectedNode()->parent()));
|
||||||
|
|
||||||
|
if (insert) {
|
||||||
|
// FIXME: Implement this
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Node* n, pasted) {
|
||||||
|
// See if this block is a node and is a top level node
|
||||||
|
if (n->IsBlock() && !n->output()->IsConnected()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QList<TimelineViewBlockItem *> TimelineWidget::GetSelectedBlocks()
|
QList<TimelineViewBlockItem *> TimelineWidget::GetSelectedBlocks()
|
||||||
{
|
{
|
||||||
QList<TimelineViewBlockItem *> list;
|
QList<TimelineViewBlockItem *> list;
|
||||||
@@ -703,6 +764,7 @@ void TimelineWidget::AddBlock(Block *block, TrackReference track)
|
|||||||
item->SetYCoords(GetTrackY(track), GetTrackHeight(track));
|
item->SetYCoords(GetTrackY(track), GetTrackHeight(track));
|
||||||
item->SetScale(GetScale());
|
item->SetScale(GetScale());
|
||||||
item->SetTrack(track);
|
item->SetTrack(track);
|
||||||
|
item->SetTimebase(timebase());
|
||||||
|
|
||||||
// Add to list of clip items that can be iterated through
|
// Add to list of clip items that can be iterated through
|
||||||
block_items_.insert(block, item);
|
block_items_.insert(block, item);
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ public:
|
|||||||
|
|
||||||
void ToggleLinksOnSelected();
|
void ToggleLinksOnSelected();
|
||||||
|
|
||||||
|
void CopySelected(bool cut);
|
||||||
|
|
||||||
|
void Paste(bool insert);
|
||||||
|
|
||||||
QList<TimelineViewBlockItem*> GetSelectedBlocks();
|
QList<TimelineViewBlockItem*> GetSelectedBlocks();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "common/qtutils.h"
|
#include "common/qtutils.h"
|
||||||
#include "config/config.h"
|
#include "config/config.h"
|
||||||
|
#include "core.h"
|
||||||
#include "node/block/transition/transition.h"
|
#include "node/block/transition/transition.h"
|
||||||
#include "widget/viewer/audiowaveformview.h"
|
#include "widget/viewer/audiowaveformview.h"
|
||||||
|
|
||||||
@@ -63,13 +64,13 @@ void TimelineViewBlockItem::UpdateRect()
|
|||||||
setPos(item_left, 0.0);
|
setPos(item_left, 0.0);
|
||||||
|
|
||||||
setToolTip(QCoreApplication::translate("TimelineViewBlockItem",
|
setToolTip(QCoreApplication::translate("TimelineViewBlockItem",
|
||||||
"%1\n\nIn: %2\nOut: %3\nMedia In: %4").arg(block_->Name(),
|
"%1\n\nIn: %2\nOut: %3\nLength: %4").arg(block_->Name(),
|
||||||
QString::number(block_->in().toDouble()),
|
Timecode::time_to_timecode(block_->in(), timebase(), Core::instance()->GetTimecodeDisplay()),
|
||||||
QString::number(block_->out().toDouble()),
|
Timecode::time_to_timecode(block_->out(), timebase(), Core::instance()->GetTimecodeDisplay()),
|
||||||
QString::number(block_->media_in().toDouble())));
|
Timecode::time_to_timecode(block_->out() - block_->in(), timebase(), Core::instance()->GetTimecodeDisplay())));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimelineViewBlockItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void TimelineViewBlockItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget */*widget*/)
|
||||||
{
|
{
|
||||||
switch (block_->type()) {
|
switch (block_->type()) {
|
||||||
case Block::kClip:
|
case Block::kClip:
|
||||||
|
|||||||
@@ -52,3 +52,10 @@ void TimelineViewRect::ScaleChangedEvent(const double &scale)
|
|||||||
|
|
||||||
UpdateRect();
|
UpdateRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TimelineViewRect::TimebaseChangedEvent(const rational &tb)
|
||||||
|
{
|
||||||
|
TimelineScaledObject::TimebaseChangedEvent(tb);
|
||||||
|
|
||||||
|
UpdateRect();
|
||||||
|
}
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void ScaleChangedEvent(const double &) override;
|
virtual void ScaleChangedEvent(const double &) override;
|
||||||
|
|
||||||
|
virtual void TimebaseChangedEvent(const rational&) override;
|
||||||
|
|
||||||
int y_;
|
int y_;
|
||||||
|
|
||||||
int height_;
|
int height_;
|
||||||
|
|||||||
Reference in New Issue
Block a user