Browse Source

network dialog: replace protocol list with checkbox

283
ThomasV 10 years ago
parent
commit
9a7f6afac3
  1. 26
      gui/qt/network_dialog.py

26
gui/qt/network_dialog.py

@ -82,21 +82,19 @@ class NetworkDialog(QDialog):
grid.setSpacing(8)
vbox.addLayout(grid)
# protocol
self.server_protocol = QComboBox()
# server
self.server_host = QLineEdit()
self.server_host.setFixedWidth(200)
self.server_port = QLineEdit()
self.server_port.setFixedWidth(60)
self.server_protocol.addItems(protocol_names)
self.server_protocol.connect(self.server_protocol, SIGNAL('currentIndexChanged(int)'), self.change_protocol)
grid.addWidget(QLabel(_('Protocol') + ':'), 3, 0)
grid.addWidget(self.server_protocol, 3, 1)
# server
grid.addWidget(QLabel(_('Server') + ':'), 0, 0)
# use SSL
self.ssl_cb = QCheckBox(_('Use SSL'))
self.ssl_cb.setChecked(auto_connect)
grid.addWidget(self.ssl_cb, 3, 1)
self.ssl_cb.stateChanged.connect(self.change_protocol)
# auto connect
self.autocycle_cb = QCheckBox(_('Auto-connect'))
self.autocycle_cb.setChecked(auto_connect)
@ -129,7 +127,7 @@ class NetworkDialog(QDialog):
self.server_port.setEnabled(enabled)
self.servers_list_widget.setEnabled(enabled)
else:
for w in [self.autocycle_cb, self.server_host, self.server_port, self.server_protocol, self.servers_list_widget]:
for w in [self.autocycle_cb, self.server_host, self.server_port, self.ssl_cb, self.servers_list_widget]:
w.setEnabled(False)
self.autocycle_cb.clicked.connect(enable_set_server)
@ -183,8 +181,8 @@ class NetworkDialog(QDialog):
self.protocol = protocol
self.init_servers_list()
def change_protocol(self, index):
p = protocol_letters[index]
def change_protocol(self, use_ssl):
p = 's' if use_ssl else 't'
host = unicode(self.server_host.text())
pp = self.servers.get(host, DEFAULT_PORTS)
if p not in pp.keys():
@ -218,7 +216,7 @@ class NetworkDialog(QDialog):
self.server_host.setText( host )
self.server_port.setText( port )
self.server_protocol.setCurrentIndex(protocol_letters.index(protocol))
self.ssl_cb.setChecked(protocol=='s')
def do_exec(self):
@ -228,7 +226,7 @@ class NetworkDialog(QDialog):
host = str( self.server_host.text() )
port = str( self.server_port.text() )
protocol = protocol_letters[self.server_protocol.currentIndex()]
protocol = 's' if self.ssl_cb.isChecked() else 't'
if self.proxy_mode.currentText() != 'NONE':
proxy = { 'mode':str(self.proxy_mode.currentText()).lower(),

Loading…
Cancel
Save