From 65a1c75933a809af28074a7b0845560724df2a31 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Mon, 27 Dec 2021 20:56:04 -0800 Subject: [PATCH] clean up and remove nodegroupdialog --- app/core.cpp | 14 +- app/core.h | 2 +- app/dialog/CMakeLists.txt | 1 - app/dialog/nodegroup/CMakeLists.txt | 22 -- app/dialog/nodegroup/nodegroupdialog.cpp | 319 ------------------- app/dialog/nodegroup/nodegroupdialog.h | 75 ----- app/panel/pixelsampler/pixelsamplerpanel.cpp | 2 +- app/panel/viewer/viewer.cpp | 25 +- app/panel/viewer/viewer.h | 8 +- app/widget/nodeview/nodeview.cpp | 23 +- app/widget/nodeview/nodeview.h | 7 - app/widget/panel/panel.cpp | 9 + app/widget/panel/panel.h | 2 + app/widget/viewer/viewerdisplay.cpp | 2 +- app/window/mainwindow/mainwindow.cpp | 26 +- 15 files changed, 58 insertions(+), 479 deletions(-) delete mode 100644 app/dialog/nodegroup/CMakeLists.txt delete mode 100644 app/dialog/nodegroup/nodegroupdialog.cpp delete mode 100644 app/dialog/nodegroup/nodegroupdialog.h diff --git a/app/core.cpp b/app/core.cpp index 1db15b4fa..241d57206 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -1358,10 +1358,10 @@ void Core::SetPreferenceForRenderMode(RenderMode::Mode mode, const QString &pref Config::Current()[GetRenderModePreferencePrefix(mode, preference)] = value; } -void Core::LabelNodes(const QVector &nodes) +bool Core::LabelNodes(const QVector &nodes, MultiUndoCommand *parent) { if (nodes.isEmpty()) { - return; + return false; } bool ok; @@ -1390,8 +1390,16 @@ void Core::LabelNodes(const QVector &nodes) rename_command->AddNode(n, s); } - undo_stack_.push(rename_command); + if (parent) { + parent->add_child(rename_command); + } else { + undo_stack_.push(rename_command); + } + + return true; } + + return false; } Sequence *Core::CreateNewSequenceForProject(Project* project) const diff --git a/app/core.h b/app/core.h index 3ac9b1e70..003e9e3f3 100644 --- a/app/core.h +++ b/app/core.h @@ -253,7 +253,7 @@ public: /** * @brief Show a dialog to the user to rename a set of nodes */ - void LabelNodes(const QVector &nodes); + bool LabelNodes(const QVector &nodes, MultiUndoCommand *parent = nullptr); /** * @brief Create a new sequence named appropriately for the active project diff --git a/app/dialog/CMakeLists.txt b/app/dialog/CMakeLists.txt index afe445704..64c718d2a 100644 --- a/app/dialog/CMakeLists.txt +++ b/app/dialog/CMakeLists.txt @@ -24,7 +24,6 @@ add_subdirectory(export) add_subdirectory(footageproperties) add_subdirectory(footagerelink) add_subdirectory(keyframeproperties) -add_subdirectory(nodegroup) add_subdirectory(preferences) add_subdirectory(progress) add_subdirectory(rendercancel) diff --git a/app/dialog/nodegroup/CMakeLists.txt b/app/dialog/nodegroup/CMakeLists.txt deleted file mode 100644 index 0f48edfc9..000000000 --- a/app/dialog/nodegroup/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -set(OLIVE_SOURCES - ${OLIVE_SOURCES} - dialog/nodegroup/nodegroupdialog.cpp - dialog/nodegroup/nodegroupdialog.h - PARENT_SCOPE -) diff --git a/app/dialog/nodegroup/nodegroupdialog.cpp b/app/dialog/nodegroup/nodegroupdialog.cpp deleted file mode 100644 index 90742f176..000000000 --- a/app/dialog/nodegroup/nodegroupdialog.cpp +++ /dev/null @@ -1,319 +0,0 @@ -/*** - - Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -***/ - -#include "nodegroupdialog.h" - -#include -#include -#include -#include -#include - -#include "panel/node/node.h" -#include "panel/panelmanager.h" -#include "panel/param/param.h" - -namespace olive { - -#define super QDialog - -NodeGroupDialog::NodeGroupDialog(NodeGroup *group, QWidget *parent) : - super(parent), - group_(group), - prepend_undo_(nullptr) -{ - QGridLayout *layout = new QGridLayout(this); - - int row = 0; - - layout->addWidget(new QLabel(tr("Name:")), row, 0); - - name_edit_ = new QLineEdit(); - name_edit_->setText(group->GetLabel()); - layout->addWidget(name_edit_, row, 1); - - row++; - - QMainWindow *splitter = new QMainWindow(); - QWidget *cw = new QWidget(); - cw->setFixedSize(0, 0); - splitter->setCentralWidget(cw); - layout->addWidget(splitter, row, 0, 1, 2); - - ParamPanel *param_view = PanelManager::instance()->CreatePanel(splitter); - param_view->GetParamView()->SetIgnoreNodeFlags(true); - param_view->GetParamView()->SetCreateCheckBoxes(kCheckBoxesOnNonConnected); - splitter->addDockWidget(Qt::LeftDockWidgetArea, param_view); - - NodePanel *node_view = PanelManager::instance()->CreatePanel(splitter); - node_view->GetNodeWidget()->view()->OverrideUndoStack(&undo_stack_); - QMetaObject::invokeMethod(node_view->GetNodeWidget()->view(), &NodeView::CenterOnItemsBoundingRect, Qt::QueuedConnection); - splitter->addDockWidget(Qt::RightDockWidgetArea, node_view); - - row++; - - QDialogButtonBox *btns = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - btns->setCenterButtons(true); - connect(btns, &QDialogButtonBox::accepted, this, &NodeGroupDialog::accept); - connect(btns, &QDialogButtonBox::rejected, this, &NodeGroupDialog::reject); - layout->addWidget(btns, row, 0, 1, 2); - - setWindowTitle(tr("Group Editor - %1").arg(group->GetLabelOrName())); - - // Create a project - copied_project_ = new Project(); - copied_project_->setParent(this); - - // Copy project nodes - // NOTE: I hate this. What might be better is to fold the "ColorManager" and "ProjectSettings" - // nodes into "Project" inputs and make "Project" a node too. - for (int i=0; inodes().size(); i++) { - Node *ours = copied_project_->nodes().at(i); - Node *theirs = group_->project()->nodes().at(i); - - copy_subnodes_.insert(theirs, ours); - Node::CopyInputs(ours, theirs, false); - } - - // Copy group and nodes - copy_group_ = static_cast(group_->copy()); - copy_group_->setParent(copied_project_); - - // Copy subnodes with positions - const Node::PositionMap &map = group_->GetContextPositions(); - for (auto it=map.cbegin(); it!=map.cend(); it++) { - Node *copy = it.key()->copy(); - copy->SetUUID(it.key()->GetUUID()); - copy->setParent(copied_project_); - - copy_group_->SetNodePositionInContext(copy, it.value()); - copy_subnodes_.insert(it.key(), copy); - } - - for (auto it=map.cbegin(); it!=map.cend(); it++) { - Node::CopyInputs(it.key(), copy_subnodes_.value(it.key()), false); - } - - // Copy edges - for (auto it=copy_subnodes_.cbegin(); it!=copy_subnodes_.cend(); it++) { - Node *src = it.key(); - Node *cpy = it.value(); - - for (auto jt=src->input_connections().cbegin(); jt!=src->input_connections().cend(); jt++) { - if (Node *cpy_output = copy_subnodes_.value(jt->second)) { - Node::ConnectEdge(cpy_output, NodeInput(cpy, jt->first.input(), jt->first.element())); - copied_edges_.append({cpy_output, NodeInput(cpy, jt->first.input(), jt->first.element())}); - } - } - } - - node_view->SetContexts({copy_group_}); - - for (auto it=group_->GetInputPassthroughs().cbegin(); it!=group_->GetInputPassthroughs().cend(); it++) { - const NodeInput &src_input = it.value(); - NodeInput copy_input(copy_subnodes_.value(src_input.node()), src_input.input(), src_input.element()); - param_view->GetParamView()->SetInputChecked(copy_input, true); - } - - param_view->SetContexts({copy_group_}); -} - -void NodeGroupDialog::accept() -{ - // First, validate if a connection, deleted node, or disabled passthrough is going to disconnect - // something elsewhere in the group. Ask the user to confirm if so. - - // Detect removed nodes - QVector nodes_to_delete = GetNodesToDelete(); - - // Detect new connections - QVector edges_to_connect = GetNewConnections(); - - // Warn user if operation will disconnect a node outside the group - if (OperationWillAffectOutsideGroup(nodes_to_delete, edges_to_connect)) { - if (QMessageBox::question(this, QString(), tr("This operation will disconnect nodes outside of this group. Do you wish to continue?"), QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) { - return; - } - } - - NodeViewDeleteCommand *delete_command = new NodeViewDeleteCommand(); - - // Remove deleted nodes - foreach (Node *n, nodes_to_delete) { - delete_command->AddNode(n, group_); - } - - // Disconnect old edges - foreach (const Node::OutputConnection &edge, copied_edges_) { - bool found = false; - const NodeInput ©_input = edge.second; - - for (auto it=edge.first->output_connections().cbegin(); it!=edge.first->output_connections().cend(); it++) { - if (it->second == copy_input) { - found = true; - break; - } - } - - if (!found) { - // Edge has been disconnected - delete_command->AddEdge(copy_subnodes_.key(edge.first), NodeInput(copy_subnodes_.key(copy_input.node()), copy_input.input(), copy_input.element())); - } - } - - delete_command->redo_now(); - - // Add new nodes - MultiUndoCommand *add_command = new MultiUndoCommand(); - for (auto it=copy_group_->GetContextPositions().cbegin(); it!=copy_group_->GetContextPositions().cend(); it++) { - Node *n = it.key(); - Node *original = copy_subnodes_.key(n); - if (!original) { - // If it's a new node that isn't even in the project yet, add it - original = n->copy(); - Node::CopyInputs(n, original, false); - add_command->add_child(new NodeAddCommand(group_->parent(), original)); - copy_subnodes_.insert(original, n); - } - - // Update position in context - add_command->add_child(new NodeSetPositionCommand(original, group_, it.value())); - } - add_command->redo_now(); - - // Connect new edges - MultiUndoCommand *connect_command = new MultiUndoCommand(); - edges_to_connect = GetNewConnections(); // Update list with new nodes made above if necessary - foreach (const Node::OutputConnection &edge, edges_to_connect) { - connect_command->add_child(new NodeEdgeAddCommand(edge.first, edge.second)); - } - connect_command->redo_now(); - - MultiUndoCommand *command = new MultiUndoCommand(); - - if (prepend_undo_) { - command->add_child(prepend_undo_); - } - - command->add_child(delete_command); - command->add_child(add_command); - command->add_child(connect_command); - - // Update group name - if (name_edit_->text() != group_->GetCustomName()) { - command->add_child(new NodeGroupSetCustomNameCommand(group_, name_edit_->text())); - } - - Core::instance()->undo_stack()->push(command); - - super::accept(); -} - -void NodeGroupDialog::reject() -{ - if (prepend_undo_) { - prepend_undo_->undo_now(); - delete prepend_undo_; - } - - super::reject(); -} - -QVector NodeGroupDialog::GetNodesToDelete() -{ - QVector nodes_to_delete; - - for (auto it=group_->GetContextPositions().cbegin(); it!=group_->GetContextPositions().cend(); it++) { - Node *original = it.key(); - Node *copy = copy_subnodes_.value(original); - - if (!copy_group_->ContextContainsNode(copy)) { - nodes_to_delete.append(original); - } - } - - return nodes_to_delete; -} - -QVector NodeGroupDialog::GetNewConnections() -{ - QVector edges_to_connect; - - for (auto it=copy_group_->GetContextPositions().cbegin(); it!=copy_group_->GetContextPositions().cend(); it++) { - const Node::InputConnections &ic = it.key()->input_connections(); - - for (auto jt=ic.cbegin(); jt!=ic.cend(); jt++) { - // All connections inside this dialog will be valid and inside the group - const NodeInput &copied_input = jt->first; - Node *copied_output = jt->second; - - NodeInput original_input(copy_subnodes_.key(copied_input.node()), copied_input.input(), copied_input.element()); - Node *original_output = copy_subnodes_.key(copied_output); - - bool found = false; - - if (original_output) { - for (auto kt=original_output->output_connections().cbegin(); kt!=original_output->output_connections().cend(); kt++) { - if (kt->second == original_input) { - found = true; - break; - } - } - } - - if (!found) { - edges_to_connect.append({original_output, original_input}); - } - } - } - - return edges_to_connect; -} - -bool NodeGroupDialog::OperationWillAffectOutsideGroup(const QVector &deleted, const QVector &connections) -{ - // Check if a node to be deleted inputs from a node outside the group - foreach (Node *n, deleted) { - for (auto jt=n->input_connections().cbegin(); jt!=n->input_connections().cend(); jt++) { - if (!group_->ContextContainsNode(jt->second)) { - return true; - } - } - - for (auto jt=n->output_connections().cbegin(); jt!=n->output_connections().cend(); jt++) { - if (!group_->ContextContainsNode(jt->second.node())) { - return true; - } - } - } - - // Check if a new connection will overwrite a connection from outside the group - foreach (const Node::OutputConnection &edge, connections) { - if (Node *current_conn = edge.second.GetConnectedOutput()) { - if (!group_->ContextContainsNode(current_conn)) { - return true; - } - } - } - - return false; -} - -} diff --git a/app/dialog/nodegroup/nodegroupdialog.h b/app/dialog/nodegroup/nodegroupdialog.h deleted file mode 100644 index d18b7fd10..000000000 --- a/app/dialog/nodegroup/nodegroupdialog.h +++ /dev/null @@ -1,75 +0,0 @@ -/*** - - Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -***/ - -#ifndef NODEGROUPDIALOG_H -#define NODEGROUPDIALOG_H - -#include -#include -#include - -#include "node/group/group.h" -#include "undo/undostack.h" - -namespace olive { - -class NodeGroupDialog : public QDialog -{ - Q_OBJECT -public: - explicit NodeGroupDialog(NodeGroup *group, QWidget *parent = nullptr); - - void PrependUndoCommand(MultiUndoCommand *c) - { - prepend_undo_ = c; - } - -public slots: - virtual void accept() override; - - virtual void reject() override; - -signals: - -private: - QVector GetNodesToDelete(); - - QVector GetNewConnections(); - - bool OperationWillAffectOutsideGroup(const QVector &deleted, const QVector &connections); - - NodeGroup *group_; - - QLineEdit *name_edit_; - - MultiUndoCommand *prepend_undo_; - - Project *copied_project_; - NodeGroup *copy_group_; - QMap copy_subnodes_; - QVector copied_edges_; - - UndoStack undo_stack_; - -}; - -} - -#endif // NODEGROUPDIALOG_H diff --git a/app/panel/pixelsampler/pixelsamplerpanel.cpp b/app/panel/pixelsampler/pixelsamplerpanel.cpp index 2f17abb9e..dce9fd698 100644 --- a/app/panel/pixelsampler/pixelsamplerpanel.cpp +++ b/app/panel/pixelsampler/pixelsamplerpanel.cpp @@ -25,7 +25,7 @@ namespace olive { PixelSamplerPanel::PixelSamplerPanel(QWidget *parent) : - PanelWidget(QStringLiteral("ProjectPanel"), parent) + PanelWidget(QStringLiteral("PixelSamplerPanel"), parent) { sampler_widget_ = new ManagedPixelSamplerWidget(); SetWidgetWithPadding(sampler_widget_); diff --git a/app/panel/viewer/viewer.cpp b/app/panel/viewer/viewer.cpp index d23981aab..3d2bf8561 100644 --- a/app/panel/viewer/viewer.cpp +++ b/app/panel/viewer/viewer.cpp @@ -24,24 +24,6 @@ namespace olive { ViewerPanel::ViewerPanel(const QString &object_name, QWidget *parent) : ViewerPanelBase(object_name, parent) -{ - Init(); -} - -ViewerPanel::ViewerPanel(QWidget *parent) : - ViewerPanelBase(QStringLiteral("ViewerPanel"), parent) -{ - Init(); -} - -void ViewerPanel::Retranslate() -{ - ViewerPanelBase::Retranslate(); - - SetTitle(tr("Viewer")); -} - -void ViewerPanel::Init() { // Set ViewerWidget as the central widget ViewerWidget* vw = new ViewerWidget(); @@ -52,4 +34,11 @@ void ViewerPanel::Init() Retranslate(); } +void ViewerPanel::Retranslate() +{ + ViewerPanelBase::Retranslate(); + + SetTitle(tr("Viewer")); +} + } diff --git a/app/panel/viewer/viewer.h b/app/panel/viewer/viewer.h index a0f1d99bd..3b1cc4eb5 100644 --- a/app/panel/viewer/viewer.h +++ b/app/panel/viewer/viewer.h @@ -34,14 +34,14 @@ class ViewerPanel : public ViewerPanelBase { Q_OBJECT public: ViewerPanel(const QString& object_name, QWidget* parent); - ViewerPanel(QWidget* parent); + ViewerPanel(QWidget *parent) : + ViewerPanel(QStringLiteral("ViewerPanel"), parent) + { + } protected: virtual void Retranslate() override; -private: - void Init(); - }; } diff --git a/app/widget/nodeview/nodeview.cpp b/app/widget/nodeview/nodeview.cpp index d0e85fc37..c87b8ccd5 100644 --- a/app/widget/nodeview/nodeview.cpp +++ b/app/widget/nodeview/nodeview.cpp @@ -26,7 +26,6 @@ #include #include -#include "dialog/nodegroup/nodegroupdialog.h" #include "nodeviewundo.h" #include "node/audio/volume/volume.h" #include "node/distort/transform/transformdistortnode.h" @@ -49,7 +48,6 @@ NodeView::NodeView(QWidget *parent) : create_edge_output_item_(nullptr), create_edge_input_item_(nullptr), paste_command_(nullptr), - undo_stack_(Core::instance()->undo_stack()), scale_(1.0) { setScene(&scene_); @@ -133,7 +131,7 @@ void NodeView::DeleteSelected() ctx->DeleteSelected(command); } - undo_stack_->push(command); + Core::instance()->undo_stack()->push(command); } void NodeView::SelectAll() @@ -227,7 +225,7 @@ void NodeView::SetColorLabel(int index) command->add_child(new NodeOverrideColorCommand(node, index)); } - undo_stack_->push(command); + Core::instance()->undo_stack()->push(command); } void NodeView::ZoomIn() @@ -282,7 +280,7 @@ void NodeView::keyPressEvent(QKeyEvent *event) } } } - undo_stack_->pushIfHasChildren(pos_command); + Core::instance()->undo_stack()->pushIfHasChildren(pos_command); break; } case Qt::Key_Escape: @@ -561,7 +559,7 @@ void NodeView::mouseReleaseEvent(QMouseEvent *event) } create_edge_expanded_items_.clear(); - undo_stack_->pushIfHasChildren(command); + Core::instance()->undo_stack()->pushIfHasChildren(command); } MultiUndoCommand* command = new MultiUndoCommand(); @@ -645,7 +643,7 @@ void NodeView::mouseReleaseEvent(QMouseEvent *event) } dragging_items_.clear(); - undo_stack_->pushIfHasChildren(command); + Core::instance()->undo_stack()->pushIfHasChildren(command); super::mouseReleaseEvent(event); } @@ -1234,11 +1232,9 @@ void NodeView::GroupNodes() command->add_child(new NodeSetPositionCommand(group, context, avg_pos)); // Do command - command->redo_now(); + Core::instance()->LabelNodes({group}, command); - NodeGroupDialog ngd(group, this); - ngd.PrependUndoCommand(command); - ngd.exec(); + Core::instance()->undo_stack()->push(command); } void NodeView::UngroupNodes() @@ -1273,7 +1269,7 @@ void NodeView::UngroupNodes() command->add_child(new NodeSetPositionCommand(it.key(), context, group->GetNodePositionDataInContext(it.key()))); } - undo_stack_->push(command); + Core::instance()->undo_stack()->push(command); } void NodeView::ShowNodeProperties() @@ -1281,8 +1277,7 @@ void NodeView::ShowNodeProperties() Node *first_node = selected_nodes_.first(); if (NodeGroup *group = dynamic_cast(first_node)) { - NodeGroupDialog ngd(group, this); - ngd.exec(); + qDebug() << "STUB!"; } else { LabelSelectedNodes(); } diff --git a/app/widget/nodeview/nodeview.h b/app/widget/nodeview/nodeview.h index 02118ba45..23e03964a 100644 --- a/app/widget/nodeview/nodeview.h +++ b/app/widget/nodeview/nodeview.h @@ -77,11 +77,6 @@ public: void ZoomOut(); - void OverrideUndoStack(UndoStack *stack) - { - undo_stack_ = stack; - } - const QVector &GetCurrentContexts() const { return contexts_; @@ -195,8 +190,6 @@ private: QMap dragging_items_; - UndoStack *undo_stack_; - double scale_; static const double kMinimumScale; diff --git a/app/widget/panel/panel.cpp b/app/widget/panel/panel.cpp index 3009a3fb3..4ce4cd405 100644 --- a/app/widget/panel/panel.cpp +++ b/app/widget/panel/panel.cpp @@ -28,6 +28,8 @@ #include #include +#include "panel/panelmanager.h" + namespace olive { PanelWidget::PanelWidget(const QString &object_name, QWidget *parent) : @@ -39,6 +41,13 @@ PanelWidget::PanelWidget(const QString &object_name, QWidget *parent) : setFocusPolicy(Qt::ClickFocus); connect(this, &PanelWidget::visibilityChanged, this, &PanelWidget::PanelVisibilityChanged); + + PanelManager::instance()->RegisterPanel(this); +} + +PanelWidget::~PanelWidget() +{ + PanelManager::instance()->UnregisterPanel(this); } void PanelWidget::SetMovementLocked(bool locked) diff --git a/app/widget/panel/panel.h b/app/widget/panel/panel.h index 87690bf0d..130e3eaf8 100644 --- a/app/widget/panel/panel.h +++ b/app/widget/panel/panel.h @@ -45,6 +45,8 @@ public: */ PanelWidget(const QString& object_name, QWidget* parent); + virtual ~PanelWidget() override; + /** * @brief Set whether panel movement is locked or not */ diff --git a/app/widget/viewer/viewerdisplay.cpp b/app/widget/viewer/viewerdisplay.cpp index 4c9b21654..721903b2c 100644 --- a/app/widget/viewer/viewerdisplay.cpp +++ b/app/widget/viewer/viewerdisplay.cpp @@ -273,7 +273,7 @@ void ViewerDisplayWidget::mouseReleaseEvent(QMouseEvent *event) // Handle gizmo MultiUndoCommand *command = new MultiUndoCommand(); gizmos_->GizmoRelease(command); - undo_stack()->pushIfHasChildren(command); + Core::instance()->undo_stack()->pushIfHasChildren(command); gizmo_click_ = false; } else { diff --git a/app/window/mainwindow/mainwindow.cpp b/app/window/mainwindow/mainwindow.cpp index 6b4fd9883..1447895fe 100644 --- a/app/window/mainwindow/mainwindow.cpp +++ b/app/window/mainwindow/mainwindow.cpp @@ -78,17 +78,17 @@ MainWindow::MainWindow(QWidget *parent) : setStatusBar(status_bar); // Create standard panels - node_panel_ = new NodePanel(undo_stack_, this); - footage_viewer_panel_ = new FootageViewerPanel(undo_stack_, this); - param_panel_ = new ParamPanel(undo_stack_, this); - curve_panel_ = new CurvePanel(undo_stack_, this); - sequence_viewer_panel_ = new SequenceViewerPanel(undo_stack_, this); - pixel_sampler_panel_ = new PixelSamplerPanel(undo_stack_, this); + node_panel_ = new NodePanel(this); + footage_viewer_panel_ = new FootageViewerPanel(this); + param_panel_ = new ParamPanel(this); + curve_panel_ = new CurvePanel(this); + sequence_viewer_panel_ = new SequenceViewerPanel(this); + pixel_sampler_panel_ = new PixelSamplerPanel(this); AppendProjectPanel(); - tool_panel_ = new ToolPanel(undo_stack_, this); - task_man_panel_ = new TaskManagerPanel(undo_stack_, this); + tool_panel_ = new ToolPanel(this); + task_man_panel_ = new TaskManagerPanel(this); AppendTimelinePanel(); - audio_monitor_panel_ = new AudioMonitorPanel(undo_stack_, this); + audio_monitor_panel_ = new AudioMonitorPanel(this); // Make node-related connections connect(node_panel_, &NodePanel::NodesSelected, param_panel_, &ParamPanel::SelectNodes); @@ -218,7 +218,7 @@ bool MainWindow::IsSequenceOpen(Sequence *sequence) const void MainWindow::FolderOpen(Project* p, Folder *i, bool floating) { - ProjectPanel* panel = new ProjectPanel(undo_stack_, this); + ProjectPanel* panel = new ProjectPanel(this); panel->set_project(p); panel->set_root(i); @@ -256,7 +256,7 @@ void MainWindow::OpenNodeInViewer(ViewerOutput *node) viewer_panels_.value(node)->raise(); } else { // Create a viewer for this node - ViewerPanel* viewer = new ViewerPanel(undo_stack_, this); + ViewerPanel* viewer = new ViewerPanel(this); viewer->SetSignalInsteadOfClose(true); viewer->setFloating(true); @@ -816,7 +816,7 @@ void MainWindow::showEvent(QShowEvent *e) template T *MainWindow::AppendPanelInternal(QList& list) { - T* panel = new T(undo_stack_, this); + T* panel = new T(this); if (!list.isEmpty()) { tabifyDockWidget(list.last(), panel); @@ -837,7 +837,7 @@ T *MainWindow::AppendPanelInternal(QList& list) template T *MainWindow::AppendFloatingPanelInternal(QList &list) { - T* panel = new T(undo_stack_, this); + T* panel = new T(this); panel->setFloating(true); panel->show();