refactor: rename Network to NetworkPanel
This commit is contained in:
@@ -46,7 +46,7 @@ set(GUI_SOURCES
|
|||||||
src/Gui/Viewport/GLPoints.cpp
|
src/Gui/Viewport/GLPoints.cpp
|
||||||
src/Gui/Network/NetworkGraphicsView.cpp
|
src/Gui/Network/NetworkGraphicsView.cpp
|
||||||
src/Gui/Network/NetworkGraphicsScene.cpp
|
src/Gui/Network/NetworkGraphicsScene.cpp
|
||||||
src/Gui/Network/Network.cpp
|
src/Gui/Network/NetworkPanel.cpp
|
||||||
src/Gui/Network/NodeGraphic.cpp
|
src/Gui/Network/NodeGraphic.cpp
|
||||||
src/Gui/Network/SocketGraphic.cpp
|
src/Gui/Network/SocketGraphic.cpp
|
||||||
src/Gui/Network/NodeEdgeGraphic.cpp
|
src/Gui/Network/NodeEdgeGraphic.cpp
|
||||||
|
|||||||
2
build.sh
2
build.sh
@@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
cmake -DCMAKE_BUILD_TYPE=Build -G Ninja ..
|
cmake -DCMAKE_BUILD_TYPE=Debug -G Ninja ..
|
||||||
ninja
|
ninja
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "Gui/GeometrySpreadsheetPanel/GeometrySpreadsheetPanel.h"
|
#include "Gui/GeometrySpreadsheetPanel/GeometrySpreadsheetPanel.h"
|
||||||
#include "Gui/ParametersPanel/ParametersPanel.h"
|
#include "Gui/ParametersPanel/ParametersPanel.h"
|
||||||
#include "Gui/Viewport/Viewport.h"
|
#include "Gui/Viewport/Viewport.h"
|
||||||
#include "Gui/Network/Network.h"
|
#include "Gui/Network/NetworkPanel.h"
|
||||||
#include <qnamespace.h>
|
#include <qnamespace.h>
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
#include <qsplitter.h>
|
#include <qsplitter.h>
|
||||||
@@ -27,7 +27,7 @@ EnzoUI::EnzoUI()
|
|||||||
setStyleSheet("background-color:#1d2021;");
|
setStyleSheet("background-color:#1d2021;");
|
||||||
|
|
||||||
Viewport* viewport = new Viewport();
|
Viewport* viewport = new Viewport();
|
||||||
Network* network = new Network();
|
NetworkPanel* network = new NetworkPanel();
|
||||||
ParametersPanel* parametersPanel = new ParametersPanel();
|
ParametersPanel* parametersPanel = new ParametersPanel();
|
||||||
GeometrySpreadsheetPanel* geometrySpreadsheetPanel = new GeometrySpreadsheetPanel();
|
GeometrySpreadsheetPanel* geometrySpreadsheetPanel = new GeometrySpreadsheetPanel();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "Gui/Network/NetworkGraphicsView.h"
|
#include "Gui/Network/NetworkGraphicsView.h"
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include "Gui/Network/Network.h"
|
#include "Gui/Network/NetworkPanel.h"
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include "Gui/Network/NetworkGraphicsScene.h"
|
#include "Gui/Network/NetworkGraphicsScene.h"
|
||||||
#include "Gui/Network/SocketGraphic.h"
|
#include "Gui/Network/SocketGraphic.h"
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
NetworkGraphicsView::NetworkGraphicsView(QWidget *parent, Network* network, QGraphicsScene* scene)
|
NetworkGraphicsView::NetworkGraphicsView(QWidget *parent, NetworkPanel* network, QGraphicsScene* scene)
|
||||||
: QGraphicsView(parent), scene_{scene}, network_{network}
|
: QGraphicsView(parent), scene_{scene}, network_{network}
|
||||||
{
|
{
|
||||||
setScene(scene_);
|
setScene(scene_);
|
||||||
|
|||||||
@@ -4,19 +4,19 @@
|
|||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
|
|
||||||
class Network;
|
class NetworkPanel;
|
||||||
|
|
||||||
class NetworkGraphicsView
|
class NetworkGraphicsView
|
||||||
: public QGraphicsView
|
: public QGraphicsView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NetworkGraphicsView(QWidget *parent = nullptr, Network* network=nullptr, QGraphicsScene* scene = nullptr);
|
NetworkGraphicsView(QWidget *parent = nullptr, NetworkPanel* network=nullptr, QGraphicsScene* scene = nullptr);
|
||||||
QSize sizeHint() const override { return QSize(-1, -1); }
|
QSize sizeHint() const override { return QSize(-1, -1); }
|
||||||
private:
|
private:
|
||||||
QPointF panStartPos;
|
QPointF panStartPos;
|
||||||
void initUI();
|
void initUI();
|
||||||
QGraphicsScene* scene_;
|
QGraphicsScene* scene_;
|
||||||
Network* network_;
|
NetworkPanel* network_;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseMoveEvent(QMouseEvent *mouseEvent) override;
|
void mouseMoveEvent(QMouseEvent *mouseEvent) override;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "Gui/Network/Network.h"
|
#include "Gui/Network/NetworkPanel.h"
|
||||||
#include "Engine/Operator/GeometryConnection.h"
|
#include "Engine/Operator/GeometryConnection.h"
|
||||||
#include "Engine/Operator/GeometryOperator.h"
|
#include "Engine/Operator/GeometryOperator.h"
|
||||||
#include "Engine/Operator/OperatorTable.h"
|
#include "Engine/Operator/OperatorTable.h"
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
using namespace enzo;
|
using namespace enzo;
|
||||||
|
|
||||||
Network::Network(QWidget* parent)
|
NetworkPanel::NetworkPanel(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ Network::Network(QWidget* parent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Network::resizeEvent(QResizeEvent *event)
|
void NetworkPanel::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
constexpr float radius = 10;
|
constexpr float radius = 10;
|
||||||
@@ -56,7 +56,7 @@ void Network::resizeEvent(QResizeEvent *event)
|
|||||||
this->setMask(region);
|
this->setMask(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Network::deleteEdge(QGraphicsItem* edge)
|
void NetworkPanel::deleteEdge(QGraphicsItem* edge)
|
||||||
{
|
{
|
||||||
std::cout << "----\ndeleting edge\n";
|
std::cout << "----\ndeleting edge\n";
|
||||||
if(!edge) return;
|
if(!edge) return;
|
||||||
@@ -71,7 +71,7 @@ void Network::deleteEdge(QGraphicsItem* edge)
|
|||||||
std::cout << "finished deleting edge\n----\n";
|
std::cout << "finished deleting edge\n----\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Network::mousePressEvent(QMouseEvent *event)
|
void NetworkPanel::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if( event->buttons() & Qt::LeftButton)
|
if( event->buttons() & Qt::LeftButton)
|
||||||
{
|
{
|
||||||
@@ -80,7 +80,7 @@ void Network::mousePressEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Network::leftMousePressed(QMouseEvent *event)
|
void NetworkPanel::leftMousePressed(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
std::cout << "LEFT MOUSE PRESSED\n";
|
std::cout << "LEFT MOUSE PRESSED\n";
|
||||||
Qt::KeyboardModifiers mods = event->modifiers();
|
Qt::KeyboardModifiers mods = event->modifiers();
|
||||||
@@ -127,7 +127,7 @@ void Network::leftMousePressed(QMouseEvent *event)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Network::socketClicked(SocketGraphic* socket, QMouseEvent *event)
|
void NetworkPanel::socketClicked(SocketGraphic* socket, QMouseEvent *event)
|
||||||
{
|
{
|
||||||
std::cout << "socket clicked\n";
|
std::cout << "socket clicked\n";
|
||||||
// clicked first socket
|
// clicked first socket
|
||||||
@@ -168,7 +168,7 @@ void Network::socketClicked(SocketGraphic* socket, QMouseEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Network::destroyFloatingEdge()
|
void NetworkPanel::destroyFloatingEdge()
|
||||||
{
|
{
|
||||||
if(floatingEdge_)
|
if(floatingEdge_)
|
||||||
{
|
{
|
||||||
@@ -180,7 +180,7 @@ void Network::destroyFloatingEdge()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Network::mouseMoved(QMouseEvent *event)
|
void NetworkPanel::mouseMoved(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
// cache and reset prev hover items
|
// cache and reset prev hover items
|
||||||
std::unordered_set<QGraphicsItem*> prevHoverItems = prevHoverItems_;
|
std::unordered_set<QGraphicsItem*> prevHoverItems = prevHoverItems_;
|
||||||
@@ -256,7 +256,7 @@ void Network::mouseMoved(QMouseEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Network::moveNodes(QPointF pos)
|
void NetworkPanel::moveNodes(QPointF pos)
|
||||||
{
|
{
|
||||||
|
|
||||||
for(auto node : moveNodeBuffer)
|
for(auto node : moveNodeBuffer)
|
||||||
@@ -266,7 +266,7 @@ void Network::moveNodes(QPointF pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Network::keyPressEvent(QKeyEvent *event)
|
void NetworkPanel::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
// modifiers
|
// modifiers
|
||||||
Qt::KeyboardModifiers mods = event->modifiers();
|
Qt::KeyboardModifiers mods = event->modifiers();
|
||||||
@@ -339,7 +339,7 @@ void Network::keyPressEvent(QKeyEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeGraphic* Network::createNode(op::OpInfo opInfo)
|
NodeGraphic* NetworkPanel::createNode(op::OpInfo opInfo)
|
||||||
{
|
{
|
||||||
if(nt::OpId id = enzo::nt::nm().addOperator(opInfo))
|
if(nt::OpId id = enzo::nt::nm().addOperator(opInfo))
|
||||||
{
|
{
|
||||||
@@ -359,7 +359,7 @@ NodeGraphic* Network::createNode(op::OpInfo opInfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Network::keyReleaseEvent(QKeyEvent *event)
|
void NetworkPanel::keyReleaseEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
// modifiers
|
// modifiers
|
||||||
Qt::KeyboardModifiers mods = event->modifiers();
|
Qt::KeyboardModifiers mods = event->modifiers();
|
||||||
@@ -379,7 +379,7 @@ void Network::keyReleaseEvent(QKeyEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Network::mouseReleaseEvent(QMouseEvent *event)
|
void NetworkPanel::mouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
// std::cout << "----\nMOUSE RELEASED\n---\n";
|
// std::cout << "----\nMOUSE RELEASED\n---\n";
|
||||||
QList<QGraphicsItem*> hoverItems = view_->items(event->pos());
|
QList<QGraphicsItem*> hoverItems = view_->items(event->pos());
|
||||||
@@ -440,4 +440,4 @@ void Network::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Network::focusNextPrevChild(bool) { return false; }
|
bool NetworkPanel::focusNextPrevChild(bool) { return false; }
|
||||||
@@ -19,11 +19,11 @@
|
|||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include "Gui/Network/TabMenu.h"
|
#include "Gui/Network/TabMenu.h"
|
||||||
|
|
||||||
class Network
|
class NetworkPanel
|
||||||
: public QWidget
|
: public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Network(QWidget* parent = nullptr);
|
NetworkPanel(QWidget* parent = nullptr);
|
||||||
void socketClicked(SocketGraphic* socket, QMouseEvent *event);
|
void socketClicked(SocketGraphic* socket, QMouseEvent *event);
|
||||||
void mouseMoved(QMouseEvent *event);
|
void mouseMoved(QMouseEvent *event);
|
||||||
QSize sizeHint() const override { return QSize(-1, -1); }
|
QSize sizeHint() const override { return QSize(-1, -1); }
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <QSvgWidget>
|
#include <QSvgWidget>
|
||||||
#include "Gui/Network/TabMenu.h"
|
#include "Gui/Network/TabMenu.h"
|
||||||
#include "Engine/Operator/OperatorTable.h"
|
#include "Engine/Operator/OperatorTable.h"
|
||||||
#include "Gui/Network/Network.h"
|
#include "Gui/Network/NetworkPanel.h"
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -178,7 +178,7 @@ void enzo::ui::TabMenu::createNode(std::string nodeName)
|
|||||||
// check valid result
|
// check valid result
|
||||||
if(!opInfo.has_value()) {throw std::runtime_error("Couldn't find op info for: " + nodeName);}
|
if(!opInfo.has_value()) {throw std::runtime_error("Couldn't find op info for: " + nodeName);}
|
||||||
|
|
||||||
static_cast<Network*>(parentWidget())->createNode(opInfo.value());
|
static_cast<NetworkPanel*>(parentWidget())->createNode(opInfo.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void enzo::ui::TabMenu::nodeClicked()
|
void enzo::ui::TabMenu::nodeClicked()
|
||||||
|
|||||||
Reference in New Issue
Block a user