began work on node view panel

This commit is contained in:
itsmattkc
2019-07-14 10:14:57 -04:00
parent f2d11662c9
commit f0bf51e4a6
15 changed files with 312 additions and 4 deletions
+10
View File
@@ -24,3 +24,13 @@ NodeGraph::NodeGraph()
{
}
const QString &NodeGraph::name()
{
return name_;
}
void NodeGraph::set_name(const QString &name)
{
name_ = name;
}
+4
View File
@@ -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
+1
View File
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
add_subdirectory(node)
add_subdirectory(project)
add_subdirectory(taskmanager)
add_subdirectory(timeline)
+22
View File
@@ -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 <http://www.gnu.org/licenses/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
panel/node/node.h
panel/node/node.cpp
PARENT_SCOPE
)
+55
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#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)"));
}
+47
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#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
+1
View File
@@ -16,6 +16,7 @@
add_subdirectory(flowlayout)
add_subdirectory(menu)
add_subdirectory(nodeview)
add_subdirectory(panel)
add_subdirectory(playbackcontrols)
add_subdirectory(projectexplorer)
+24
View File
@@ -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 <http://www.gnu.org/licenses/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
widget/nodeview/nodeview.h
widget/nodeview/nodeview.cpp
widget/nodeview/nodeviewitem.h
widget/nodeview/nodeviewitem.cpp
PARENT_SCOPE
)
+42
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "nodeview.h"
#include <QGraphicsRectItem>
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;
}
+41
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#ifndef NODEVIEW_H
#define NODEVIEW_H
#include <QGraphicsView>
#include "node/graph.h"
class NodeView : public QGraphicsView
{
public:
NodeView(QWidget* parent);
void SetGraph(NodeGraph* graph);
private:
NodeGraph* graph_;
QGraphicsScene scene_;
};
#endif // NODEVIEW_H
+26
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "nodeviewitem.h"
NodeViewItem::NodeViewItem()
{
}
+30
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#ifndef NODEVIEWITEM_H
#define NODEVIEWITEM_H
class NodeViewItem
{
public:
NodeViewItem();
};
#endif // NODEVIEWITEM_H
+1
View File
@@ -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"));
+8 -4
View File
@@ -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
}
Binary file not shown.