added local port field to v2ray settings page
- some code style refactoring
This commit is contained in:
parent
2b0ba2aff9
commit
36fae9152f
10 changed files with 88 additions and 65 deletions
|
|
@ -32,22 +32,21 @@ ErrorCode V2RayProtocol::start()
|
|||
|
||||
QStringList args = QStringList() << "-c" << m_v2RayConfigFile.fileName();
|
||||
|
||||
qDebug().noquote() << "V2RayProtocol::start()"
|
||||
<< v2RayExecPath() << args.join(" ");
|
||||
qDebug().noquote() << "V2RayProtocol::start()" << v2RayExecPath() << args.join(" ");
|
||||
|
||||
m_v2RayProcess.setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
||||
m_v2RayProcess.setProgram(v2RayExecPath());
|
||||
m_v2RayProcess.setArguments(args);
|
||||
|
||||
connect(&m_v2RayProcess, &QProcess::readyReadStandardOutput, this, [this](){
|
||||
connect(&m_v2RayProcess, &QProcess::readyReadStandardOutput, this, [this]() {
|
||||
qDebug().noquote() << "V2Ray:" << m_v2RayProcess.readAllStandardOutput();
|
||||
});
|
||||
|
||||
connect(&m_v2RayProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this](int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
qDebug().noquote() << "V2RayProtocol finished, exitCode, exiStatus" << exitCode << exitStatus;
|
||||
setConnectionState(VpnProtocol::Disconnected);
|
||||
if (exitStatus != QProcess::NormalExit){
|
||||
if (exitStatus != QProcess::NormalExit) {
|
||||
emit protocolError(amnezia::ErrorCode::V2RayExecutableCrashed);
|
||||
stop();
|
||||
}
|
||||
|
|
@ -64,7 +63,9 @@ ErrorCode V2RayProtocol::start()
|
|||
setConnectionState(VpnConnectionState::Connecting);
|
||||
|
||||
return OpenVpnProtocol::start();
|
||||
} else return ErrorCode::V2RayExecutableMissing;
|
||||
} else {
|
||||
return ErrorCode::V2RayExecutableMissing;
|
||||
}
|
||||
#else
|
||||
return ErrorCode::NotImplementedError;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue