From 4e4e3e44c4531a21c4f0d8e0f4c6d43297ea5b37 Mon Sep 17 00:00:00 2001 From: Et0h Date: Sun, 17 Jan 2016 23:47:12 +0000 Subject: [PATCH] Add "enable shared playlists" as a guiConfig option (and move 'run without storing' into its own button) --- syncplay/messages.py | 11 ++++++--- syncplay/ui/GuiConfiguration.py | 40 ++++++++++++++++----------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/syncplay/messages.py b/syncplay/messages.py index 7a3349b..18e11d9 100755 --- a/syncplay/messages.py +++ b/syncplay/messages.py @@ -175,6 +175,7 @@ en = { "player-arguments-label" : "Player arguments (if any):", "browse-label" : "Browse", "update-server-list-label" : u"Update list", + "sharedplaylistenabled-label" : u"Enable shared playlists", "more-title" : "Show more settings", "never-rewind-value" : "Never", @@ -192,7 +193,6 @@ en = { "pauseonleave-label" : "Pause when user leaves (e.g. if they are disconnected)", "readyatstart-label" : "Set me as 'ready to watch' by default", "forceguiprompt-label" : "Don't always show the Syncplay configuration window", # (Inverted) - "nostore-label" : "Don't store this configuration", # (Inverted) "showosd-label" : "Enable OSD Messages", "showosdwarnings-label" : "Include warnings (e.g. when files are different, users not ready)", @@ -293,6 +293,7 @@ en = { "executable-path-tooltip" : "Location of your chosen supported media player (MPC-HC, VLC, mplayer2 or mpv).", "media-path-tooltip" : "Location of video or stream to be opened. Necessary for mpv and mplayer2.", "player-arguments-tooltip" : "Additional command line arguments / switches to pass on to this media player.", + "sharedplaylistenabled-tooltip" : u"Room operators can add files to a synced playlist to make it easy for everyone to watching the same thing. Configure media directories under 'Misc'.", "mediasearcdirectories-arguments-tooltip" : u"Directories where Syncplay will search for media files, e.g. when you are using the click to switch feature. Syncplay will look recursively through sub-folders.", "more-tooltip" : "Display less frequently used settings.", @@ -543,8 +544,10 @@ ru = { "executable-path-label" : u"Путь к проигрывателю:", "media-path-label" : u"Путь к видеофайлу:", "player-arguments-label" : u"Аргументы для запуска проигрывателя:", + "sharedplaylistenabled-tooltip" : u"Room operators can add files to a synced playlist to make it easy for everyone to watching the same thing. Configure media directories under 'Misc'.", # TODO: Translate into Russian "browse-label" : u"Выбрать", "update-server-list-label" : u"Update list", # TODO: Translate into Russian + "sharedplaylistenabled-label" : u"Enable shared playlists", # TODO: Translate into Russian "more-title" : u"Больше настроек", "never-rewind-value" : u"Никогда", @@ -562,7 +565,6 @@ ru = { "readyatstart-label" : u"Выставить статус 'готово к просмотру' по умолчанию", "fastforwardondesync-label" : u"Ускорять видео при отставании (рекомендуется)", "forceguiprompt-label" : u"Не показывать больше этот диалог", # (Inverted) - "nostore-label" : u"Не сохранять текущую конфигурацию", # (Inverted) "showosd-label" : u"Включить экранные сообщения (поверх видео)", "showosdwarnings-label" : u"Показывать предупреждения (напр., когда файлы не совпадают)", @@ -663,6 +665,7 @@ ru = { "executable-path-tooltip" : u"Расположение Вашего видеопроигрывателя (MPC-HC, VLC, mplayer2 или mpv).", "media-path-tooltip" : u"Расположение видеофайла или потока для просмотра. Обязательно для mpv и mplayer2.", "player-arguments-tooltip" : u"Передавать дополнительные аргументы командной строки этому проигрывателю.", + "sharedplaylistenabled-tooltip" : u"Room operators can add files to a synced playlist to make it easy for everyone to watching the same thing. Configure media directories under 'Misc'.", # TODO: Translate into Russian "mediasearcdirectories-arguments-tooltip" : u"Directories where Syncplay will search for media files, e.g. when you are using the click to switch feature. Syncplay will look recursively through sub-folders.", # TODO: Translate into Russian "more-tooltip" : u"Показать дополнительные настройки.", @@ -915,6 +918,7 @@ de = { "player-arguments-label" : u"Playerparameter:", "browse-label" : u"Durchsuchen", "update-server-list-label" : u"Liste aktualisieren", + "sharedplaylistenabled-label" : u"Enable shared playlists", # TODO: Translate into German "more-title" : u"Mehr Einstellungen zeigen", "never-rewind-value" : u"Niemals", @@ -930,7 +934,7 @@ de = { "pauseonleave-label" : u"Pausieren wenn ein Benutzer austritt", "readyatstart-label" : u"Standardmäßig auf \'Bereit\' stellen", "forceguiprompt-label" : u"Diesen Dialog nicht mehr anzeigen", - "nostore-label" : u"Diese Konfiguration nicht speichern", + "showosd-label" : u"OSD-Nachrichten anzeigen", "showosdwarnings-label" : u"Zeige Warnungen (z.B. wenn Dateien verschieden)", @@ -1031,6 +1035,7 @@ de = { "executable-path-tooltip" : u"Pfad zum ausgewählten, unterstützten Mediaplayer (MPC-HC, VLC, mplayer2 or mpv).", "media-path-tooltip" : u"Pfad zum wiederzugebenden Video oder Stream. Notwendig für mpv und mplayer2.", "player-arguments-tooltip" : u"Zusätzliche Kommandozeilenparameter / -schalter für diesen Mediaplayer.", + "sharedplaylistenabled-tooltip" : u"Room operators can add files to a synced playlist to make it easy for everyone to watching the same thing. Configure media directories under 'Misc'.", # TODO: Translate into German "mediasearcdirectories-arguments-tooltip" : u"Verzeichnisse, in denen Syncplay nach Mediendateien suchen soll, z.B. wenn du das Click-to-switch-Feature verwendest. Syncplay wird rekursiv Unterordner durchsuchen.", # TODO: Translate Click-to-switch? (or use as name for feature) "more-tooltip" : u"Weitere Einstellungen anzeigen.", diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index c158034..b0ac598 100644 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -71,7 +71,7 @@ class ConfigDialog(QtGui.QDialog): moreToggling = False def automaticUpdatePromptCheck(self): - if self.automaticupdatesCheckbox.checkState() == Qt.PartiallyChecked and not self.nostoreCheckbox.isChecked(): + if self.automaticupdatesCheckbox.checkState() == Qt.PartiallyChecked: reply = QtGui.QMessageBox.question(self, "Syncplay", getMessage("promptforupdate-label"), QtGui.QMessageBox.StandardButton.Yes | QtGui.QMessageBox.StandardButton.No) if reply == QtGui.QMessageBox.Yes: @@ -87,9 +87,9 @@ class ConfigDialog(QtGui.QDialog): if self.showmoreCheckbox.isChecked(): self.tabListFrame.show() self.resetButton.show() - self.nostoreCheckbox.show() self.playerargsTextbox.show() self.playerargsLabel.show() + self.runButton.show() self.saveMoreState(True) self.tabListWidget.setCurrentRow(0) self.ensureTabListIsVisible() @@ -97,9 +97,9 @@ class ConfigDialog(QtGui.QDialog): else: self.tabListFrame.hide() self.resetButton.hide() - self.nostoreCheckbox.hide() self.playerargsTextbox.hide() self.playerargsLabel.hide() + self.runButton.hide() self.saveMoreState(False) self.stackedLayout.setCurrentIndex(0) newHeight = self.connectionSettingsGroup.minimumSizeHint().height()+self.mediaplayerSettingsGroup.minimumSizeHint().height()+self.bottomButtonFrame.minimumSizeHint().height()+3 @@ -112,12 +112,6 @@ class ConfigDialog(QtGui.QDialog): self.setFixedWidth(self.minimumSizeHint().width()) self.executablepathCombobox.setFixedWidth(self.mediapathTextbox.width()) - def runButtonTextUpdate(self): - if self.nostoreCheckbox.isChecked(): - self.runButton.setText(getMessage("run-label")) - else: - self.runButton.setText(getMessage("storeandrun-label")) - def openHelp(self): self.QtGui.QDesktopServices.openUrl(QUrl("http://syncplay.pl/guide/client/")) @@ -331,9 +325,14 @@ class ConfigDialog(QtGui.QDialog): self.mediapathTextbox.setText(os.path.normpath(fileName)) self.mediadirectory = os.path.dirname(fileName) self.saveMediaBrowseSettings() - - def _saveDataAndLeave(self): - self.automaticUpdatePromptCheck() + + def _runWithoutStoringConfig(self): + self._saveDataAndLeave(storeConfiguration=False) + + def _saveDataAndLeave(self, storeConfiguration=True): + self.config['noStore'] = storeConfiguration + if storeConfiguration: + self.automaticUpdatePromptCheck() self.loadLastUpdateCheckDate() self.config["perPlayerArguments"] = self.perPlayerArgs @@ -877,14 +876,16 @@ class ConfigDialog(QtGui.QDialog): self.resetButton.setObjectName("reset") self.resetButton.pressed.connect(self.resetSettings) - self.runButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'accept.png'), getMessage("storeandrun-label")) + self.runButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'accept.png'), getMessage("run-label")) self.runButton.pressed.connect(self._saveDataAndLeave) + self.runButton.setToolTip(getMessage("nostore-tooltip")) + self.storeAndRunButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'accept.png'), getMessage("storeandrun-label")) + self.storeAndRunButton.pressed.connect(self._runWithoutStoringConfig) self.bottomButtonLayout.addWidget(self.helpButton) self.bottomButtonLayout.addWidget(self.resetButton) self.bottomButtonLayout.addWidget(self.runButton) + self.bottomButtonLayout.addWidget(self.storeAndRunButton) self.bottomButtonFrame.setLayout(self.bottomButtonLayout) - if config['noStore'] == True: - self.runButton.setText(getMessage("run-label")) self.bottomButtonLayout.setContentsMargins(5,0,5,0) self.mainLayout.addWidget(self.bottomButtonFrame, 1, 0, 1, 2) @@ -893,12 +894,11 @@ class ConfigDialog(QtGui.QDialog): self.bottomCheckboxLayout = QtGui.QGridLayout() self.alwaysshowCheckbox = QCheckBox(getMessage("forceguiprompt-label")) - self.nostoreCheckbox = QCheckBox(getMessage("nostore-label")) + self.enableplaylistsCheckbox = QCheckBox(getMessage("sharedplaylistenabled-label")) self.bottomCheckboxLayout.addWidget(self.showmoreCheckbox) - self.bottomCheckboxLayout.addWidget(self.nostoreCheckbox, 0, 2, Qt.AlignRight) + self.bottomCheckboxLayout.addWidget(self.enableplaylistsCheckbox, 0, 2, Qt.AlignRight) self.alwaysshowCheckbox.setObjectName(constants.INVERTED_STATE_MARKER + "forceGuiPrompt") - self.nostoreCheckbox.setObjectName("noStore") - self.nostoreCheckbox.toggled.connect(self.runButtonTextUpdate) + self.enableplaylistsCheckbox.setObjectName("sharedPlaylistEnabled") self.bottomCheckboxFrame.setLayout(self.bottomCheckboxLayout) self.mainLayout.addWidget(self.bottomCheckboxFrame, 2, 0, 1, 2) @@ -1027,10 +1027,10 @@ class ConfigDialog(QtGui.QDialog): if self.getMoreState() == False: self.tabListFrame.hide() - self.nostoreCheckbox.hide() self.resetButton.hide() self.playerargsTextbox.hide() self.playerargsLabel.hide() + self.runButton.hide() newHeight = self.connectionSettingsGroup.minimumSizeHint().height()+self.mediaplayerSettingsGroup.minimumSizeHint().height()+self.bottomButtonFrame.minimumSizeHint().height()+3 if self.error: newHeight +=self.errorLabel.height()+3