don't use shared ptrs for project items
This commit is contained in:
@@ -38,7 +38,7 @@ FootageComboBox::FootageComboBox(QWidget *parent) :
|
||||
|
||||
void FootageComboBox::showPopup()
|
||||
{
|
||||
if (root_ == nullptr || root_->child_count() == 0) {
|
||||
if (root_ == nullptr || root_->item_child_count() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,10 +82,9 @@ void FootageComboBox::SetFootage(StreamPtr f)
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m)
|
||||
void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m) const
|
||||
{
|
||||
for (int i=0;i<f->child_count();i++) {
|
||||
Item* child = f->child(i);
|
||||
foreach (Item* child, f->children()) {
|
||||
|
||||
if (child->CanHaveChildren()) {
|
||||
|
||||
@@ -108,7 +107,9 @@ void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m)
|
||||
stream_action->setIcon(stream->icon());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ signals:
|
||||
void FootageChanged(StreamPtr f);
|
||||
|
||||
private:
|
||||
void TraverseFolder(const Folder *f, QMenu* m);
|
||||
void TraverseFolder(const Folder *f, QMenu* m) const;
|
||||
|
||||
void UpdateText();
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ QVector<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QU
|
||||
// Connect footage to existing footage if it exists
|
||||
if (!xml_node_data.footage_connections.isEmpty()) {
|
||||
// Get list of all footage from project
|
||||
QList<ItemPtr> footage = graph->project()->get_items_of_type(Item::kFootage);
|
||||
QVector<Item*> footage = graph->project()->get_items_of_type(Item::kFootage);
|
||||
|
||||
if (!footage.isEmpty()) {
|
||||
foreach (const XMLNodeData::FootageConnection& con, xml_node_data.footage_connections) {
|
||||
@@ -145,8 +145,8 @@ QVector<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QU
|
||||
|
||||
bool found = false;
|
||||
|
||||
foreach (ItemPtr item, footage) {
|
||||
const QList<StreamPtr>& streams = std::static_pointer_cast<Footage>(item)->streams();
|
||||
foreach (Item* item, footage) {
|
||||
const QList<StreamPtr>& streams = static_cast<Footage*>(item)->streams();
|
||||
|
||||
foreach (StreamPtr s, streams) {
|
||||
if (s.get() == loaded_stream) {
|
||||
|
||||
@@ -324,15 +324,15 @@ void ProjectExplorer::ShowContextMenu()
|
||||
Menu* proxy_menu = new Menu(tr("Pre-Cache"), &menu);
|
||||
menu.addMenu(proxy_menu);
|
||||
|
||||
QList<ItemPtr> sequences = project()->get_items_of_type(Item::kSequence);
|
||||
QVector<Item*> sequences = project()->get_items_of_type(Item::kSequence);
|
||||
|
||||
if (sequences.isEmpty()) {
|
||||
QAction* a = proxy_menu->addAction(tr("No sequences exist in project"));
|
||||
a->setEnabled(false);
|
||||
} else {
|
||||
foreach (ItemPtr i, sequences) {
|
||||
foreach (Item* i, sequences) {
|
||||
QAction* a = proxy_menu->addAction(tr("For \"%1\"").arg(i->name()));
|
||||
a->setData(Node::PtrToValue(i.get()));
|
||||
a->setData(Node::PtrToValue(i));
|
||||
}
|
||||
|
||||
connect(proxy_menu, &Menu::triggered, this, &ProjectExplorer::ContextMenuStartProxy);
|
||||
@@ -501,7 +501,7 @@ Folder *ProjectExplorer::GetSelectedFolder() const
|
||||
|
||||
// If this item is not a folder, presumably it's parent is
|
||||
if (!sel_item->CanHaveChildren()) {
|
||||
sel_item = sel_item->parent();
|
||||
sel_item = sel_item->item_parent();
|
||||
|
||||
Q_ASSERT(sel_item->CanHaveChildren());
|
||||
}
|
||||
@@ -545,11 +545,11 @@ QList<MediaInput *> ProjectExplorer::GetMediaNodesUsingFootage(Footage *item)
|
||||
QList<MediaInput *> list;
|
||||
|
||||
// Get all sequences.
|
||||
QList<ItemPtr> sequences = model_.project()->get_items_of_type(Item::kSequence);
|
||||
QVector<Item*> sequences = model_.project()->get_items_of_type(Item::kSequence);
|
||||
|
||||
// Footage can contain multiple streams, all of which need to be dealt with
|
||||
foreach (ItemPtr s, sequences) {
|
||||
const QList<Node*>& nodes = static_cast<Sequence*>(s.get())->nodes();
|
||||
foreach (Item* s, sequences) {
|
||||
const QList<Node*>& nodes = static_cast<Sequence*>(s)->nodes();
|
||||
foreach (Node* n, nodes) {
|
||||
if (n->IsMedia()) {
|
||||
MediaInput* media_node = static_cast<MediaInput*>(n);
|
||||
@@ -677,7 +677,7 @@ void ProjectExplorer::DeleteSelected()
|
||||
break;
|
||||
}
|
||||
|
||||
new ProjectViewModel::RemoveItemCommand(&model_, item->get_shared_ptr(), command);
|
||||
new ProjectViewModel::RemoveItemCommand(&model_, item, command);
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
|
||||
@@ -353,7 +353,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
Project* active_project = Core::instance()->GetActiveProject();
|
||||
|
||||
if (active_project) {
|
||||
SequencePtr new_sequence = Core::instance()->CreateNewSequenceForProject(active_project);
|
||||
Sequence* new_sequence = Core::instance()->CreateNewSequenceForProject(active_project);
|
||||
|
||||
new_sequence->set_default_parameters();
|
||||
|
||||
@@ -371,7 +371,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
|
||||
} else {
|
||||
|
||||
SequenceDialog sd(new_sequence.get(), SequenceDialog::kNew, parent());
|
||||
SequenceDialog sd(new_sequence, SequenceDialog::kNew, parent());
|
||||
sd.SetUndoable(false);
|
||||
|
||||
if (sd.exec() != QDialog::Accepted) {
|
||||
@@ -390,11 +390,15 @@ void ImportTool::DropGhosts(bool insert)
|
||||
|
||||
FootageToGhosts(0, dragged_footage_, new_sequence->video_params().time_base(), 0);
|
||||
|
||||
dst_graph = new_sequence.get();
|
||||
dst_graph = new_sequence;
|
||||
viewer_node = new_sequence->viewer_output();
|
||||
|
||||
// Set this as the sequence to open
|
||||
open_sequence = new_sequence.get();
|
||||
open_sequence = new_sequence;
|
||||
} else {
|
||||
// If the sequence is valid, ownership is passed to AddItemCommand.
|
||||
// Otherwise, we're responsible for deleting it.
|
||||
delete new_sequence;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user