add: added GetData from NodeDispatcher

This commit is contained in:
QwQ 2020-08-02 11:35:01 +08:00
parent f4e5bd2f65
commit 35aac17c7e
No known key found for this signature in database
GPG Key ID: E7FAEFAFCD031D4B
4 changed files with 14 additions and 5 deletions

View File

@ -1 +1 @@
5844
5845

View File

@ -218,8 +218,11 @@ void RouteEditor::OnDispatcherEditChainRequested(const QString &id)
CONFIGROOT RouteEditor::OpenEditor()
{
auto result = this->exec();
if (result == QDialog::Accepted)
return original;
const auto &[in, rule, out] = nodeDispatcher->GetData();
auto x = nodeDispatcher->GetFullConfig();
// if (rules.isEmpty())
// {
// // Prevent empty rule list causing mis-detection of config type to

View File

@ -16,9 +16,15 @@ NodeDispatcher::~NodeDispatcher()
{
}
CONFIGROOT NodeDispatcher::GetFullConfig() const
std::tuple<QList<INBOUND>, QList<RuleObject>, QList<OutboundObjectMeta>> NodeDispatcher::GetData() const
{
return CONFIGROOT{};
QList<INBOUND> _inbounds;
QList<RuleObject> _rules;
QList<OutboundObjectMeta> _outbounds;
for (const auto &val : inbounds) _inbounds << *val;
for (const auto &val : rules) _rules << *val;
for (const auto &val : outbounds) _outbounds << *val;
return std::make_tuple(_inbounds, _rules, _outbounds);
}
void NodeDispatcher::LoadFullConfig(const CONFIGROOT &root)

View File

@ -20,7 +20,7 @@ class NodeDispatcher
}
public:
CONFIGROOT GetFullConfig() const;
std::tuple<QList<INBOUND>, QList<RuleObject>, QList<OutboundObjectMeta>> GetData() const;
void LoadFullConfig(const CONFIGROOT &);
[[nodiscard]] QString CreateInbound(INBOUND);
[[nodiscard]] QString CreateOutbound(OutboundObjectMeta);