mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-21 19:30:26 +08:00
102 lines
2.5 KiB
C++
102 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include <QLabel>
|
|
|
|
#include "NodeDataModel.hpp"
|
|
#include "PortType.hpp"
|
|
|
|
#include "common/QvHelpers.hpp"
|
|
|
|
using QtNodes::PortType;
|
|
using QtNodes::PortIndex;
|
|
using QtNodes::NodeData;
|
|
using QtNodes::NodeDataType;
|
|
using QtNodes::NodeDataModel;
|
|
using QtNodes::NodeValidationState;
|
|
|
|
|
|
using QtNodes::NodeDataType;
|
|
using QtNodes::NodeData;
|
|
|
|
#define GRAPH_NODE_LABEL_FONTSIZE_INCREMENT 3
|
|
|
|
namespace Qv2ray::ui::nodemodels
|
|
{
|
|
const NodeDataType outboundType = {"outbound", "Outbound Object"};
|
|
const NodeDataType inboundType = {"inbound", "Inbound Object"};
|
|
/// The class can potentially incapsulate any user data
|
|
/// need to be transferred within the Node Editor graph
|
|
class InboundNodeData : public NodeData
|
|
{
|
|
public:
|
|
InboundNodeData()
|
|
{
|
|
DEBUG(GRAPH, "DANGER: Initialising a data model without value.")
|
|
}
|
|
InboundNodeData(QString in) : _inboundTag(in) { }
|
|
|
|
NodeDataType type() const override
|
|
{
|
|
return inboundType;
|
|
}
|
|
|
|
QString GetInbound()
|
|
{
|
|
return _inboundTag;
|
|
}
|
|
private:
|
|
QString _inboundTag;
|
|
};
|
|
|
|
/// The class can potentially incapsulate any user data
|
|
/// need to be transferred within the Node Editor graph
|
|
class OutboundNodeData : public NodeData
|
|
{
|
|
public:
|
|
OutboundNodeData() : _outboundTag()
|
|
{
|
|
DEBUG(GRAPH, "DANGER: Initialising a data model without value.")
|
|
}
|
|
OutboundNodeData(QString out) : _outboundTag(out) { }
|
|
|
|
NodeDataType type() const override
|
|
{
|
|
return outboundType;
|
|
}
|
|
|
|
QString GetOutbound()
|
|
{
|
|
return _outboundTag;
|
|
}
|
|
private:
|
|
QString _outboundTag;
|
|
};
|
|
|
|
/// The class can potentially incapsulate any user data
|
|
/// need to be transferred within the Node Editor graph
|
|
class RuleNodeData : public NodeData
|
|
{
|
|
public:
|
|
RuleNodeData() : _ruleTag()
|
|
{
|
|
DEBUG(GRAPH, "DANGER: Initialising a data model without value.")
|
|
}
|
|
RuleNodeData(QString out) : _ruleTag(out) { }
|
|
|
|
NodeDataType type() const override
|
|
{
|
|
return outboundType;
|
|
}
|
|
|
|
QString GetRuleTag()
|
|
{
|
|
return _ruleTag;
|
|
}
|
|
private:
|
|
QString _ruleTag;
|
|
};
|
|
}
|
|
|
|
|
|
using namespace Qv2ray::ui::nodemodels;
|