feature: added the ability to change port after installing xray (#1556)
* added the ability to change port after installing xray * fixed issue with not updating server config for xray on windows platform * fixed some warning in exportcontroller.cpp
This commit is contained in:
parent
0c73682cfc
commit
a28ed6a977
5 changed files with 44 additions and 12 deletions
|
@ -20,6 +20,7 @@ bool XrayConfigModel::setData(const QModelIndex &index, const QVariant &value, i
|
|||
|
||||
switch (role) {
|
||||
case Roles::SiteRole: m_protocolConfig.insert(config_key::site, value.toString()); break;
|
||||
case Roles::PortRole: m_protocolConfig.insert(config_key::port, value.toString()); break;
|
||||
}
|
||||
|
||||
emit dataChanged(index, index, QList { role });
|
||||
|
@ -34,6 +35,7 @@ QVariant XrayConfigModel::data(const QModelIndex &index, int role) const
|
|||
|
||||
switch (role) {
|
||||
case Roles::SiteRole: return m_protocolConfig.value(config_key::site).toString(protocols::xray::defaultSite);
|
||||
case Roles::PortRole: return m_protocolConfig.value(config_key::port).toString(protocols::xray::defaultPort);
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
|
@ -67,6 +69,7 @@ QHash<int, QByteArray> XrayConfigModel::roleNames() const
|
|||
QHash<int, QByteArray> roles;
|
||||
|
||||
roles[SiteRole] = "site";
|
||||
roles[PortRole] = "port";
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@ class XrayConfigModel : public QAbstractListModel
|
|||
|
||||
public:
|
||||
enum Roles {
|
||||
SiteRole
|
||||
SiteRole,
|
||||
PortRole
|
||||
};
|
||||
|
||||
explicit XrayConfigModel(QObject *parent = nullptr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue