fix, ui: fixed Inbound Settings Widgets' UI state

This commit is contained in:
QxQ 2020-12-04 20:17:07 +08:00
parent fa9205d426
commit 49fbf297e7
2 changed files with 43 additions and 38 deletions

View File

@ -1 +1 @@
6060 6062

View File

@ -96,43 +96,48 @@ PreferencesWindow::PreferencesWindow(QWidget *parent) : QvDialog("PreferenceWind
// //
listenIPTxt->setText(CurrentConfig.inboundConfig.listenip); listenIPTxt->setText(CurrentConfig.inboundConfig.listenip);
// //
bool have_http = CurrentConfig.inboundConfig.useHTTP; {
httpGroupBox->setChecked(have_http); const auto &httpSettings = CurrentConfig.inboundConfig.httpSettings;
httpPortLE->setValue(CurrentConfig.inboundConfig.httpSettings.port); const auto has_http = CurrentConfig.inboundConfig.useHTTP;
httpAuthCB->setChecked(CurrentConfig.inboundConfig.httpSettings.useAuth); httpGroupBox->setChecked(has_http);
httpPortLE->setValue(httpSettings.port);
httpAuthCB->setChecked(httpSettings.useAuth);
// //
httpAuthUsernameTxt->setEnabled(CurrentConfig.inboundConfig.httpSettings.useAuth); httpAuthUsernameTxt->setEnabled(has_http && httpSettings.useAuth);
httpAuthPasswordTxt->setEnabled(CurrentConfig.inboundConfig.httpSettings.useAuth); httpAuthPasswordTxt->setEnabled(has_http && httpSettings.useAuth);
httpAuthUsernameTxt->setText(CurrentConfig.inboundConfig.httpSettings.account.user); httpAuthUsernameTxt->setText(httpSettings.account.user);
httpAuthPasswordTxt->setText(CurrentConfig.inboundConfig.httpSettings.account.pass); httpAuthPasswordTxt->setText(httpSettings.account.pass);
httpSniffingCB->setChecked(CurrentConfig.inboundConfig.httpSettings.sniffing); httpSniffingCB->setChecked(httpSettings.sniffing);
}
{
const auto &socksSettings = CurrentConfig.inboundConfig.socksSettings;
const auto has_socks = CurrentConfig.inboundConfig.useSocks;
socksGroupBox->setChecked(has_socks);
socksPortLE->setValue(socksSettings.port);
// //
// socksAuthCB->setChecked(socksSettings.useAuth);
bool have_socks = CurrentConfig.inboundConfig.useSocks; socksAuthUsernameTxt->setEnabled(has_socks && socksSettings.useAuth);
socksGroupBox->setChecked(have_socks); socksAuthPasswordTxt->setEnabled(has_socks && socksSettings.useAuth);
socksPortLE->setValue(CurrentConfig.inboundConfig.socksSettings.port); socksAuthUsernameTxt->setText(socksSettings.account.user);
// socksAuthPasswordTxt->setText(socksSettings.account.pass);
socksAuthCB->setChecked(CurrentConfig.inboundConfig.socksSettings.useAuth);
socksAuthUsernameTxt->setEnabled(CurrentConfig.inboundConfig.socksSettings.useAuth);
socksAuthPasswordTxt->setEnabled(CurrentConfig.inboundConfig.socksSettings.useAuth);
socksAuthUsernameTxt->setText(CurrentConfig.inboundConfig.socksSettings.account.user);
socksAuthPasswordTxt->setText(CurrentConfig.inboundConfig.socksSettings.account.pass);
// Socks UDP Options // Socks UDP Options
socksUDPCB->setChecked(CurrentConfig.inboundConfig.socksSettings.enableUDP); socksUDPCB->setChecked(socksSettings.enableUDP);
socksUDPIP->setEnabled(CurrentConfig.inboundConfig.socksSettings.enableUDP); socksUDPIP->setEnabled(socksSettings.enableUDP);
socksUDPIP->setText(CurrentConfig.inboundConfig.socksSettings.localIP); socksUDPIP->setText(socksSettings.localIP);
socksSniffingCB->setChecked(CurrentConfig.inboundConfig.socksSettings.sniffing); socksSniffingCB->setChecked(socksSettings.sniffing);
// }
// {
bool have_tproxy = CurrentConfig.inboundConfig.useTPROXY; const auto &tProxySettings = CurrentConfig.inboundConfig.tProxySettings;
tproxGroupBox->setChecked(have_tproxy); const auto has_tproxy = CurrentConfig.inboundConfig.useTPROXY;
tproxyListenAddr->setText(CurrentConfig.inboundConfig.tProxySettings.tProxyIP); tproxGroupBox->setChecked(has_tproxy);
tproxyListenV6Addr->setText(CurrentConfig.inboundConfig.tProxySettings.tProxyV6IP); tproxyListenAddr->setText(tProxySettings.tProxyIP);
tProxyPort->setValue(CurrentConfig.inboundConfig.tProxySettings.port); tproxyListenV6Addr->setText(tProxySettings.tProxyV6IP);
tproxyEnableTCP->setChecked(CurrentConfig.inboundConfig.tProxySettings.hasTCP); tProxyPort->setValue(tProxySettings.port);
tproxyEnableUDP->setChecked(CurrentConfig.inboundConfig.tProxySettings.hasUDP); tproxyEnableTCP->setChecked(tProxySettings.hasTCP);
tproxySniffingCB->setChecked(CurrentConfig.inboundConfig.tProxySettings.sniffing); tproxyEnableUDP->setChecked(tProxySettings.hasUDP);
tproxyMode->setCurrentText(CurrentConfig.inboundConfig.tProxySettings.mode); tproxySniffingCB->setChecked(tProxySettings.sniffing);
tproxyMode->setCurrentText(tProxySettings.mode);
}
outboundMark->setValue(CurrentConfig.outboundConfig.mark); outboundMark->setValue(CurrentConfig.outboundConfig.mark);
// //
dnsIntercept->setChecked(CurrentConfig.defaultRouteConfig.connectionConfig.dnsIntercept); dnsIntercept->setChecked(CurrentConfig.defaultRouteConfig.connectionConfig.dnsIntercept);