Fix UI glitches and make password disabled rather than hidden on public servers

This commit is contained in:
Etoh 2017-10-18 22:35:27 +01:00
parent b34e49c636
commit 6d46df4d95
3 changed files with 23 additions and 13 deletions

View File

@ -1,4 +1,4 @@
version = '1.5.0'
milestone = 'Yoitsu'
release_number = '41'
release_number = '42'
projectURL = 'http://syncplay.pl/'

View File

@ -382,6 +382,8 @@ class ConfigDialog(QtGui.QDialog):
self.config["mediaSearchDirectories"] = utils.convertMultilineStringToList(self.mediasearchTextEdit.toPlainText())
self.config["trustedDomains"] = utils.convertMultilineStringToList(self.trusteddomainsTextEdit.toPlainText())
if self.serverpassTextbox.isEnabled():
self.config['password'] = self.serverpassTextbox.text()
self.processWidget(self, lambda w: self.saveValues(w))
if self.hostCombobox.currentText():
self.config['host'] = self.hostCombobox.currentText() if ":" in self.hostCombobox.currentText() else self.hostCombobox.currentText() + ":" + unicode(constants.DEFAULT_PORT)
@ -429,6 +431,13 @@ class ConfigDialog(QtGui.QDialog):
self.mediapathTextbox.show()
self.mediapathLabel.show()
self.mediabrowseButton.show()
if not self.showmoreCheckbox.isChecked():
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 processWidget(self, container, torun):
for widget in container.children():
@ -549,6 +558,7 @@ class ConfigDialog(QtGui.QDialog):
self.defaultroomTextbox = QLineEdit(self)
self.usernameLabel = QLabel(getMessage("name-label"), self)
self.serverpassTextbox = QLineEdit(self)
self.serverpassTextbox.setText(self.storedPassword)
self.defaultroomLabel = QLabel(getMessage("room-label"), self)
self.hostLabel.setObjectName("host")
@ -556,7 +566,7 @@ class ConfigDialog(QtGui.QDialog):
self.usernameLabel.setObjectName("name")
self.usernameTextbox.setObjectName("name")
self.serverpassLabel.setObjectName("password")
self.serverpassTextbox.setObjectName("password")
self.serverpassTextbox.setObjectName(constants.LOAD_SAVE_MANUALLY_MARKER + "password")
self.hostCombobox.editTextChanged.connect(self.updatePasswordVisibilty)
self.hostCombobox.currentIndexChanged.connect(self.updatePasswordVisibilty)
self.defaultroomLabel.setObjectName("room")
@ -1052,17 +1062,15 @@ class ConfigDialog(QtGui.QDialog):
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.setDisabled(True)
self.serverpassTextbox.setReadOnly(True)
if self.serverpassTextbox.text() != "":
self.storedPassword = self.serverpassTextbox.text()
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())
self.serverpassTextbox.setEnabled(True)
self.serverpassTextbox.setReadOnly(False)
self.serverpassTextbox.setText(self.storedPassword)
def __init__(self, config, playerpaths, error, defaultConfig):
self.config = config
@ -1105,6 +1113,7 @@ class ConfigDialog(QtGui.QDialog):
self.mainLayout.setSpacing(0)
self.mainLayout.setContentsMargins(0,0,0,0)
self.storedPassword = self.config['password']
self.addBasicTab()
self.addReadinessTab()
self.addSyncTab()
@ -1114,6 +1123,7 @@ class ConfigDialog(QtGui.QDialog):
self.mainLayout.addWidget(self.stackedFrame, 0, 1)
self.addBottomLayout()
self.updatePasswordVisibilty()
if self.getMoreState() == False:
self.tabListFrame.hide()
@ -1153,4 +1163,3 @@ class ConfigDialog(QtGui.QDialog):
self.processWidget(self, lambda w: self.loadValues(w))
self.processWidget(self, lambda w: self.connectChildren(w))
self.populateEmptyServerList()
self.updatePasswordVisibilty()

View File

@ -393,6 +393,7 @@ class MainWindow(QtGui.QMainWindow):
self.readyPushButton.setEnabled(False)
if not featureList["chat"]:
self.chatFrame.setEnabled(False)
self.chatInput.setReadOnly(True)
if not featureList["sharedPlaylists"]:
self.playlistGroup.setEnabled(False)