From ea12a4ef9df4ec82e14165e0309d68d0398378d3 Mon Sep 17 00:00:00 2001 From: Et0h Date: Sun, 30 Aug 2015 13:21:56 +0100 Subject: [PATCH] List official public servers in host combobox --- syncplay/constants.py | 1 + syncplay/ui/GuiConfiguration.py | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/syncplay/constants.py b/syncplay/constants.py index fc7836b..52d8977 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -16,6 +16,7 @@ SHOW_CONTACT_INFO = True # Displays dev contact details below list in GUI SHOW_TOOLTIPS = True WARN_ABOUT_MISSING_STRINGS = False # (If debug mode is enabled) FALLBACK_INITIAL_LANGUAGE = "en" +PUBLIC_SYNCPLAY_SERVERS = ["syncplay.pl:8995","syncplay.pl:8996","syncplay.pl:8997","syncplay.pl:8998","syncplay.pl:8999"] #Overriden by config SHOW_OSD = True # Sends Syncplay messages to media player OSD diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index cd55ae9..0895434 100644 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -250,7 +250,7 @@ class ConfigDialog(QtGui.QDialog): dialog.setComboBoxItems(serverTitles) ok = dialog.exec_() if ok: - self.hostTextbox.setText(serverDict[dialog.textValue()]) + self.hostCombobox.setEditText(serverDict[dialog.textValue()]) def showErrorMessage(self, errorMessage): QtGui.QMessageBox.warning(self, "Syncplay", errorMessage) @@ -284,8 +284,8 @@ class ConfigDialog(QtGui.QDialog): self.config["mediaSearchDirectories"] = utils.convertMultilineStringToList(self.mediasearchTextEdit.toPlainText()) self.processWidget(self, lambda w: self.saveValues(w)) - if self.hostTextbox.text(): - self.config['host'] = self.hostTextbox.text() if ":" in self.hostTextbox.text() else self.hostTextbox.text() + ":" + unicode(constants.DEFAULT_PORT) + if self.hostCombobox.currentText(): + self.config['host'] = self.hostCombobox.currentText() if ":" in self.hostCombobox.currentText() else self.hostCombobox.currentText() + ":" + unicode(constants.DEFAULT_PORT) else: self.config['host'] = None self.config['playerPath'] = unicode(self.safenormcaseandpath(self.executablepathCombobox.currentText())) @@ -416,7 +416,11 @@ class ConfigDialog(QtGui.QDialog): self.mediaSearchDirectories = self.config["mediaSearchDirectories"] self.connectionSettingsGroup = QtGui.QGroupBox(getMessage("connection-group-title")) - self.hostTextbox = QLineEdit(host, self) + self.hostCombobox = QtGui.QComboBox(self) + self.hostCombobox.addItems(constants.PUBLIC_SYNCPLAY_SERVERS) + self.hostCombobox.setEditable(True) + self.hostCombobox.setEditText(host) + self.hostCombobox.setFixedWidth(165) self.hostLabel = QLabel(getMessage("host-label"), self) self.findServerButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'report_magnify.png'), getMessage("list-servers-label")) self.findServerButton.clicked.connect(self.findPublicServer) @@ -430,7 +434,7 @@ class ConfigDialog(QtGui.QDialog): self.defaultroomLabel = QLabel(getMessage("room-label"), self) self.hostLabel.setObjectName("host") - self.hostTextbox.setObjectName(constants.LOAD_SAVE_MANUALLY_MARKER + "host") + self.hostCombobox.setObjectName(constants.LOAD_SAVE_MANUALLY_MARKER + "host") self.usernameLabel.setObjectName("name") self.usernameTextbox.setObjectName("name") self.serverpassLabel.setObjectName("password") @@ -440,7 +444,7 @@ class ConfigDialog(QtGui.QDialog): self.connectionSettingsLayout = QtGui.QGridLayout() self.connectionSettingsLayout.addWidget(self.hostLabel, 0, 0) - self.connectionSettingsLayout.addWidget(self.hostTextbox, 0, 1) + self.connectionSettingsLayout.addWidget(self.hostCombobox, 0, 1) self.connectionSettingsLayout.addWidget(self.findServerButton, 0, 2) self.connectionSettingsLayout.addWidget(self.serverpassLabel, 1, 0) self.connectionSettingsLayout.addWidget(self.serverpassTextbox, 1, 1, 1, 2)