cleanup and included closing footage viewer if footage is in use
This commit is contained in:
@@ -604,41 +604,4 @@ void ProjectViewModel::RemoveItemCommand::undo_internal()
|
||||
model_->AddChild(parent_, item_);
|
||||
}
|
||||
|
||||
ProjectViewModel::OfflineFootageCommand::OfflineFootageCommand(ProjectViewModel* model, ItemPtr item,
|
||||
QMap<Node*, StreamPtr> nodes, QUndoCommand* parent) :
|
||||
UndoCommand(parent),
|
||||
model_(model),
|
||||
item_(item),
|
||||
nodes_(nodes)
|
||||
{
|
||||
}
|
||||
|
||||
Project *ProjectViewModel::OfflineFootageCommand::GetRelevantProject() const
|
||||
{
|
||||
return model_->project();
|
||||
}
|
||||
|
||||
void ProjectViewModel::OfflineFootageCommand::redo_internal()
|
||||
{
|
||||
QMap<Node *, StreamPtr>::const_iterator it = nodes_.constBegin();
|
||||
while (it != nodes_.constEnd()) {
|
||||
static_cast<MediaInput *>(it.key())->SetFootage(nullptr);
|
||||
++it;
|
||||
}
|
||||
|
||||
parent_ = item_->parent();
|
||||
model_->RemoveChild(parent_, item_.get());
|
||||
}
|
||||
|
||||
void ProjectViewModel::OfflineFootageCommand::undo_internal()
|
||||
{
|
||||
model_->AddChild(parent_, item_);
|
||||
|
||||
QMap<Node *, StreamPtr>::const_iterator it = nodes_.constBegin();
|
||||
while (it != nodes_.constEnd()) {
|
||||
static_cast<MediaInput *>(it.key())->SetFootage(it.value());
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -195,30 +195,6 @@ public:
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief An undo command for offlining footage when it is deleted from the project explorer
|
||||
*/
|
||||
class OfflineFootageCommand : public UndoCommand {
|
||||
public:
|
||||
OfflineFootageCommand(ProjectViewModel* model, ItemPtr item, QMap<Node*, StreamPtr> nodes, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
protected:
|
||||
virtual void redo_internal() override;
|
||||
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
ProjectViewModel* model_;
|
||||
|
||||
ItemPtr item_;
|
||||
|
||||
Item* parent_;
|
||||
|
||||
QMap<Node*, StreamPtr> nodes_;
|
||||
};
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Retrieve the index of `item` in its parent
|
||||
|
||||
Reference in New Issue
Block a user