Don't slow with me option + refactor

This commit is contained in:
Et0h 2014-05-03 20:51:46 +01:00
parent 53665e19e4
commit 0db65e2ec1
4 changed files with 32 additions and 15 deletions

View File

@ -144,7 +144,10 @@ class SyncplayClient(object):
def getLocalState(self):
paused = self.getPlayerPaused()
position = self.getPlayerPosition()
if self._config['dontSlowDownWithMe']:
position = self.getGlobalPosition()
else:
position = self.getPlayerPosition()
pauseChange, _ = self._determinePlayerStateChange(paused, position)
if(self._lastGlobalUpdate):
return position, paused, _, pauseChange

View File

@ -123,6 +123,7 @@ en = {
"filename-privacy-label" : "Filename information:",
"filesize-privacy-label" : "File size information:",
"slowdown-label" : "Slow down on desync",
"dontslowwithme-label" : "Never slow down others on my account",
"pauseonleave-label" : "Pause when user leaves",
"rewind-label" : "Rewind on major desync (highly recommended)",
"alwayshow-label" : "Always show this dialog",
@ -152,6 +153,7 @@ en = {
"privacy-sendhashed-tooltip" : "Send a hashed version of the information, making it less visible to other clients.",
"privacy-dontsend-tooltip" : "Do not send this information to the server. This provides for maximum privacy.",
"slowdown-tooltip" : "Reduce playback rate temporarily when needed to bring you back in sync with other viewers.",
"dontslowwithme-tooltip" : "Means others do not get slowed down or rewinded if your playback is lagging.",
"pauseonleave-tooltip" : "Pause playback if you get disconnected or someone leaves from your room.",
"rewind-tooltip" : "Jump back when needed to get back in sync. Recommended.",
"alwayshow-tooltip" : "Configuration dialogue is always shown, even when opening a file with Syncplay.",
@ -197,27 +199,27 @@ en = {
pl = {
# Client notifications
"connection-attempt-notification" : "Próba połączenia z {}:{}", # Port, IP
"connection-attempt-notification" : "Próba połączenia z {}:{}", # Port, IP
"reconnection-attempt-notification" : "Połączenie z serwerem zostało przerwane, ponowne łączenie",
"disconnection-notification" : "Odłączono od serwera",
"connection-failed-notification" : "Połączenie z serwerem zakończone fiaskiem",
"rewind-notification" : "Cofnięto z powodu różnicy czasu z <{}>", # User
"slowdown-notification" : "Zwolniono z powodu różnicy czasu z <{}>", # User
"rewind-notification" : "Cofnięto z powodu różnicy czasu z <{}>", # User
"slowdown-notification" : "Zwolniono z powodu różnicy czasu z <{}>", # User
"revert-notification" : "Przywrócono normalną prędkość odtwarzania",
"pause-notification" : "<{}> zatrzymał odtwarzanie", # User
"unpause-notification" : "<{}> wznowił odtwarzanie", # User
"seek-notification" : "<{}> skoczył z {} do {}", # User, from time, to time
"pause-notification" : "<{}> zatrzymał odtwarzanie", # User
"unpause-notification" : "<{}> wznowił odtwarzanie", # User
"seek-notification" : "<{}> skoczył z {} do {}", # User, from time, to time
"current-offset-notification" : "Obecny offset: {} seconds", # Offset
"room-join-notification" : "<{}> dołączył do pokoju: '{}'", # User
"left-notification" : "<{}> wyszedł", # User
"room-join-notification" : "<{}> dołączył do pokoju: '{}'", # User
"left-notification" : "<{}> wyszedł", # User
"playing-notification" : "<{}> odtwarza '{}' ({})", # User, file, duration
"playing-notification/room-addendum" : " w pokoju: '{}'", # Room
"file-different-notification" : "Plik, który odtwarzasz wydaje się być różny od <{}>", # User
"file-different-notification" : "Plik, który odtwarzasz wydaje się być różny od <{}>", # User
"file-differences-notification" : "Twój plik różni się następującymi parametrami: ",
"different-filesize-notification" : " (inny rozmiar pliku!)",

View File

@ -34,6 +34,7 @@ class ConfigurationGetter(object):
"playerArgs": [],
"playerClass": None,
"slowOnDesync": True,
"dontSlowDownWithMe": False,
"rewindOnDesync": True,
"filenamePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
"filesizePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
@ -58,6 +59,7 @@ class ConfigurationGetter(object):
"noGui",
"noStore",
"slowOnDesync",
"dontSlowDownWithMe",
"pauseOnLeave",
"rewindOnDesync",
"clearGUIData"
@ -65,7 +67,7 @@ class ConfigurationGetter(object):
self._iniStructure = {
"server_data": ["host", "port", "password"],
"client_settings": ["name", "room", "playerPath", "slowOnDesync", "rewindOnDesync", "forceGuiPrompt", "filenamePrivacyMode", "filesizePrivacyMode", "pauseOnLeave"],
"client_settings": ["name", "room", "playerPath", "slowOnDesync", "dontSlowDownWithMe", "rewindOnDesync", "forceGuiPrompt", "filenamePrivacyMode", "filesizePrivacyMode", "pauseOnLeave"],
}
#

View File

@ -201,6 +201,10 @@ class ConfigDialog(QtGui.QDialog):
self.config['slowOnDesync'] = True
else:
self.config['slowOnDesync'] = False
if self.dontslowwithmeCheckbox.isChecked() == True:
self.config['dontSlowDownWithMe'] = True
else:
self.config['dontSlowDownWithMe'] = False
if self.pauseonleaveCheckbox.isChecked() == True:
self.config['pauseOnLeave'] = True
else:
@ -386,6 +390,7 @@ class ConfigDialog(QtGui.QDialog):
self.filesizeprivacyButtonGroup.addButton(self.filesizeprivacyDontSendOption)
self.slowdownCheckbox = QCheckBox(getMessage("en", "slowdown-label"))
self.dontslowwithmeCheckbox = QCheckBox(getMessage("en", "dontslowwithme-label"))
self.pauseonleaveCheckbox = QCheckBox(getMessage("en", "pauseonleave-label"))
self.alwaysshowCheckbox = QCheckBox(getMessage("en", "alwayshow-label"))
self.donotstoreCheckbox = QCheckBox(getMessage("en", "donotstore-label"))
@ -408,6 +413,9 @@ class ConfigDialog(QtGui.QDialog):
if config['slowOnDesync'] == True:
self.slowdownCheckbox.setChecked(True)
if config['dontSlowDownWithMe'] == True:
self.dontslowwithmeCheckbox.setChecked(True)
if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True and config['rewindOnDesync'] == True:
self.rewindCheckbox.setChecked(True)
if config['pauseOnLeave'] == True:
@ -424,6 +432,7 @@ class ConfigDialog(QtGui.QDialog):
self.filesizeprivacyDontSendOption.setToolTip(getMessage("en", "privacy-dontsend-tooltip"))
self.slowdownCheckbox.setToolTip(getMessage("en", "slowdown-tooltip"))
self.dontslowwithmeCheckbox.setToolTip(getMessage("en", "dontslowwithme-tooltip"))
self.pauseonleaveCheckbox.setToolTip(getMessage("en", "pauseonleave-tooltip"))
self.alwaysshowCheckbox.setToolTip(getMessage("en", "alwayshow-tooltip"))
self.donotstoreCheckbox.setToolTip(getMessage("en", "donotstore-tooltip"))
@ -449,11 +458,12 @@ class ConfigDialog(QtGui.QDialog):
self.moreSettingsLayout.addWidget(self.privacyFrame, 0, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.slowdownCheckbox, 2, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.dontslowwithmeCheckbox, 3, 0, 1, 4)
if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True:
self.moreSettingsLayout.addWidget(self.rewindCheckbox, 3, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.pauseonleaveCheckbox, 4, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.alwaysshowCheckbox, 5, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.donotstoreCheckbox, 6, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.rewindCheckbox, 4, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.pauseonleaveCheckbox, 5, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.alwaysshowCheckbox, 6, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.donotstoreCheckbox, 7, 0, 1, 4)
self.moreSettingsGroup.setLayout(self.moreSettingsLayout)