ui: optimized widget signals for selecting clips/nodes

Decent performance optimization when working with the UI.
This commit is contained in:
itsmattkc
2020-08-01 02:12:20 +10:00
parent fb05594b50
commit 2afa5a42c7
25 changed files with 491 additions and 351 deletions
+2 -61
View File
@@ -29,7 +29,8 @@ NodePanel::NodePanel(QWidget *parent) :
node_view_ = new NodeView(this);
// Connect node view signals to this panel
connect(node_view_, SIGNAL(SelectionChanged(QList<Node*>)), this, SIGNAL(SelectionChanged(QList<Node*>)));
connect(node_view_, &NodeView::NodesSelected, this, &NodePanel::NodesSelected);
connect(node_view_, &NodeView::NodesDeselected, this, &NodePanel::NodesDeselected);
// Set it as the main widget of this panel
SetWidgetWithPadding(node_view_);
@@ -38,64 +39,4 @@ NodePanel::NodePanel(QWidget *parent) :
Retranslate();
}
void NodePanel::SetGraph(NodeGraph *graph)
{
node_view_->SetGraph(graph);
}
void NodePanel::SelectAll()
{
node_view_->SelectAll();
}
void NodePanel::DeselectAll()
{
node_view_->DeselectAll();
}
void NodePanel::DeleteSelected()
{
node_view_->DeleteSelected();
}
void NodePanel::CutSelected()
{
node_view_->CopySelected(true);
}
void NodePanel::CopySelected()
{
node_view_->CopySelected(false);
}
void NodePanel::Paste()
{
node_view_->Paste();
}
void NodePanel::Duplicate()
{
node_view_->Duplicate();
}
void NodePanel::Select(const QList<Node *> &nodes)
{
node_view_->Select(nodes);
}
void NodePanel::SelectWithDependencies(const QList<Node *> &nodes)
{
node_view_->SelectWithDependencies(nodes);
}
void NodePanel::SelectBlocks(const QList<Block *> &nodes)
{
node_view_->SelectBlocks(nodes);
}
void NodePanel::Retranslate()
{
SetTitle(tr("Node Editor"));
}
OLIVE_NAMESPACE_EXIT
+59 -16
View File
@@ -35,34 +35,77 @@ class NodePanel : public PanelWidget
public:
NodePanel(QWidget* parent);
void SetGraph(NodeGraph* graph);
void SetGraph(NodeGraph *graph)
{
node_view_->SetGraph(graph);
}
virtual void SelectAll() override;
virtual void DeselectAll() override;
virtual void SelectAll() override
{
node_view_->SelectAll();
}
virtual void DeleteSelected() override;
virtual void DeselectAll() override
{
node_view_->DeselectAll();
}
virtual void CutSelected() override;
virtual void CopySelected() override;
virtual void DeleteSelected() override
{
node_view_->DeleteSelected();
}
virtual void Paste() override;
virtual void CutSelected() override
{
node_view_->CopySelected(true);
}
virtual void Duplicate() override;
virtual void CopySelected() override
{
node_view_->CopySelected(false);
}
virtual void Paste() override
{
node_view_->Paste();
}
virtual void Duplicate() override
{
node_view_->Duplicate();
}
public slots:
void Select(const QList<Node*>& nodes);
void SelectWithDependencies(const QList<Node*>& nodes);
void Select(const QList<Node*>& nodes)
{
node_view_->Select(nodes);
}
void SelectBlocks(const QList<Block*>& nodes);
void SelectWithDependencies(const QList<Node*>& nodes)
{
node_view_->SelectWithDependencies(nodes);
}
void SelectBlocks(const QList<Block*>& nodes)
{
node_view_->SelectBlocks(nodes);
}
void DeselectBlocks(const QList<Block*>& nodes)
{
node_view_->DeselectBlocks(nodes);
}
signals:
/**
* @brief Wrapper for NodeView::SelectionChanged()
*/
void SelectionChanged(QList<Node*> selected_nodes);
void NodesSelected(const QList<Node*>& nodes);
void NodesDeselected(const QList<Node*>& nodes);
private:
virtual void Retranslate() override;
virtual void Retranslate() override
{
SetTitle(tr("Node Editor"));
}
NodeView* node_view_;
+13 -6
View File
@@ -30,15 +30,22 @@ ParamPanel::ParamPanel(QWidget* parent) :
NodeParamView* view = new NodeParamView();
connect(view, &NodeParamView::InputDoubleClicked, this, &ParamPanel::CreateCurvePanel);
connect(view, &NodeParamView::RequestSelectNode, this, &ParamPanel::RequestSelectNode);
connect(view, &NodeParamView::FoundGizmos, this, &ParamPanel::FoundGizmos);
//connect(view, &NodeParamView::FoundGizmos, this, &ParamPanel::FoundGizmos);
SetTimeBasedWidget(view);
Retranslate();
}
void ParamPanel::SetNodes(QList<Node *> nodes)
void ParamPanel::SelectNodes(const QList<Node *> &nodes)
{
static_cast<NodeParamView*>(GetTimeBasedWidget())->SetNodes(nodes);
static_cast<NodeParamView*>(GetTimeBasedWidget())->SelectNodes(nodes);
Retranslate();
}
void ParamPanel::DeselectNodes(const QList<Node *> &nodes)
{
static_cast<NodeParamView*>(GetTimeBasedWidget())->DeselectNodes(nodes);
Retranslate();
}
@@ -62,10 +69,10 @@ void ParamPanel::Retranslate()
NodeParamView* view = static_cast<NodeParamView*>(GetTimeBasedWidget());
if (view->nodes().isEmpty()) {
if (view->GetItemMap().isEmpty()) {
SetSubtitle(tr("(none)"));
} else if (view->nodes().size() == 1) {
SetSubtitle(view->nodes().first()->Name());
} else if (view->GetItemMap().size() == 1) {
SetSubtitle(view->GetItemMap().firstKey()->Name());
} else {
SetSubtitle(tr("(multiple)"));
}
+2 -1
View File
@@ -34,7 +34,8 @@ public:
ParamPanel(QWidget* parent);
public slots:
void SetNodes(QList<Node*> nodes);
void SelectNodes(const QList<Node*>& nodes);
void DeselectNodes(const QList<Node*>& nodes);
virtual void SetTimestamp(const int64_t& timestamp) override;
+1 -7
View File
@@ -25,17 +25,11 @@ OLIVE_NAMESPACE_ENTER
NodeTablePanel::NodeTablePanel(QWidget* parent) :
TimeBasedPanel(QStringLiteral("NodeTablePanel"), parent)
{
view_ = new NodeTableWidget();
SetTimeBasedWidget(view_);
SetTimeBasedWidget(new NodeTableWidget());
Retranslate();
}
void NodeTablePanel::SetNodes(const QList<Node *> &nodes)
{
view_->SetNodes(nodes);
}
void NodeTablePanel::Retranslate()
{
SetTitle(tr("Table View"));
+9 -2
View File
@@ -33,12 +33,19 @@ public:
NodeTablePanel(QWidget* parent);
public slots:
void SetNodes(const QList<Node*>& nodes);
void SelectNodes(const QList<Node*>& nodes)
{
static_cast<NodeTableWidget*>(GetTimeBasedWidget())->SelectNodes(nodes);
}
void DeselectNodes(const QList<Node*>& nodes)
{
static_cast<NodeTableWidget*>(GetTimeBasedWidget())->DeselectNodes(nodes);
}
private:
virtual void Retranslate() override;
NodeTableWidget* view_;
};
OLIVE_NAMESPACE_EXIT
+2 -1
View File
@@ -33,7 +33,8 @@ TimelinePanel::TimelinePanel(QWidget *parent) :
Retranslate();
connect(tw, &TimelineWidget::SelectionChanged, this, &TimelinePanel::SelectionChanged);
connect(tw, &TimelineWidget::BlocksSelected, this, &TimelinePanel::BlocksSelected);
connect(tw, &TimelineWidget::BlocksDeselected, this, &TimelinePanel::BlocksDeselected);
}
void TimelinePanel::Clear()
+3 -1
View File
@@ -91,7 +91,9 @@ protected:
virtual void Retranslate() override;
signals:
void SelectionChanged(const QList<Block*>& selected_blocks);
void BlocksSelected(const QList<Block*>& selected_blocks);
void BlocksDeselected(const QList<Block*>& deselected_blocks);
};