Don't prompt for password on known public servers

This commit is contained in:
Etoh 2017-10-15 14:08:06 +01:00
parent d48f6bd177
commit 39edc2c9e9

View File

@ -527,8 +527,12 @@ class ConfigDialog(QtGui.QDialog):
if self.publicServers:
i = 0
for publicServer in self.publicServers:
self.hostCombobox.addItem(publicServer[1])
self.hostCombobox.setItemData(i, publicServer[0], Qt.ToolTipRole)
serverTitle = publicServer[0]
serverAddressPort = publicServer[1]
self.hostCombobox.addItem(serverAddressPort)
self.hostCombobox.setItemData(i, serverTitle, Qt.ToolTipRole)
if not serverAddressPort in self.publicServerAddresses:
self.publicServerAddresses.append(serverAddressPort)
i += 1
self.hostCombobox.setEditable(True)
self.hostCombobox.setEditText(host)
@ -552,6 +556,8 @@ class ConfigDialog(QtGui.QDialog):
self.usernameTextbox.setObjectName("name")
self.serverpassLabel.setObjectName("password")
self.serverpassTextbox.setObjectName("password")
self.hostCombobox.editTextChanged.connect(self.updatePasswordVisibilty)
self.hostCombobox.currentIndexChanged.connect(self.updatePasswordVisibilty)
self.defaultroomLabel.setObjectName("room")
self.defaultroomTextbox.setObjectName("room")
@ -583,7 +589,6 @@ class ConfigDialog(QtGui.QDialog):
self.executablepathCombobox.setEditable(True)
self.executablepathCombobox.currentIndexChanged.connect(self.updateExecutableIcon)
self.executablepathCombobox.setEditText(self._tryToFillPlayerPath(config['playerPath'], playerpaths))
#bob
self.executablepathCombobox.setFixedWidth(250)
self.executablepathCombobox.editTextChanged.connect(self.updateExecutableIcon)
@ -1038,8 +1043,25 @@ class ConfigDialog(QtGui.QDialog):
for server in self.publicServers:
self.hostCombobox.addItem(server[1])
self.hostCombobox.setItemData(i, server[0], Qt.ToolTipRole)
if not server[1] in self.publicServerAddresses:
self.publicServerAddresses.append(server[1])
i += 1
self.hostCombobox.setEditText(currentServer)
def updatePasswordVisibilty(self):
if (self.hostCombobox.currentText() == "" and self.serverpassTextbox.text() == "") or unicode(self.hostCombobox.currentText()) in self.publicServerAddresses:
self.serverpassLabel.hide()
self.serverpassTextbox.hide()
self.serverpassTextbox.setText("")
else:
self.serverpassLabel.show()
self.serverpassTextbox.show()
newHeight = self.connectionSettingsGroup.minimumSizeHint().height()+self.mediaplayerSettingsGroup.minimumSizeHint().height()+self.bottomButtonFrame.minimumSizeHint().height()+3
if self.error:
newHeight += self.errorLabel.height()+3
self.stackedFrame.setFixedHeight(newHeight)
self.adjustSize()
self.setFixedSize(self.sizeHint())
def __init__(self, config, playerpaths, error, defaultConfig):
self.config = config
@ -1049,6 +1071,7 @@ class ConfigDialog(QtGui.QDialog):
self.config['resetConfig'] = False
self.subitems = {}
self.publicServers = None
self.publicServerAddresses = []
self._playerProbeThread = GetPlayerIconThread()
self._playerProbeThread.done.connect(self._updateExecutableIcon)
@ -1129,3 +1152,4 @@ class ConfigDialog(QtGui.QDialog):
self.processWidget(self, lambda w: self.loadValues(w))
self.processWidget(self, lambda w: self.connectChildren(w))
self.populateEmptyServerList()
self.updatePasswordVisibilty()