mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 04:54:38 +03:00
upload code
This commit is contained in:
39
ui/edit/edit_shadowsocks.cpp
Normal file
39
ui/edit/edit_shadowsocks.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "edit_shadowsocks.h"
|
||||
#include "ui_edit_shadowsocks.h"
|
||||
|
||||
#include "fmt/ShadowSocksBean.hpp"
|
||||
|
||||
EditShadowSocks::EditShadowSocks(QWidget *parent) : QWidget(parent),
|
||||
ui(new Ui::EditShadowSocks) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
EditShadowSocks::~EditShadowSocks() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void EditShadowSocks::onStart(QSharedPointer<NekoRay::ProxyEntity> _ent) {
|
||||
this->ent = _ent;
|
||||
auto bean = this->ent->ShadowSocksBean();
|
||||
|
||||
ui->method->setCurrentText(bean->method);
|
||||
ui->password->setText(bean->password);
|
||||
auto ssPlugin = bean->plugin.split(";");
|
||||
if (!ssPlugin.empty()) {
|
||||
ui->plugin->setCurrentText(ssPlugin[0]);
|
||||
ui->plugin_opts->setText(SubStrAfter(bean->plugin, ";"));
|
||||
}
|
||||
}
|
||||
|
||||
bool EditShadowSocks::onEnd() {
|
||||
auto bean = this->ent->ShadowSocksBean();
|
||||
|
||||
bean->method = ui->method->currentText();
|
||||
bean->password = ui->password->text();
|
||||
bean->plugin = ui->plugin->currentText();
|
||||
if (!bean->plugin.isEmpty()) {
|
||||
bean->plugin += ";" + ui->plugin_opts->text();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user