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);
httpAuthUsernameTxt->setEnabled(CurrentConfig.inboundConfig.httpSettings.useAuth); httpAuthCB->setChecked(httpSettings.useAuth);
httpAuthPasswordTxt->setEnabled(CurrentConfig.inboundConfig.httpSettings.useAuth); //
httpAuthUsernameTxt->setText(CurrentConfig.inboundConfig.httpSettings.account.user); httpAuthUsernameTxt->setEnabled(has_http && httpSettings.useAuth);
httpAuthPasswordTxt->setText(CurrentConfig.inboundConfig.httpSettings.account.pass); httpAuthPasswordTxt->setEnabled(has_http && httpSettings.useAuth);
httpSniffingCB->setChecked(CurrentConfig.inboundConfig.httpSettings.sniffing); httpAuthUsernameTxt->setText(httpSettings.account.user);
// httpAuthPasswordTxt->setText(httpSettings.account.pass);
// httpSniffingCB->setChecked(httpSettings.sniffing);
bool have_socks = CurrentConfig.inboundConfig.useSocks; }
socksGroupBox->setChecked(have_socks); {
socksPortLE->setValue(CurrentConfig.inboundConfig.socksSettings.port); const auto &socksSettings = CurrentConfig.inboundConfig.socksSettings;
// const auto has_socks = CurrentConfig.inboundConfig.useSocks;
socksAuthCB->setChecked(CurrentConfig.inboundConfig.socksSettings.useAuth); socksGroupBox->setChecked(has_socks);
socksAuthUsernameTxt->setEnabled(CurrentConfig.inboundConfig.socksSettings.useAuth); socksPortLE->setValue(socksSettings.port);
socksAuthPasswordTxt->setEnabled(CurrentConfig.inboundConfig.socksSettings.useAuth); //
socksAuthUsernameTxt->setText(CurrentConfig.inboundConfig.socksSettings.account.user); socksAuthCB->setChecked(socksSettings.useAuth);
socksAuthPasswordTxt->setText(CurrentConfig.inboundConfig.socksSettings.account.pass); socksAuthUsernameTxt->setEnabled(has_socks && socksSettings.useAuth);
// Socks UDP Options socksAuthPasswordTxt->setEnabled(has_socks && socksSettings.useAuth);
socksUDPCB->setChecked(CurrentConfig.inboundConfig.socksSettings.enableUDP); socksAuthUsernameTxt->setText(socksSettings.account.user);
socksUDPIP->setEnabled(CurrentConfig.inboundConfig.socksSettings.enableUDP); socksAuthPasswordTxt->setText(socksSettings.account.pass);
socksUDPIP->setText(CurrentConfig.inboundConfig.socksSettings.localIP); // Socks UDP Options
socksSniffingCB->setChecked(CurrentConfig.inboundConfig.socksSettings.sniffing); socksUDPCB->setChecked(socksSettings.enableUDP);
// socksUDPIP->setEnabled(socksSettings.enableUDP);
// socksUDPIP->setText(socksSettings.localIP);
bool have_tproxy = CurrentConfig.inboundConfig.useTPROXY; socksSniffingCB->setChecked(socksSettings.sniffing);
tproxGroupBox->setChecked(have_tproxy); }
tproxyListenAddr->setText(CurrentConfig.inboundConfig.tProxySettings.tProxyIP); {
tproxyListenV6Addr->setText(CurrentConfig.inboundConfig.tProxySettings.tProxyV6IP); const auto &tProxySettings = CurrentConfig.inboundConfig.tProxySettings;
tProxyPort->setValue(CurrentConfig.inboundConfig.tProxySettings.port); const auto has_tproxy = CurrentConfig.inboundConfig.useTPROXY;
tproxyEnableTCP->setChecked(CurrentConfig.inboundConfig.tProxySettings.hasTCP); tproxGroupBox->setChecked(has_tproxy);
tproxyEnableUDP->setChecked(CurrentConfig.inboundConfig.tProxySettings.hasUDP); tproxyListenAddr->setText(tProxySettings.tProxyIP);
tproxySniffingCB->setChecked(CurrentConfig.inboundConfig.tProxySettings.sniffing); tproxyListenV6Addr->setText(tProxySettings.tProxyV6IP);
tproxyMode->setCurrentText(CurrentConfig.inboundConfig.tProxySettings.mode); tProxyPort->setValue(tProxySettings.port);
tproxyEnableTCP->setChecked(tProxySettings.hasTCP);
tproxyEnableUDP->setChecked(tProxySettings.hasUDP);
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);