Revise interface of port forwarder

This eases the usage of port forwarder as the caller code doesn't need
to store previous used port and now can rely on port forwarder doing
all the hard work.

PR #17967.
This commit is contained in:
Chocobo1
2022-11-05 11:33:21 +08:00
committed by GitHub
parent be0f34a69e
commit 99b7663fa9
5 changed files with 75 additions and 49 deletions

View File

@@ -29,6 +29,9 @@
#pragma once
#include <QObject>
#include <QSet>
class QString;
namespace Net
{
@@ -45,8 +48,8 @@ namespace Net
virtual bool isEnabled() const = 0;
virtual void setEnabled(bool enabled) = 0;
virtual void addPort(quint16 port) = 0;
virtual void deletePort(quint16 port) = 0;
virtual void setPorts(const QString &profile, QSet<quint16> ports) = 0;
virtual void removePorts(const QString &profile) = 0;
private:
static PortForwarder *m_instance;