switched many QLists for QVectors

Minor optimization
This commit is contained in:
itsmattkc
2020-11-16 16:17:43 +11:00
parent a0fb1981b4
commit 1b9bf6d92c
80 changed files with 273 additions and 281 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ void CurveView::ConnectInput(NodeInput *input)
void CurveView::DisconnectNode(Node *node)
{
QList<NodeInput*> inputs = node->GetInputsIncludingArrays();
QVector<NodeInput*> inputs = node->GetInputsIncludingArrays();
foreach (NodeInput* i, inputs) {
DisconnectInput(i);
+2 -2
View File
@@ -131,7 +131,7 @@ void CurveWidget::DeleteSelected()
view_->DeleteSelected();
}
void CurveWidget::SetNodes(const QList<Node *> &nodes)
void CurveWidget::SetNodes(const QVector<Node *> &nodes)
{
tree_view_->SetNodes(nodes);
@@ -216,7 +216,7 @@ void CurveWidget::UpdateBridgeTime(const int64_t &timestamp)
void CurveWidget::ConnectNode(Node *n)
{
QList<NodeInput*> inputs = n->GetInputsIncludingArrays();
QVector<NodeInput*> inputs = n->GetInputsIncludingArrays();
foreach (NodeInput* i, inputs) {
if (tree_view_->IsInputEnabled(i)) {
+2 -4
View File
@@ -49,7 +49,7 @@ public:
void DeleteSelected();
public slots:
void SetNodes(const QList<Node*>& nodes);
void SetNodes(const QVector<Node *> &nodes);
protected:
virtual void TimeChangedEvent(const int64_t &) override;
@@ -85,9 +85,7 @@ private:
NodeParamViewKeyframeControl* key_control_;
QList<QCheckBox*> checkboxes_;
QList<Node*> nodes_;
QVector<Node*> nodes_;
private slots:
void SelectionChanged();
+1 -1
View File
@@ -76,7 +76,7 @@ void KeyframeViewBase::DeleteSelected()
void KeyframeViewBase::RemoveKeyframesOfNode(Node *n)
{
QList<NodeInput*> inputs = n->GetInputsIncludingArrays();
QVector<NodeInput*> inputs = n->GetInputsIncludingArrays();
foreach (NodeInput* i, inputs) {
RemoveKeyframesOfInput(i);
+6 -6
View File
@@ -29,7 +29,7 @@
OLIVE_NAMESPACE_ENTER
void NodeCopyPasteWidget::CopyNodesToClipboard(const QList<Node *> &nodes, void *userdata)
void NodeCopyPasteWidget::CopyNodesToClipboard(const QVector<Node *> &nodes, void *userdata)
{
QString copy_str;
@@ -56,17 +56,17 @@ void NodeCopyPasteWidget::CopyNodesToClipboard(const QList<Node *> &nodes, void
Core::CopyStringToClipboard(copy_str);
}
QList<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QUndoCommand* command, void *userdata)
QVector<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QUndoCommand* command, void *userdata)
{
QString clipboard = Core::PasteStringFromClipboard();
if (clipboard.isEmpty()) {
return QList<Node*>();
return QVector<Node*>();
}
QXmlStreamReader reader(clipboard);
QList<Node*> pasted_nodes;
QVector<Node*> pasted_nodes;
XMLNodeData xml_node_data;
while (XMLReadNextStartElement(&reader)) {
@@ -100,7 +100,7 @@ QList<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QUnd
if (pasted_nodes.isEmpty()) {
// If we passed through the whole string and there were no nodes, it must not be data for us after all
return QList<Node*>();
return QVector<Node*>();
}
// If we have some nodes AND the XML data was malformed, the user should probably know
@@ -116,7 +116,7 @@ QList<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QUnd
QCoreApplication::translate("NodeCopyPasteWidget", "Failed to paste nodes: %1").arg(reader.errorString()),
QMessageBox::Ok);
return QList<Node*>();
return QVector<Node*>();
}
// Add all nodes to graph
+2 -2
View File
@@ -35,9 +35,9 @@ public:
NodeCopyPasteWidget() = default;
protected:
void CopyNodesToClipboard(const QList<Node*>& nodes, void* userdata = nullptr);
void CopyNodesToClipboard(const QVector<Node *> &nodes, void* userdata = nullptr);
QList<Node*> PasteNodesFromClipboard(Sequence *graph, QUndoCommand *command, void* userdata = nullptr);
QVector<Node*> PasteNodesFromClipboard(Sequence *graph, QUndoCommand *command, void* userdata = nullptr);
virtual void CopyNodesToClipboardInternal(QXmlStreamWriter *writer, void* userdata);
+4 -4
View File
@@ -135,7 +135,7 @@ NodeParamView::NodeParamView(QWidget *parent) :
&NodeParamView::FocusChanged);
}
void NodeParamView::SelectNodes(const QList<Node *> &nodes)
void NodeParamView::SelectNodes(const QVector<Node *> &nodes)
{
active_nodes_.append(nodes);
@@ -185,7 +185,7 @@ void NodeParamView::SelectNodes(const QList<Node *> &nodes)
}
}
void NodeParamView::DeselectNodes(const QList<Node *> &nodes)
void NodeParamView::DeselectNodes(const QVector<Node *> &nodes)
{
// Remove item from map and delete the widget
bool changes_made = false;
@@ -283,8 +283,8 @@ void NodeParamView::QueueKeyframePositionUpdate()
void NodeParamView::SignalNodeOrder()
{
// Sort by item Y (apparently there's no way in Qt to get the order of dock widgets)
QList<Node*> nodes;
QList<int> item_ys;
QVector<Node*> nodes;
QVector<int> item_ys;
for (auto it=items_.cbegin(); it!=items_.cend(); it++) {
int item_y = it.value()->pos().y();
+6 -6
View File
@@ -60,8 +60,8 @@ class NodeParamView : public TimeBasedWidget
public:
NodeParamView(QWidget* parent = nullptr);
void SelectNodes(const QList<Node*>& nodes);
void DeselectNodes(const QList<Node*>& nodes);
void SelectNodes(const QVector<Node *> &nodes);
void DeselectNodes(const QVector<Node*>& nodes);
const QMap<Node*, NodeParamViewItem*>& GetItemMap() const
{
@@ -75,9 +75,9 @@ public:
signals:
void InputDoubleClicked(NodeInput* input);
void RequestSelectNode(const QList<Node*>& target);
void RequestSelectNode(const QVector<Node*>& target);
void NodeOrderChanged(const QList<Node*>& nodes);
void NodeOrderChanged(const QVector<Node*>& nodes);
void FocusedNodeChanged(Node* n);
@@ -113,9 +113,9 @@ private:
// docking windows
QMainWindow* param_widget_area_;
QList<Node*> pinned_nodes_;
QVector<Node*> pinned_nodes_;
QList<Node*> active_nodes_;
QVector<Node*> active_nodes_;
QMap<Node*, bool> node_expanded_state_;
+2 -2
View File
@@ -91,7 +91,7 @@ signals:
void InputDoubleClicked(NodeInput* input);
void RequestSelectNode(const QList<Node*>& node);
void RequestSelectNode(const QVector<Node*>& node);
private:
void UpdateUIForEdgeConnection(NodeInput* input);
@@ -161,7 +161,7 @@ signals:
void InputDoubleClicked(NodeInput* input);
void RequestSelectNode(const QList<Node*>& node);
void RequestSelectNode(const QVector<Node*>& node);
void PinToggled(bool e);
+2 -2
View File
@@ -40,7 +40,7 @@ NodeTableView::NodeTableView(QWidget* parent) :
tr("A/W")});
}
void NodeTableView::SelectNodes(const QList<Node *> &nodes)
void NodeTableView::SelectNodes(const QVector<Node *> &nodes)
{
foreach (Node* n, nodes) {
QTreeWidgetItem* top_item = new QTreeWidgetItem();
@@ -53,7 +53,7 @@ void NodeTableView::SelectNodes(const QList<Node *> &nodes)
SetTime(last_time_);
}
void NodeTableView::DeselectNodes(const QList<Node *> &nodes)
void NodeTableView::DeselectNodes(const QVector<Node *> &nodes)
{
foreach (Node* n, nodes) {
delete top_level_item_map_.take(n);
+2 -2
View File
@@ -32,9 +32,9 @@ class NodeTableView : public QTreeWidget
public:
NodeTableView(QWidget* parent = nullptr);
void SelectNodes(const QList<Node*>& nodes);
void SelectNodes(const QVector<Node *> &nodes);
void DeselectNodes(const QList<Node*>& nodes);
void DeselectNodes(const QVector<Node*>& nodes);
void SetTime(const rational& time);
+2 -2
View File
@@ -31,12 +31,12 @@ class NodeTableWidget : public TimeBasedWidget
public:
NodeTableWidget(QWidget* parent = nullptr);
void SelectNodes(const QList<Node*>& nodes)
void SelectNodes(const QVector<Node*>& nodes)
{
view_->SelectNodes(nodes);
}
void DeselectNodes(const QList<Node*>& nodes)
void DeselectNodes(const QVector<Node*>& nodes)
{
view_->DeselectNodes(nodes);
}
+2 -2
View File
@@ -21,7 +21,7 @@ bool NodeTreeView::IsInputEnabled(NodeInput *i) const
return !disabled_inputs_.contains(i);
}
void NodeTreeView::SetNodes(const QList<Node *> &nodes)
void NodeTreeView::SetNodes(const QVector<Node *> &nodes)
{
nodes_ = nodes;
@@ -34,7 +34,7 @@ void NodeTreeView::SetNodes(const QList<Node *> &nodes)
node_item->setData(0, kItemType, kItemTypeNode);
node_item->setData(0, kItemPointer, reinterpret_cast<quintptr>(n));
QList<NodeInput*> inputs = n->GetInputsIncludingArrays();
QVector<NodeInput*> inputs = n->GetInputsIncludingArrays();
foreach (NodeInput* i, inputs) {
if (only_show_keyframable_ && !i->is_keyframable()) {
continue;
+4 -4
View File
@@ -23,7 +23,7 @@ public:
}
public slots:
void SetNodes(const QList<Node*>& nodes);
void SetNodes(const QVector<Node *> &nodes);
signals:
void NodeEnableChanged(Node* n, bool e);
@@ -44,11 +44,11 @@ private:
static const int kItemType = Qt::UserRole;
static const int kItemPointer = Qt::UserRole + 1;
QList<Node*> nodes_;
QVector<Node*> nodes_;
QList<Node*> disabled_nodes_;
QVector<Node*> disabled_nodes_;
QList<NodeInput*> disabled_inputs_;
QVector<NodeInput*> disabled_inputs_;
bool only_show_keyframable_;
+26 -27
View File
@@ -115,7 +115,7 @@ void NodeView::DeleteSelected()
QUndoCommand* command = new QUndoCommand();
{
QList<NodeEdge*> selected_edges = scene_.GetSelectedEdges();
QVector<NodeEdge*> selected_edges = scene_.GetSelectedEdges();
foreach (NodeEdge* edge, selected_edges) {
new NodeEdgeRemoveCommand(edge->output(), edge->input(), command);
@@ -124,7 +124,7 @@ void NodeView::DeleteSelected()
}
{
QList<Node*> selected_nodes = scene_.GetSelectedNodes();
QVector<Node*> selected_nodes = scene_.GetSelectedNodes();
// Ensure no nodes are "undeletable"
for (int i=0;i<selected_nodes.size();i++) {
@@ -166,7 +166,7 @@ void NodeView::DeselectAll()
SceneSelectionChangedSlot();
}
void NodeView::Select(const QList<Node *> &nodes)
void NodeView::Select(const QVector<Node *> &nodes)
{
if (!graph_) {
return;
@@ -188,7 +188,7 @@ void NodeView::Select(const QList<Node *> &nodes)
SceneSelectionChangedSlot();
}
void NodeView::SelectWithDependencies(QList<Node *> nodes)
void NodeView::SelectWithDependencies(QVector<Node *> nodes)
{
if (!graph_) {
return;
@@ -202,7 +202,7 @@ void NodeView::SelectWithDependencies(QList<Node *> nodes)
Select(nodes);
}
void NodeView::SelectBlocks(const QList<Block *> &blocks)
void NodeView::SelectBlocks(const QVector<Block *> &blocks)
{
if (!graph_) {
return;
@@ -213,7 +213,7 @@ void NodeView::SelectBlocks(const QList<Block *> &blocks)
QueueSelectBlocksInternal();
}
void NodeView::DeselectBlocks(const QList<Block *> &blocks)
void NodeView::DeselectBlocks(const QVector<Block *> &blocks)
{
if (!graph_) {
return;
@@ -240,7 +240,7 @@ void NodeView::CopySelected(bool cut)
return;
}
QList<Node*> selected = scene_.GetSelectedNodes();
QVector<Node*> selected = scene_.GetSelectedNodes();
if (selected.isEmpty()) {
return;
@@ -261,7 +261,7 @@ void NodeView::Paste()
QUndoCommand* command = new QUndoCommand();
QList<Node*> pasted_nodes = PasteNodesFromClipboard(static_cast<Sequence*>(graph_), command);
QVector<Node*> pasted_nodes = PasteNodesFromClipboard(static_cast<Sequence*>(graph_), command);
Core::instance()->undo_stack()->pushIfHasChildren(command);
@@ -280,7 +280,7 @@ void NodeView::Duplicate()
return;
}
QList<Node*> selected = scene_.GetSelectedNodes();
QVector<Node*> selected = scene_.GetSelectedNodes();
if (selected.isEmpty()) {
return;
@@ -488,10 +488,10 @@ void NodeView::wheelEvent(QWheelEvent *event)
void NodeView::SceneSelectionChangedSlot()
{
QList<Node*> current_selection = scene_.GetSelectedNodes();
QVector<Node*> current_selection = scene_.GetSelectedNodes();
QList<Node*> selected;
QList<Node*> deselected;
QVector<Node*> selected;
QVector<Node*> deselected;
// Determine which nodes are newly selected
if (selected_nodes_.isEmpty()) {
@@ -540,7 +540,7 @@ void NodeView::ShowContextMenu(const QPoint &pos)
m.addSeparator();
QList<NodeViewItem*> selected = scene_.GetSelectedItems();
QVector<NodeViewItem*> selected = scene_.GetSelectedItems();
if (itemAt(pos) && !selected.isEmpty()) {
@@ -636,7 +636,7 @@ void NodeView::ContextMenuSetDirection(QAction *action)
void NodeView::AutoPositionDescendents()
{
QList<Node*> selected = scene_.GetSelectedNodes();
QVector<Node*> selected = scene_.GetSelectedNodes();
foreach (Node* n, selected) {
scene_.ReorganizeFrom(n);
@@ -665,18 +665,18 @@ void NodeView::ContextMenuFilterChanged(QAction *action)
}
}
void NodeView::AttachNodesToCursor(const QList<Node *> &nodes)
void NodeView::AttachNodesToCursor(const QVector<Node *> &nodes)
{
QList<NodeViewItem*> items;
QVector<NodeViewItem*> items(nodes.size());
foreach (Node* p, nodes) {
items.append(scene_.NodeToUIObject(p));
for (int i=0; i<nodes.size(); i++) {
items[i] = scene_.NodeToUIObject(nodes.at(i));
}
AttachItemsToCursor(items);
}
void NodeView::AttachItemsToCursor(const QList<NodeViewItem*>& items)
void NodeView::AttachItemsToCursor(const QVector<NodeViewItem*>& items)
{
DetachItemsFromCursor();
@@ -731,7 +731,7 @@ void NodeView::UpdateBlockFilter()
bool first = true;
QPointF last_bottom_right;
QList<Node*> currently_visible;
QVector<Node*> currently_visible;
foreach (Block* b, selected_blocks_) {
// Auto-position this node's dependencies
@@ -741,7 +741,7 @@ void NodeView::UpdateBlockFilter()
QPointF node_pos = b->GetPosition();
QRectF anchor(node_pos, node_pos);
QList<Node*> deps = b->GetDependencies();
QVector<Node*> deps = b->GetDependencies();
foreach (Node* d, deps) {
QPointF dep_pos = d->GetPosition();
@@ -779,8 +779,7 @@ void NodeView::UpdateBlockFilter()
// ...then add its associations
deps.append(temporary_association_map_[b]);
QHash<Node*, QList<Block*> >::const_iterator i;
for (i=association_map_.begin(); i!=association_map_.end(); i++) {
for (auto i=association_map_.begin(); i!=association_map_.end(); i++) {
if (i.value().contains(b)) {
deps.append(i.key());
}
@@ -835,7 +834,7 @@ void NodeView::SelectBlocksInternal()
UpdateBlockFilter();
}
QList<Node*> nodes;
QVector<Node*> nodes;
nodes.reserve(selected_blocks_.size());
foreach (Block* b, selected_blocks_) {
@@ -888,7 +887,7 @@ void NodeView::GraphEdgeAdded(NodeEdgePtr edge)
Node* input_node = edge->input()->parentNode();
if (input_node->OutputsTo(static_cast<Sequence*>(graph_)->viewer_output(), true)) {
QHash<Node*, QList<Block*> >::const_iterator i = association_map_.begin();
auto i = association_map_.begin();
while (i != association_map_.end()) {
if (input_node->InputsFrom(i.key(), true)) {
@@ -917,14 +916,14 @@ void NodeView::GraphEdgeRemoved(NodeEdgePtr edge)
}
}
QList<Node*> disconnected_nodes;
QVector<Node*> disconnected_nodes;
disconnected_nodes.append(output_node);
disconnected_nodes.append(output_node->GetDependencies());
if (output_node->OutputsTo(static_cast<Sequence*>(graph_)->viewer_output(), true)) {
// Check if this disconnected node still has a path to the viewer somewhere else
foreach (Block* b, selected_blocks_) {
QList<Node*>& temp_assocs = temporary_association_map_[b];
QVector<Node*>& temp_assocs = temporary_association_map_[b];
temp_assocs.append(disconnected_nodes);
}
+12 -12
View File
@@ -58,22 +58,22 @@ public:
void SelectAll();
void DeselectAll();
void Select(const QList<Node*>& nodes);
void SelectWithDependencies(QList<Node *> nodes);
void Select(const QVector<Node*>& nodes);
void SelectWithDependencies(QVector<Node *> nodes);
void CopySelected(bool cut);
void Paste();
void Duplicate();
void SelectBlocks(const QList<Block*>& blocks);
void SelectBlocks(const QVector<Block*>& blocks);
void DeselectBlocks(const QList<Block*>& blocks);
void DeselectBlocks(const QVector<Block*>& blocks);
signals:
void NodesSelected(const QList<Node*>& nodes);
void NodesSelected(const QVector<Node*>& nodes);
void NodesDeselected(const QList<Node*>& nodes);
void NodesDeselected(const QVector<Node*>& nodes);
protected:
virtual void keyPressEvent(QKeyEvent *event) override;
@@ -85,9 +85,9 @@ protected:
virtual void wheelEvent(QWheelEvent* event) override;
private:
void AttachNodesToCursor(const QList<Node*>& nodes);
void AttachNodesToCursor(const QVector<Node *> &nodes);
void AttachItemsToCursor(const QList<NodeViewItem*>& items);
void AttachItemsToCursor(const QVector<NodeViewItem *> &items);
void DetachItemsFromCursor();
@@ -121,13 +121,13 @@ private:
NodeViewScene scene_;
QList<Node*> selected_nodes_;
QVector<Node*> selected_nodes_;
QList<Block*> selected_blocks_;
QVector<Block*> selected_blocks_;
QHash<Node*, QList<Block*> > association_map_;
QHash<Node*, QVector<Block*> > association_map_;
QHash<Block*, QList<Node*> > temporary_association_map_;
QHash<Block*, QVector<Node*> > temporary_association_map_;
enum FilterMode {
kFilterShowAll,
+8 -8
View File
@@ -120,10 +120,10 @@ void NodeViewScene::SetGraph(NodeGraph *graph)
graph_ = graph;
}
QList<Node *> NodeViewScene::GetSelectedNodes() const
QVector<Node *> NodeViewScene::GetSelectedNodes() const
{
QHash<Node*, NodeViewItem*>::const_iterator iterator;
QList<Node *> selected;
QVector<Node *> selected;
for (iterator=item_map_.begin();iterator!=item_map_.end();iterator++) {
if (iterator.value()->isSelected()) {
@@ -134,10 +134,10 @@ QList<Node *> NodeViewScene::GetSelectedNodes() const
return selected;
}
QList<NodeViewItem *> NodeViewScene::GetSelectedItems() const
QVector<NodeViewItem *> NodeViewScene::GetSelectedItems() const
{
QHash<Node*, NodeViewItem*>::const_iterator iterator;
QList<NodeViewItem *> selected;
QVector<NodeViewItem *> selected;
for (iterator=item_map_.begin();iterator!=item_map_.end();iterator++) {
if (iterator.value()->isSelected()) {
@@ -148,9 +148,9 @@ QList<NodeViewItem *> NodeViewScene::GetSelectedItems() const
return selected;
}
QList<NodeEdge*> NodeViewScene::GetSelectedEdges() const
QVector<NodeEdge*> NodeViewScene::GetSelectedEdges() const
{
QList<NodeEdge*> edges;
QVector<NodeEdge*> edges;
QHash<NodeEdge*, NodeViewEdge*>::const_iterator i;
@@ -228,7 +228,7 @@ void NodeViewScene::RemoveEdge(NodeEdgePtr edge)
int NodeViewScene::DetermineWeight(Node *n)
{
QList<Node*> inputs = n->GetImmediateDependencies();
QVector<Node*> inputs = n->GetImmediateDependencies();
int weight = 0;
@@ -253,7 +253,7 @@ NodeViewCommon::FlowDirection NodeViewScene::GetFlowDirection() const
void NodeViewScene::ReorganizeFrom(Node* n)
{
QList<Node*> immediates = n->GetImmediateDependencies();
QVector<Node*> immediates = n->GetImmediateDependencies();
if (immediates.isEmpty()) {
// Nothing to do
+3 -3
View File
@@ -63,9 +63,9 @@ public:
void SetGraph(NodeGraph* graph);
QList<Node*> GetSelectedNodes() const;
QList<NodeViewItem*> GetSelectedItems() const;
QList<NodeEdge *> GetSelectedEdges() const;
QVector<Node *> GetSelectedNodes() const;
QVector<NodeViewItem*> GetSelectedItems() const;
QVector<NodeEdge *> GetSelectedEdges() const;
const QHash<Node*, NodeViewItem*>& item_map() const;
const QHash<NodeEdge*, NodeViewEdge*>& edge_map() const;
+2 -2
View File
@@ -131,7 +131,7 @@ Project *NodeAddCommand::GetRelevantProject() const
return static_cast<Sequence*>(graph_)->project();
}
NodeRemoveCommand::NodeRemoveCommand(NodeGraph *graph, const QList<Node *> &nodes, QUndoCommand *parent) :
NodeRemoveCommand::NodeRemoveCommand(NodeGraph *graph, const QVector<Node *> &nodes, QUndoCommand *parent) :
UndoCommand(parent),
graph_(graph),
nodes_(nodes)
@@ -197,7 +197,7 @@ Project *NodeRemoveCommand::GetRelevantProject() const
NodeRemoveWithExclusiveDeps::NodeRemoveWithExclusiveDeps(NodeGraph *graph, Node *node, QUndoCommand *parent) :
UndoCommand(parent)
{
QList<Node*> node_and_its_deps;
QVector<Node*> node_and_its_deps;
node_and_its_deps.append(node);
node_and_its_deps.append(node->GetExclusiveDependencies());
+4 -4
View File
@@ -98,7 +98,7 @@ private:
class NodeRemoveCommand : public UndoCommand {
public:
NodeRemoveCommand(NodeGraph* graph,
const QList<Node*>& nodes,
const QVector<Node*>& nodes,
QUndoCommand* parent = nullptr);
virtual Project* GetRelevantProject() const override;
@@ -111,9 +111,9 @@ private:
QObject memory_manager_;
NodeGraph* graph_;
QList<Node*> nodes_;
QList<NodeEdgePtr> edges_;
QList<BlockUnlinkAllCommand*> block_unlink_commands_;
QVector<Node*> nodes_;
QVector<NodeEdgePtr> edges_;
QVector<BlockUnlinkAllCommand*> block_unlink_commands_;
};
class NodeRemoveWithExclusiveDeps : public UndoCommand {
@@ -637,12 +637,12 @@ void ProjectExplorer::DeleteSelected()
if (msgbox.clickedButton() == delete_clip_btn) {
// Delete any blocks that use this footage
QList<Block*> blocks_to_remove;
QVector<Block*> blocks_to_remove;
foreach (Sequence* s, used_in_sequences) {
foreach (TrackOutput* track, s->viewer_output()->GetTracks()) {
foreach (Block* b, track->Blocks()) {
QList<Node*> deps = b->GetDependencies();
QVector<Node*> deps = b->GetDependencies();
foreach (MediaInput* i, footage_nodes) {
if (deps.contains(i)) {
+25 -30
View File
@@ -362,7 +362,7 @@ rational TimelineWidget::GetToolTipTimebase() const
void TimelineWidget::SelectAll()
{
QList<Block*> newly_selected_blocks;
QVector<Block*> newly_selected_blocks;
for (auto it=block_items_.cbegin(); it!=block_items_.cend(); it++) {
if (!selected_blocks_.contains(it.key())) {
@@ -414,7 +414,7 @@ void TimelineWidget::SplitAtPlayhead()
rational playhead_time = Timecode::timestamp_to_time(GetTimestamp(), timebase());
QList<TimelineViewBlockItem *> selected_blocks = GetSelectedBlocks();
QVector<TimelineViewBlockItem *> selected_blocks = GetSelectedBlocks();
// Prioritize blocks that are selected and overlap the playhead
QVector<Block*> blocks_to_split;
@@ -459,7 +459,7 @@ void TimelineWidget::SplitAtPlayhead()
}
}
void TimelineWidget::ReplaceBlocksWithGaps(const QList<Block *> &blocks,
void TimelineWidget::ReplaceBlocksWithGaps(const QVector<Block *> &blocks,
bool remove_from_graph,
QUndoCommand *command)
{
@@ -482,8 +482,8 @@ void TimelineWidget::ReplaceBlocksWithGaps(const QList<Block *> &blocks,
void TimelineWidget::DeleteSelected(bool ripple)
{
QList<TimelineViewBlockItem *> selected_list = GetSelectedBlocks();
QList<Block*> blocks_to_delete;
QVector<TimelineViewBlockItem *> selected_list = GetSelectedBlocks();
QVector<Block*> blocks_to_delete;
foreach (TimelineViewBlockItem* item, selected_list) {
Block* b = item->block();
@@ -498,8 +498,8 @@ void TimelineWidget::DeleteSelected(bool ripple)
QUndoCommand* command = new QUndoCommand();
QList<Block*> clips_to_delete;
QList<TransitionBlock*> transitions_to_delete;
QVector<Block*> clips_to_delete;
QVector<TransitionBlock*> transitions_to_delete;
foreach (Block* b, blocks_to_delete) {
if (b->type() == Block::kClip) {
@@ -580,9 +580,9 @@ void TimelineWidget::OverwriteFootageAtPlayhead(const QList<Footage *> &footage)
void TimelineWidget::ToggleLinksOnSelected()
{
QList<TimelineViewBlockItem*> sel = GetSelectedBlocks();
QVector<TimelineViewBlockItem*> sel = GetSelectedBlocks();
QList<Block*> blocks;
QVector<Block*> blocks;
bool link = true;
foreach (TimelineViewBlockItem* item, sel) {
@@ -612,20 +612,20 @@ void TimelineWidget::CopySelected(bool cut)
return;
}
QList<TimelineViewBlockItem*> selected = GetSelectedBlocks();
QVector<TimelineViewBlockItem*> selected = GetSelectedBlocks();
if (selected.isEmpty()) {
return;
}
QList<Node*> selected_nodes;
QVector<Node*> selected_nodes;
foreach (TimelineViewBlockItem* item, selected) {
Node* block = item->block();
selected_nodes.append(block);
QList<Node*> deps = block->GetDependencies();
QVector<Node*> deps = block->GetDependencies();
foreach (Node* d, deps) {
if (!selected_nodes.contains(d)) {
@@ -649,8 +649,8 @@ void TimelineWidget::Paste(bool insert)
QUndoCommand* command = new QUndoCommand();
QList<BlockPasteData> paste_data;
QList<Node*> pasted = PasteNodesFromClipboard(static_cast<Sequence*>(GetConnectedNode()->parent()), command, &paste_data);
QVector<BlockPasteData> paste_data;
QVector<Node*> pasted = PasteNodesFromClipboard(static_cast<Sequence*>(GetConnectedNode()->parent()), command, &paste_data);
rational paste_start = GetTime();
@@ -731,7 +731,7 @@ void TimelineWidget::DeleteInToOut(bool ripple)
void TimelineWidget::ToggleSelectedEnabled()
{
QList<TimelineViewBlockItem*> items = GetSelectedBlocks();
QVector<TimelineViewBlockItem*> items = GetSelectedBlocks();
if (items.isEmpty()) {
return;
@@ -748,12 +748,12 @@ void TimelineWidget::ToggleSelectedEnabled()
Core::instance()->undo_stack()->pushIfHasChildren(command);
}
QList<TimelineViewBlockItem *> TimelineWidget::GetSelectedBlocks()
QVector<TimelineViewBlockItem *> TimelineWidget::GetSelectedBlocks()
{
QList<TimelineViewBlockItem *> list;
QVector<TimelineViewBlockItem *> list(selected_blocks_.size());
foreach (Block* b, selected_blocks_) {
list.append(block_items_.value(b));
for (int i=0; i<selected_blocks_.size(); i++) {
list[i] = block_items_.value(selected_blocks_.at(i));
}
return list;
@@ -908,10 +908,7 @@ void TimelineWidget::AddBlock(Block *block, TrackReference track)
void TimelineWidget::RemoveBlock(const QList<Block *> &blocks)
{
QList<TimelineViewBlockItem*> delete_items;
delete_items.reserve(blocks.size());
QList<Block*> deselect_blocks;
QVector<Block*> deselect_blocks;
foreach (Block* b, blocks) {
// Disconnect all signals
@@ -940,8 +937,6 @@ void TimelineWidget::RemoveBlock(const QList<Block *> &blocks)
// through
emit BlocksDeselected(deselect_blocks);
}
qDeleteAll(delete_items);
}
void TimelineWidget::AddTrack(TrackOutput *track, Timeline::TrackType type)
@@ -1051,7 +1046,7 @@ void TimelineWidget::ShowContextMenu()
{
Menu menu(this);
QList<TimelineViewBlockItem*> selected = GetSelectedBlocks();
QVector<TimelineViewBlockItem*> selected = GetSelectedBlocks();
if (!selected.isEmpty()) {
MenuShared::instance()->AddItemsForEditMenu(&menu, true);
@@ -1060,8 +1055,8 @@ void TimelineWidget::ShowContextMenu()
QAction* properties_action = menu.addAction(tr("Properties"));
connect(properties_action, &QAction::triggered, this, [this](){
QList<TimelineViewBlockItem*> block_items = GetSelectedBlocks();
QList<Node*> nodes;
QVector<TimelineViewBlockItem*> block_items = GetSelectedBlocks();
QVector<Node*> nodes;
foreach (TimelineViewBlockItem* i, block_items) {
nodes.append(i->block());
@@ -1210,7 +1205,7 @@ const QRect& TimelineWidget::GetRubberBandGeometry() const
return rubberband_.geometry();
}
void TimelineWidget::SignalSelectedBlocks(QList<Block *> input, bool filter)
void TimelineWidget::SignalSelectedBlocks(QVector<Block *> input, bool filter)
{
if (input.isEmpty()) {
return;
@@ -1233,7 +1228,7 @@ void TimelineWidget::SignalSelectedBlocks(QList<Block *> input, bool filter)
emit BlocksSelected(input);
}
void TimelineWidget::SignalDeselectedBlocks(const QList<Block *> &deselected_blocks)
void TimelineWidget::SignalDeselectedBlocks(const QVector<Block *> &deselected_blocks)
{
if (deselected_blocks.isEmpty()) {
return;
+8 -8
View File
@@ -89,7 +89,7 @@ public:
void ToggleSelectedEnabled();
QList<TimelineViewBlockItem*> GetSelectedBlocks();
QVector<TimelineViewBlockItem*> GetSelectedBlocks();
virtual bool SnapPoint(QList<rational> start_times, rational *movement, int snap_points = kSnapAll) override;
@@ -99,7 +99,7 @@ public:
void RestoreSplitterState(const QByteArray& state);
static void ReplaceBlocksWithGaps(const QList<Block *>& blocks, bool remove_from_graph, QUndoCommand* command);
static void ReplaceBlocksWithGaps(const QVector<Block *> &blocks, bool remove_from_graph, QUndoCommand* command);
/**
* @brief Retrieve the QGraphicsItem at a particular scene position
@@ -185,12 +185,12 @@ public:
* this is preferable and should only be set to FALSE if the list is guaranteed not to contain
* already selected blocks (and therefore filtering can be skipped to save time).
*/
void SignalSelectedBlocks(QList<Block *> selected_blocks, bool filter = true);
void SignalSelectedBlocks(QVector<Block *> selected_blocks, bool filter = true);
/**
* @brief Track blocks that have been newly deselected
*/
void SignalDeselectedBlocks(const QList<Block*>& deselected_blocks);
void SignalDeselectedBlocks(const QVector<Block *> &deselected_blocks);
/**
* @brief Convenience function to deselect all blocks and signal them
@@ -198,9 +198,9 @@ public:
void SignalDeselectedAllBlocks();
signals:
void BlocksSelected(const QList<Block*>& selected_blocks);
void BlocksSelected(const QVector<Block*>& selected_blocks);
void BlocksDeselected(const QList<Block*>& deselected_blocks);
void BlocksDeselected(const QVector<Block*>& deselected_blocks);
protected:
virtual void resizeEvent(QResizeEvent *event) override;
@@ -237,7 +237,7 @@ private:
QRubberBand rubberband_;
TimelineWidgetSelections rubberband_old_selections_;
QList<Block*> rubberband_now_selected_;
QVector<Block*> rubberband_now_selected_;
TimelineWidgetSelections selections_;
@@ -257,7 +257,7 @@ private:
TimeSlider* timecode_label_;
QList<Block*> selected_blocks_;
QVector<Block*> selected_blocks_;
int deferred_scroll_value_;
+18 -18
View File
@@ -79,7 +79,7 @@ void PointerTool::MousePress(TimelineViewMouseEvent *event)
if (parent()->IsBlockSelected(clicked_item_->block())) {
// Collect item deselections
QList<Block*> deselected_blocks;
QVector<Block*> deselected_blocks;
// If shift is held, deselect it
if (event->GetModifiers() & Qt::ShiftModifier) {
@@ -89,7 +89,7 @@ void PointerTool::MousePress(TimelineViewMouseEvent *event)
// If not holding alt, deselect all links as well
if (!(event->GetModifiers() & Qt::AltModifier)) {
parent()->SetBlockLinksSelected(clicked_item_->block(), false);
deselected_blocks.append(clicked_item_->block()->linked_clips().toList());
deselected_blocks.append(clicked_item_->block()->linked_clips());
}
}
@@ -107,7 +107,7 @@ void PointerTool::MousePress(TimelineViewMouseEvent *event)
if (selectable_item) {
// Collect item selections
QList<Block*> selected_blocks;
QVector<Block*> selected_blocks;
// Select this item
parent()->AddSelection(clicked_item_);
@@ -116,7 +116,7 @@ void PointerTool::MousePress(TimelineViewMouseEvent *event)
// If not holding alt, select all links as well
if (!(event->GetModifiers() & Qt::AltModifier)) {
parent()->SetBlockLinksSelected(clicked_item_->block(), true);
selected_blocks.append(clicked_item_->block()->linked_clips().toList());
selected_blocks.append(clicked_item_->block()->linked_clips());
}
parent()->SignalSelectedBlocks(selected_blocks);
@@ -219,13 +219,13 @@ void SetGhostToSlideMode(TimelineViewGhostItem* g)
}
void PointerTool::InitiateDragInternal(TimelineViewBlockItem *clicked_item,
Timeline::MovementMode trim_mode,
bool dont_roll_trims,
bool allow_nongap_rolling,
bool slide_instead_of_moving)
Timeline::MovementMode trim_mode,
bool dont_roll_trims,
bool allow_nongap_rolling,
bool slide_instead_of_moving)
{
// Get list of selected blocks
QList<TimelineViewBlockItem*> clips = parent()->GetSelectedBlocks();
QVector<TimelineViewBlockItem*> clips = parent()->GetSelectedBlocks();
if (trim_mode == Timeline::kMove) {
@@ -590,10 +590,10 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
// If we're not duplicating, "remove" the clips and replace them with gaps
if (!duplicate_clips) {
QList<Block*> blocks_to_delete;
QVector<Block*> blocks_to_delete(blocks_moving.size());
foreach (const GhostBlockPair& p, blocks_moving) {
blocks_to_delete.append(p.block);
for (int i=0; i<blocks_moving.size(); i++) {
blocks_to_delete[i] = blocks_moving.at(i).block;
}
parent()->ReplaceBlocksWithGaps(blocks_to_delete, false, command);
@@ -724,7 +724,7 @@ Timeline::MovementMode PointerTool::IsCursorInTrimHandle(TimelineViewBlockItem *
}
void PointerTool::InitiateDrag(TimelineViewBlockItem* clicked_item,
Timeline::MovementMode trim_mode)
Timeline::MovementMode trim_mode)
{
InitiateDragInternal(clicked_item, trim_mode, false, false, false);
}
@@ -795,8 +795,8 @@ void PointerTool::AddGhostInternal(TimelineViewGhostItem* ghost, Timeline::Movem
}
bool PointerTool::IsClipTrimmable(TimelineViewBlockItem* clip,
const QList<TimelineViewBlockItem*>& items,
const Timeline::MovementMode& mode)
const QVector<TimelineViewBlockItem*>& items,
const Timeline::MovementMode& mode)
{
foreach (TimelineViewBlockItem* compare, items) {
if (clip->Track() == compare->Track()
@@ -811,9 +811,9 @@ bool PointerTool::IsClipTrimmable(TimelineViewBlockItem* clip,
}
bool PointerTool::AddMovingTransitionsToClipGhost(Block* block,
const TrackReference& track,
Timeline::MovementMode movement,
const QList<TimelineViewBlockItem*>& selected_items)
const TrackReference& track,
Timeline::MovementMode movement,
const QList<TimelineViewBlockItem*>& selected_items)
{
// Assume block is a clip and see if it has any transitions
TransitionBlock* transitions[2];
+1 -1
View File
@@ -100,7 +100,7 @@ private:
void AddGhostInternal(TimelineViewGhostItem* ghost, Timeline::MovementMode mode);
bool IsClipTrimmable(TimelineViewBlockItem* clip,
const QList<TimelineViewBlockItem*>& items,
const QVector<TimelineViewBlockItem *> &items,
const Timeline::MovementMode& mode);
void ProcessGhostsForSliding();
+1 -1
View File
@@ -765,7 +765,7 @@ void BlockUnlinkAllCommand::undo_internal()
unlinked_.clear();
}
BlockLinkManyCommand::BlockLinkManyCommand(const QList<Block *> blocks, bool link, QUndoCommand *parent) :
BlockLinkManyCommand::BlockLinkManyCommand(const QVector<Block *> blocks, bool link, QUndoCommand *parent) :
UndoCommand(parent),
blocks_(blocks)
{
+2 -2
View File
@@ -471,12 +471,12 @@ private:
class BlockLinkManyCommand : public UndoCommand {
public:
BlockLinkManyCommand(const QList<Block*> blocks, bool link, QUndoCommand* parent = nullptr);
BlockLinkManyCommand(const QVector<Block*> blocks, bool link, QUndoCommand* parent = nullptr);
virtual Project* GetRelevantProject() const override;
private:
QList<Block*> blocks_;
QVector<Block*> blocks_;
};
+1 -1
View File
@@ -60,7 +60,7 @@ TimeRange TimeTargetObject::GetAdjustedTime(Node* from, Node* to, const TimeRang
return r;
}
QList<TimeRange> adjusted = from->TransformTimeTo(r, to, direction);
QVector<TimeRange> adjusted = from->TransformTimeTo(r, to, direction);
if (adjusted.isEmpty()) {
return r;