2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Support many config endpoints for one dc+params.

This commit is contained in:
John Preston
2018-04-24 23:09:20 +04:00
parent 7482025c10
commit 93f6d4b6e7
21 changed files with 819 additions and 917 deletions

View File

@@ -87,7 +87,7 @@ bool ConnectionBox::badProxyValue() const {
void ConnectionBox::updateControlsVisibility() {
auto newHeight = st::boxOptionListPadding.top() + _autoRadio->heightNoMargins() + st::boxOptionListSkip + _httpProxyRadio->heightNoMargins() + st::boxOptionListSkip + _tcpProxyRadio->heightNoMargins() + st::boxOptionListSkip + st::connectionIPv6Skip + _tryIPv6->heightNoMargins() + st::defaultCheckbox.margin.bottom() + st::boxOptionListPadding.bottom() + st::boxPadding.bottom();
if (_typeGroup->value() == dbictAuto && badProxyValue()) {
if (!proxyFieldsVisible()) {
_hostInput->hide();
_portInput->hide();
_userInput->hide();
@@ -104,6 +104,13 @@ void ConnectionBox::updateControlsVisibility() {
updateControlsPosition();
}
bool ConnectionBox::proxyFieldsVisible() const {
return (_typeGroup->value() != dbictAuto)
|| (!badProxyValue()
&& (_currentProxyType == ProxyData::Type::Http
|| _currentProxyType == ProxyData::Type::Socks5));
}
void ConnectionBox::setInnerFocus() {
if (_typeGroup->value() == dbictAuto) {
setFocus();
@@ -124,7 +131,7 @@ void ConnectionBox::updateControlsPosition() {
_httpProxyRadio->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _autoRadio->bottomNoMargins() + st::boxOptionListSkip);
auto inputy = 0;
auto fieldsVisible = (type != dbictAuto) || (!badProxyValue() && _currentProxyType != ProxyData::Type::None);
auto fieldsVisible = proxyFieldsVisible();
auto fieldsBelowHttp = fieldsVisible && (type == dbictHttpProxy || (type == dbictAuto && _currentProxyType == ProxyData::Type::Http));
auto fieldsBelowTcp = fieldsVisible && (type == dbictTcpProxy || (type == dbictAuto && _currentProxyType == ProxyData::Type::Socks5));
if (fieldsBelowHttp) {

View File

@@ -44,6 +44,7 @@ private:
void updateControlsVisibility();
void updateControlsPosition();
bool badProxyValue() const;
bool proxyFieldsVisible() const;
object_ptr<Ui::InputField> _hostInput;
object_ptr<Ui::PortInput> _portInput;