From f0bf51e4a691ae7bca2400731f8b41668b000883 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sun, 14 Jul 2019 10:14:57 -0400 Subject: [PATCH] began work on node view panel --- app/node/graph.cpp | 10 +++++ app/node/graph.h | 4 ++ app/panel/CMakeLists.txt | 1 + app/panel/node/CMakeLists.txt | 22 +++++++++++ app/panel/node/node.cpp | 55 +++++++++++++++++++++++++++ app/panel/node/node.h | 47 +++++++++++++++++++++++ app/widget/CMakeLists.txt | 1 + app/widget/nodeview/CMakeLists.txt | 24 ++++++++++++ app/widget/nodeview/nodeview.cpp | 42 ++++++++++++++++++++ app/widget/nodeview/nodeview.h | 41 ++++++++++++++++++++ app/widget/nodeview/nodeviewitem.cpp | 26 +++++++++++++ app/widget/nodeview/nodeviewitem.h | 30 +++++++++++++++ app/window/mainwindow/mainmenu.cpp | 1 + app/window/mainwindow/mainwindow.cpp | 12 ++++-- history/history.db | Bin 0 -> 12288 bytes 15 files changed, 312 insertions(+), 4 deletions(-) create mode 100644 app/panel/node/CMakeLists.txt create mode 100644 app/panel/node/node.cpp create mode 100644 app/panel/node/node.h create mode 100644 app/widget/nodeview/CMakeLists.txt create mode 100644 app/widget/nodeview/nodeview.cpp create mode 100644 app/widget/nodeview/nodeview.h create mode 100644 app/widget/nodeview/nodeviewitem.cpp create mode 100644 app/widget/nodeview/nodeviewitem.h create mode 100644 history/history.db diff --git a/app/node/graph.cpp b/app/node/graph.cpp index eebd60340..fc1ddf527 100644 --- a/app/node/graph.cpp +++ b/app/node/graph.cpp @@ -24,3 +24,13 @@ NodeGraph::NodeGraph() { } + +const QString &NodeGraph::name() +{ + return name_; +} + +void NodeGraph::set_name(const QString &name) +{ + name_ = name; +} diff --git a/app/node/graph.h b/app/node/graph.h index b70026317..73b38d8b4 100644 --- a/app/node/graph.h +++ b/app/node/graph.h @@ -28,7 +28,11 @@ class NodeGraph : public QObject public: NodeGraph(); + const QString& name(); + void set_name(const QString& name); + private: + QString name_; }; #endif // NODEGRAPH_H diff --git a/app/panel/CMakeLists.txt b/app/panel/CMakeLists.txt index 49d1f651c..f93581c56 100644 --- a/app/panel/CMakeLists.txt +++ b/app/panel/CMakeLists.txt @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +add_subdirectory(node) add_subdirectory(project) add_subdirectory(taskmanager) add_subdirectory(timeline) diff --git a/app/panel/node/CMakeLists.txt b/app/panel/node/CMakeLists.txt new file mode 100644 index 000000000..23f0f7f7a --- /dev/null +++ b/app/panel/node/CMakeLists.txt @@ -0,0 +1,22 @@ +# Olive - Non-Linear Video Editor +# Copyright (C) 2019 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} + panel/node/node.h + panel/node/node.cpp + PARENT_SCOPE +) diff --git a/app/panel/node/node.cpp b/app/panel/node/node.cpp new file mode 100644 index 000000000..54ba33beb --- /dev/null +++ b/app/panel/node/node.cpp @@ -0,0 +1,55 @@ +/*** + + Olive - Non-Linear Video Editor + Copyright (C) 2019 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 "node.h" + +NodePanel::NodePanel(QWidget *parent) : + PanelWidget(parent) +{ + // Create NodeView widget + node_view_ = new NodeView(this); + + // Set it as the main widget of this panel + setWidget(node_view_); + + // Set strings + Retranslate(); +} + +void NodePanel::SetGraph(NodeGraph *graph) +{ + SetSubtitle(graph->name()); + + node_view_->SetGraph(graph); +} + +void NodePanel::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + Retranslate(); + } + QDockWidget::changeEvent(e); +} + +void NodePanel::Retranslate() +{ + SetTitle(tr("Node Editor")); + SetSubtitle(tr("(none)")); +} diff --git a/app/panel/node/node.h b/app/panel/node/node.h new file mode 100644 index 000000000..28a59fd70 --- /dev/null +++ b/app/panel/node/node.h @@ -0,0 +1,47 @@ +/*** + + Olive - Non-Linear Video Editor + Copyright (C) 2019 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 NODEPANEL_H +#define NODEPANEL_H + +#include "widget/nodeview/nodeview.h" +#include "widget/panel/panel.h" + +/** + * @brief A PanelWidget wrapper around a NodeView + */ +class NodePanel : public PanelWidget +{ + Q_OBJECT +public: + NodePanel(QWidget* parent); + + void SetGraph(NodeGraph* graph); + +protected: + virtual void changeEvent(QEvent* e) override; + +private: + void Retranslate(); + + NodeView* node_view_; +}; + +#endif // NODEPANEL_H diff --git a/app/widget/CMakeLists.txt b/app/widget/CMakeLists.txt index 1b230fe0d..9092485ec 100644 --- a/app/widget/CMakeLists.txt +++ b/app/widget/CMakeLists.txt @@ -16,6 +16,7 @@ add_subdirectory(flowlayout) add_subdirectory(menu) +add_subdirectory(nodeview) add_subdirectory(panel) add_subdirectory(playbackcontrols) add_subdirectory(projectexplorer) diff --git a/app/widget/nodeview/CMakeLists.txt b/app/widget/nodeview/CMakeLists.txt new file mode 100644 index 000000000..4d0a86e64 --- /dev/null +++ b/app/widget/nodeview/CMakeLists.txt @@ -0,0 +1,24 @@ +# Olive - Non-Linear Video Editor +# Copyright (C) 2019 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} + widget/nodeview/nodeview.h + widget/nodeview/nodeview.cpp + widget/nodeview/nodeviewitem.h + widget/nodeview/nodeviewitem.cpp + PARENT_SCOPE +) diff --git a/app/widget/nodeview/nodeview.cpp b/app/widget/nodeview/nodeview.cpp new file mode 100644 index 000000000..7093da329 --- /dev/null +++ b/app/widget/nodeview/nodeview.cpp @@ -0,0 +1,42 @@ +/*** + + Olive - Non-Linear Video Editor + Copyright (C) 2019 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 "nodeview.h" + +#include + +NodeView::NodeView(QWidget *parent) : + QGraphicsView(parent), + graph_(nullptr) +{ + setScene(&scene_); + + QGraphicsRectItem* rect = scene_.addRect(0, 0, 50, 50, QPen(Qt::red), Qt::blue); + + QGraphicsTextItem* text = scene_.addText("text"); + + QGraphicsItemGroup* group = scene_.createItemGroup({rect, text}); + group->setFlag(QGraphicsItem::ItemIsMovable); +} + +void NodeView::SetGraph(NodeGraph *graph) +{ + graph_ = graph; +} diff --git a/app/widget/nodeview/nodeview.h b/app/widget/nodeview/nodeview.h new file mode 100644 index 000000000..1dfaf0367 --- /dev/null +++ b/app/widget/nodeview/nodeview.h @@ -0,0 +1,41 @@ +/*** + + Olive - Non-Linear Video Editor + Copyright (C) 2019 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 NODEVIEW_H +#define NODEVIEW_H + +#include + +#include "node/graph.h" + +class NodeView : public QGraphicsView +{ +public: + NodeView(QWidget* parent); + + void SetGraph(NodeGraph* graph); + +private: + NodeGraph* graph_; + + QGraphicsScene scene_; +}; + +#endif // NODEVIEW_H diff --git a/app/widget/nodeview/nodeviewitem.cpp b/app/widget/nodeview/nodeviewitem.cpp new file mode 100644 index 000000000..1be5c61d5 --- /dev/null +++ b/app/widget/nodeview/nodeviewitem.cpp @@ -0,0 +1,26 @@ +/*** + + Olive - Non-Linear Video Editor + Copyright (C) 2019 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 "nodeviewitem.h" + +NodeViewItem::NodeViewItem() +{ + +} diff --git a/app/widget/nodeview/nodeviewitem.h b/app/widget/nodeview/nodeviewitem.h new file mode 100644 index 000000000..426db14a4 --- /dev/null +++ b/app/widget/nodeview/nodeviewitem.h @@ -0,0 +1,30 @@ +/*** + + Olive - Non-Linear Video Editor + Copyright (C) 2019 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 NODEVIEWITEM_H +#define NODEVIEWITEM_H + +class NodeViewItem +{ +public: + NodeViewItem(); +}; + +#endif // NODEVIEWITEM_H diff --git a/app/window/mainwindow/mainmenu.cpp b/app/window/mainwindow/mainmenu.cpp index c07ee06a1..f710e2ef5 100644 --- a/app/window/mainwindow/mainmenu.cpp +++ b/app/window/mainwindow/mainmenu.cpp @@ -402,6 +402,7 @@ void MainMenu::Retranslate() tools_pointer_item_->setText(tr("Pointer Tool")); tools_edit_item_->setText(tr("Edit Tool")); tools_ripple_item_->setText(tr("Ripple Tool")); + tools_rolling_item_->setText(tr("Rolling Tool")); tools_razor_item_->setText(tr("Razor Tool")); tools_slip_item_->setText(tr("Slip Tool")); tools_slide_item_->setText(tr("Slide Tool")); diff --git a/app/window/mainwindow/mainwindow.cpp b/app/window/mainwindow/mainwindow.cpp index 193f9f2f3..b9c4469e3 100644 --- a/app/window/mainwindow/mainwindow.cpp +++ b/app/window/mainwindow/mainwindow.cpp @@ -24,7 +24,7 @@ // Panel objects #include "panel/project/project.h" -#include "panel/taskmanager/taskmanager.h" +#include "panel/node/node.h" #include "panel/timeline/timeline.h" #include "panel/tool/tool.h" #include "panel/viewer/viewer.h" @@ -73,16 +73,20 @@ void olive::MainWindow::ProjectOpen(Project* p) ToolPanel* tool_panel = new ToolPanel(this); addDockWidget(Qt::BottomDockWidgetArea, tool_panel); - TaskManagerPanel* task_panel = new TaskManagerPanel(this); + NodePanel* task_panel = new NodePanel(this); addDockWidget(Qt::BottomDockWidgetArea, task_panel); TimelinePanel* timeline_panel = new TimelinePanel(this); addDockWidget(Qt::BottomDockWidgetArea, timeline_panel); // FIXME: Test code - ViewerOutput* vo = new ViewerOutput(this); + NodeGraph* graph = new NodeGraph(); + graph->setParent(this); + graph->set_name("New Graph"); + ViewerOutput* vo = new ViewerOutput(graph); vo->AttachViewer(viewer_panel2); - SolidGenerator* sg = new SolidGenerator(this); + SolidGenerator* sg = new SolidGenerator(graph); NodeInput::ConnectEdge(sg->texture_output(), vo->texture_input()); + task_panel->SetGraph(graph); // End test code } diff --git a/history/history.db b/history/history.db new file mode 100644 index 0000000000000000000000000000000000000000..0728003043ebf4271c8f464479f19f9e83ad9273 GIT binary patch literal 12288 zcmeI#OH0E*5Ww->C_V}$z4egG92Ha$y=yE13n9`xyoN|q2*d{4RlNG~{6-$lhQw>n zmjA#$CX+1eFQ-WsVP#5LHJjJM$c>sPt<}AVQcAbupdCZl{BTIx)#kfGtE*cXyFbct z6XhoE_pT49BY*$`2q1s}0tg_000Iag@J|GcKAw7>{<<^8OI?1Hn{Cys`^A~Xfu9DF z`VV0s{X;n$owhM#&wf06^ka#hQi-xKyy&XS!mO&gl%bkM^Fx!*98G;st7^S0 zKeumn+tugAyJ@;S@6XP!`;G1EPps$IP7^y32q1s}0tg_000IagfB*srAh53jBYQFW c|9$