Move chat text to messages.py + improve chat GuiConfig
This commit is contained in:
parent
abeb921ee2
commit
dee4289c6c
@ -115,7 +115,7 @@ function chat_update()
|
||||
|
||||
if use_alpha_rows_for_chat == false and opts['chatDirectInput'] == true then
|
||||
local alphawarning_ass = assdraw.ass_new()
|
||||
alphawarning_ass = "{\\a6}{\\1c&H"..ALPHA_WARNING_TEXT_COLOUR.."}You can temporarily use old mpv bindings with a-z keys.\n{\\a6}{\\1c&H"..ALPHA_WARNING_TEXT_COLOUR.."}Press [TAB] to return to Syncplay chat mode." -- TODO: Move message to messages.py
|
||||
alphawarning_ass = "{\\a6}{\\1c&H"..ALPHA_WARNING_TEXT_COLOUR.."}"..opts['alphakey-mode-warning-first-line'].."\n{\\a6}{\\1c&H"..ALPHA_WARNING_TEXT_COLOUR.."}"..opts['alphakey-mode-warning-second-line']
|
||||
ass:append(alphawarning_ass)
|
||||
else
|
||||
ass:append(chat_ass)
|
||||
@ -351,6 +351,10 @@ opts = {
|
||||
['notificationTimeout'] = 3,
|
||||
['alertTimeout'] = 5,
|
||||
['chatTimeout'] = 7,
|
||||
--Lang:
|
||||
['mpv-key-hint'] = "[TAB] to toggle access to alphabet row key shortcuts. [ENTER] to send message. [ESC] to escape chat mode. This hint disappears after you send a message.",
|
||||
['alphakey-mode-warning-first-line'] = "You can temporarily use old mpv bindings with a-z keys.",
|
||||
['alphakey-mode-warning-second-line'] = "Press [TAB] to return to Syncplay chat mode.",
|
||||
}
|
||||
|
||||
function detect_platform()
|
||||
@ -451,8 +455,8 @@ function input_ass()
|
||||
secondary_pos = "10,"..tostring(CANVAS_HEIGHT-(20+opts['chatInputFontSize']))
|
||||
end
|
||||
|
||||
local osd_help_message = "[TAB] to toggle access to alphabet row key shortcuts. [ENTER] to send message. [ESC] to escape chat mode. This hint disappears after you send a message." -- TODO: Move message to messages.py
|
||||
local help_prompt = '\n{\\an'..alignment..'\\pos('..secondary_pos..')\\fn' .. opts['chatOutputFontFamily'] .. '\\fs' .. (opts['chatInputFontSize']/1.25) .. '\\1c&H'..HINT_TEXT_COLOUR..'}' .. osd_help_message -- TODO: Move message to messages.py
|
||||
local osd_help_message = opts['mpv-key-hint']
|
||||
local help_prompt = '\n{\\an'..alignment..'\\pos('..secondary_pos..')\\fn' .. opts['chatOutputFontFamily'] .. '\\fs' .. (opts['chatInputFontSize']/1.25) .. '\\1c&H'..HINT_TEXT_COLOUR..'}' .. osd_help_message
|
||||
if key_hints_enabled == false then help_prompt = "" end
|
||||
return "{\\an"..alignment.."}{\\pos("..position..")}"..style..'> '..after_style..before_cur..cglyph..style..after_style..after_cur..end_marker..help_prompt
|
||||
|
||||
@ -867,7 +871,7 @@ mp.command('print-text "<get_syncplayintf_options>"')
|
||||
|
||||
function set_syncplayintf_options(input)
|
||||
---mp.command('print-text "<chat>...'..input..'</chat>"')
|
||||
for option, value in string.gmatch(input, "([^ ,=]+)=([^[,]+)") do
|
||||
for option, value in string.gmatch(input, "([^ ,=]+)=([^,]+)") do
|
||||
local valueType = type(opts[option])
|
||||
if valueType == "number" then
|
||||
value = tonumber(value)
|
||||
@ -879,7 +883,7 @@ function set_syncplayintf_options(input)
|
||||
end
|
||||
end
|
||||
opts[option] = value
|
||||
---mp.command('print-text "<chat>'..option.."="..tostring(value).." - "..valueType..'</chat>"')
|
||||
--mp.command('print-text "<chat>'..option.."="..tostring(value).." - "..valueType..'</chat>"')
|
||||
end
|
||||
chat_format = get_output_style()
|
||||
local vertical_output_area = CANVAS_HEIGHT-(opts['chatTopMargin']+opts['chatBottomMargin'])
|
||||
|
||||
@ -183,6 +183,7 @@ MPV_SYNCPLAYINTF_OPTIONS_TO_SEND = ["chatInputFontFamily", "chatInputFontSize",
|
||||
"notificationTimeout","alertTimeout","chatTimeout","chatOutputEnabled"]
|
||||
|
||||
MPV_SYNCPLAYINTF_CONSTANTS_TO_SEND = ["MaxChatMessageLength={}".format(MAX_CHAT_MESSAGE_LENGTH)]
|
||||
MPV_SYNCPLAYINTF_LANGUAGE_TO_SEND = ["mpv-key-hint", "alphakey-mode-warning-first-line", "alphakey-mode-warning-second-line"]
|
||||
VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek',
|
||||
'--play-and-pause', '--start-time=0']
|
||||
VLC_SLAVE_NONOSX_ARGS = ['--no-one-instance', '--no-one-instance-when-started-from-file']
|
||||
|
||||
@ -249,6 +249,11 @@ de = {
|
||||
"chat-top-option": u"Top", # TODO: Translate
|
||||
"chat-middle-option": u"Middle", # TODO: Translate
|
||||
"chat-bottom-option": u"Bottom", # TODO: Translate
|
||||
"chatoutputfont-label": u"Chat output font", # TODO: Translate
|
||||
"chatoutputenabled-label": u"Enable chat output in media player (mpv only for now)", # TODO: Translate
|
||||
"chatoutputposition-label": u"Output mode", # TODO: Translate
|
||||
"chat-chatroom-option": u"Chatroom style", # TODO: Translate
|
||||
"chat-scrolling-option": u"Scrolling style", # TODO: Translate
|
||||
|
||||
"help-label" : u"Hilfe",
|
||||
"reset-label" : u"Standardwerte zurücksetzen",
|
||||
@ -373,6 +378,11 @@ de = {
|
||||
"chatinputposition-top-tooltip": u"Place chat input at top of mpv window.", # TODO: Translate
|
||||
"chatinputposition-middle-tooltip": u"Place chat input in dead centre of mpv window.", # TODO: Translate
|
||||
"chatinputposition-bottom-tooltip": u"Place chat input at bottom of mpv window.", # TODO: Translate
|
||||
"font-output-label-tooltip": u"Chat output font.", # TODO: Translate
|
||||
"set-output-font-tooltip": u"Font used for when displaying chat messages.", # TODO: Translate
|
||||
"chatoutputmode-tooltip": u"How chat messages are displayed.", # TODO: Translate
|
||||
"chatoutputmode-chatroom-tooltip": u"Display new lines of chat directly below previous line.", # TODO: Translate
|
||||
"chatoutputmode-scrolling-tooltip": u"Scroll chat text from right to left.", # TODO: Translate
|
||||
|
||||
"help-tooltip" : u"Öffnet Hilfe auf syncplay.pl [Englisch]",
|
||||
"reset-tooltip" : u"Alle Einstellungen auf Standardwerte zurücksetzen.",
|
||||
|
||||
@ -240,7 +240,7 @@ en = {
|
||||
"syncplay-trusteddomains-title": u"Trusted domains (for streaming services and hosted content)",
|
||||
|
||||
"chat-title" : u"Chat message input",
|
||||
"chatinputenabled-label" : u"Enable chat input via mpv (using enter key)",
|
||||
"chatinputenabled-label" : u"Enable chat input via mpv",
|
||||
"chatinputfont-label" : u"Chat input font",
|
||||
"chatfont-label" : u"Set font",
|
||||
"chatcolour-label" : u"Set colour",
|
||||
@ -248,6 +248,15 @@ en = {
|
||||
"chat-top-option" : u"Top",
|
||||
"chat-middle-option" : u"Middle",
|
||||
"chat-bottom-option" : u"Bottom",
|
||||
"chatoutputfont-label": u"Chat output font",
|
||||
"chatoutputenabled-label": u"Enable chat output in media player (mpv only for now)",
|
||||
"chatoutputposition-label": u"Output mode",
|
||||
"chat-chatroom-option": u"Chatroom style",
|
||||
"chat-scrolling-option": u"Scrolling style",
|
||||
|
||||
"mpv-key-hint": u"[TAB] to toggle access to alphabet row key shortcuts. [ENTER] to send message. [ESC] to escape chat mode. This hint disappears after you send a message.",
|
||||
"alphakey-mode-warning-first-line": u"You can temporarily use old mpv bindings with a-z keys.",
|
||||
"alphakey-mode-warning-second-line": u"Press [TAB] to return to Syncplay chat mode.",
|
||||
|
||||
"help-label" : "Help",
|
||||
"reset-label" : "Restore defaults",
|
||||
@ -370,6 +379,12 @@ en = {
|
||||
"chatinputposition-top-tooltip" : u"Place chat input at top of mpv window.",
|
||||
"chatinputposition-middle-tooltip" : u"Place chat input in dead centre of mpv window.",
|
||||
"chatinputposition-bottom-tooltip" : u"Place chat input at bottom of mpv window.",
|
||||
"chatoutputenabled-tooltip": u"Show chat messages in mpv.",
|
||||
"font-output-label-tooltip": u"Chat output font.",
|
||||
"set-output-font-tooltip": u"Font used for when displaying chat messages.",
|
||||
"chatoutputmode-tooltip": u"How chat messages are displayed.",
|
||||
"chatoutputmode-chatroom-tooltip": u"Display new lines of chat directly below previous line.",
|
||||
"chatoutputmode-scrolling-tooltip": u"Scroll chat text from right to left.",
|
||||
|
||||
"help-tooltip" : "Opens the Syncplay.pl user guide.",
|
||||
"reset-tooltip" : "Reset all settings to the default configuration.",
|
||||
|
||||
@ -252,6 +252,11 @@ ru = {
|
||||
"chat-top-option": u"Top", # TODO: Translate
|
||||
"chat-middle-option": u"Middle", # TODO: Translate
|
||||
"chat-bottom-option": u"Bottom", # TODO: Translate
|
||||
"chatoutputfont-label": u"Chat output font", # TODO: Translate
|
||||
"chatoutputenabled-label": u"Enable chat output in media player (mpv only for now)", # TODO: Translate
|
||||
"chatoutputposition-label": u"Output mode", # TODO: Translate
|
||||
"chat-chatroom-option": u"Chatroom style", # TODO: Translate
|
||||
"chat-scrolling-option": u"Scrolling style", # TODO: Translate
|
||||
|
||||
"help-label" : u"Помощь",
|
||||
"reset-label" : u"Сброс настроек",
|
||||
@ -365,6 +370,20 @@ ru = {
|
||||
"unpause-ifminusersready-tooltip" : u"Когда вы стартуете не готовым, воспроизведение начнется, если остальные готовы и присутствует достаточное число зрителей.",
|
||||
"trusteddomains-arguments-tooltip" : u"Сайты, которые разрешены для автоматического воспроизведения из общего списка воспроизведения.",
|
||||
|
||||
"chatinputenabled-tooltip": u"Enable chat input in mpv (press enter to chat, enter to send, escape to cancel)",# TODO: Translate
|
||||
"font-label-tooltip": u"Font used for when entering chat messages in mpv. Client-side only, so doesn't affect what other see.",# TODO: Translate
|
||||
"set-input-font-tooltip": u"Font family used for when entering chat messages in mpv. Client-side only, so doesn't affect what other see.",# TODO: Translate
|
||||
"set-input-colour-tooltip": u"Font colour used for when entering chat messages in mpv. Client-side only, so doesn't affect what other see.",# TODO: Translate
|
||||
"chatinputposition-tooltip": u"Location in mpv where chat input text will appear when you press enter and type.",# TODO: Translate
|
||||
"chatinputposition-top-tooltip": u"Place chat input at top of mpv window.", # TODO: Translate
|
||||
"chatinputposition-middle-tooltip": u"Place chat input in dead centre of mpv window.", # TODO: Translate
|
||||
"chatinputposition-bottom-tooltip": u"Place chat input at bottom of mpv window.", # TODO: Translate
|
||||
"font-output-label-tooltip": u"Chat output font.", # TODO: Translate
|
||||
"set-output-font-tooltip": u"Font used for when displaying chat messages.", # TODO: Translate
|
||||
"chatoutputmode-tooltip": u"How chat messages are displayed.", # TODO: Translate
|
||||
"chatoutputmode-chatroom-tooltip": u"Display new lines of chat directly below previous line.", # TODO: Translate
|
||||
"chatoutputmode-scrolling-tooltip": u"Scroll chat text from right to left.", # TODO: Translate
|
||||
|
||||
"help-tooltip" : u"Открыть Руководство Пользователя на Syncplay.pl.",
|
||||
"reset-tooltip" : u"Сбрасывает все настройки Syncplay в начальное состояние.",
|
||||
"update-server-list-tooltip" : u"Обновить список публичных серверов от syncplay.pl.",
|
||||
|
||||
@ -238,6 +238,8 @@ class NewMpvPlayer(OldMpvPlayer):
|
||||
options.append(u"{}={}".format(option,self._client._config[option]))
|
||||
for option in constants.MPV_SYNCPLAYINTF_CONSTANTS_TO_SEND:
|
||||
options.append(option)
|
||||
for option in constants.MPV_SYNCPLAYINTF_LANGUAGE_TO_SEND:
|
||||
options.append(u"{}={}".format(option,getMessage(option)))
|
||||
options_string = ", ".join(options)
|
||||
self._listener.sendLine(u'script-message-to syncplayintf set_syncplayintf_options "{}"'.format(options_string))
|
||||
|
||||
|
||||
@ -860,6 +860,11 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.inputFontLayout.addWidget(self.chatInputColourButton, Qt.AlignLeft)
|
||||
self.chatInputLayout.addWidget(self.inputFontFrame, 2, 0, 1, 3, Qt.AlignLeft)
|
||||
|
||||
self.chatInputPositionFrame = QtGui.QFrame()
|
||||
self.chatInputPositionLayout = QtGui.QHBoxLayout()
|
||||
self.chatInputPositionLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.chatInputPositionFrame.setLayout(self.chatInputPositionLayout)
|
||||
self.chatInputPositionFrame.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
|
||||
self.chatInputPositionLabel = QLabel(getMessage("chatinputposition-label"), self)
|
||||
self.chatInputPositionLabel.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + u"chevrons_right.png"))
|
||||
self.chatInputPositionGroup = QButtonGroup()
|
||||
@ -875,10 +880,11 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.chatInputMiddleOption.setObjectName("chatinputposition-middle" + constants.CONFIG_NAME_MARKER + "chatInputPosition" + constants.CONFIG_VALUE_MARKER + constants.INPUT_POSITION_MIDDLE)
|
||||
self.chatInputBottomOption.setObjectName("chatinputposition-bottom" + constants.CONFIG_NAME_MARKER + "chatInputPosition" + constants.CONFIG_VALUE_MARKER + constants.INPUT_POSITION_BOTTOM)
|
||||
|
||||
self.chatInputLayout.addWidget(self.chatInputPositionLabel, 3, 0)
|
||||
self.chatInputLayout.addWidget(self.chatInputTopOption, 3, 1, Qt.AlignLeft)
|
||||
self.chatInputLayout.addWidget(self.chatInputMiddleOption, 3, 2, Qt.AlignLeft)
|
||||
self.chatInputLayout.addWidget(self.chatInputBottomOption, 3, 3, Qt.AlignLeft)
|
||||
self.chatInputPositionLayout.addWidget(self.chatInputPositionLabel)
|
||||
self.chatInputPositionLayout.addWidget(self.chatInputTopOption)
|
||||
self.chatInputPositionLayout.addWidget(self.chatInputMiddleOption)
|
||||
self.chatInputPositionLayout.addWidget(self.chatInputBottomOption)
|
||||
self.chatInputLayout.addWidget(self.chatInputPositionFrame)
|
||||
|
||||
self.subitems['chatInputEnabled'] = [self.chatInputPositionLabel.objectName(), self.chatInputTopOption.objectName(),
|
||||
self.chatInputMiddleOption.objectName(), self.chatInputBottomOption.objectName(),
|
||||
@ -889,7 +895,7 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.chatOutputLayout = QtGui.QGridLayout()
|
||||
self.chatLayout.addWidget(self.chatOutputGroup)
|
||||
self.chatOutputGroup.setLayout(self.chatOutputLayout)
|
||||
self.chatOutputEnabledCheckbox = QCheckBox("Enable chat output in media player") # TODO: getMessage("chatoutputenabled-label")
|
||||
self.chatOutputEnabledCheckbox = QCheckBox(getMessage("chatoutputenabled-label"))
|
||||
self.chatOutputEnabledCheckbox.setObjectName("chatOutputEnabled")
|
||||
self.chatOutputLayout.addWidget(self.chatOutputEnabledCheckbox, 1, 0, 1,1, Qt.AlignLeft)
|
||||
|
||||
@ -898,7 +904,7 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.outputFontFrame = QtGui.QFrame()
|
||||
self.outputFontFrame.setLayout(self.outputFontLayout)
|
||||
self.outputFontFrame.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
|
||||
self.chatOutputFontLabel = QLabel("Chat output font", self)# TODO: getMessage("chatoutputfont-label")
|
||||
self.chatOutputFontLabel = QLabel(getMessage("chatoutputfont-label"), self)
|
||||
self.chatOutputFontLabel.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + u"chevrons_right.png"))
|
||||
self.chatOutputFontLabel.setObjectName("font-output-label")
|
||||
self.chatOutputFontButton = QtGui.QPushButton(getMessage("chatfont-label"))
|
||||
@ -911,11 +917,11 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.outputFontLayout.addWidget(self.chatOutputFontButton, Qt.AlignLeft)
|
||||
self.chatOutputLayout.addWidget(self.outputFontFrame, 2, 0, 1, 3, Qt.AlignLeft)
|
||||
|
||||
self.chatOutputModeLabel = QLabel("Output mode", self) # TODO: getMessage("chatoutputposition-label")
|
||||
self.chatOutputModeLabel = QLabel(getMessage("chatoutputposition-label"), self)
|
||||
self.chatOutputModeLabel.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + u"chevrons_right.png"))
|
||||
self.chatOutputModeGroup = QButtonGroup()
|
||||
self.chatOutputChatroomOption = QRadioButton("Chatroom style") # TODO: Messages.py
|
||||
self.chatOutputScrollingOption = QRadioButton("Scrolling style") # TODO: Messages.py
|
||||
self.chatOutputChatroomOption = QRadioButton(getMessage("chat-chatroom-option"))
|
||||
self.chatOutputScrollingOption = QRadioButton(getMessage("chat-scrolling-option"))
|
||||
self.chatOutputModeGroup.addButton(self.chatOutputChatroomOption)
|
||||
self.chatOutputModeGroup.addButton(self.chatOutputScrollingOption)
|
||||
|
||||
@ -923,9 +929,15 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.chatOutputChatroomOption.setObjectName("chatoutputmode-chatroom" + constants.CONFIG_NAME_MARKER + "chatOutputMode" + constants.CONFIG_VALUE_MARKER + constants.CHATROOM_MODE)
|
||||
self.chatOutputScrollingOption.setObjectName("chatoutputmode-scrolling" + constants.CONFIG_NAME_MARKER + "chatOutputMode" + constants.CONFIG_VALUE_MARKER + constants.SCROLLING_MODE)
|
||||
|
||||
self.chatOutputLayout.addWidget(self.chatOutputModeLabel, 3, 0)
|
||||
self.chatOutputLayout.addWidget(self.chatOutputChatroomOption, 3, 1, Qt.AlignLeft)
|
||||
self.chatOutputLayout.addWidget(self.chatOutputScrollingOption, 3, 2, Qt.AlignLeft)
|
||||
self.chatOutputModeFrame = QtGui.QFrame()
|
||||
self.chatOutputModeLayout = QtGui.QHBoxLayout()
|
||||
self.chatOutputModeLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.chatOutputModeFrame.setLayout(self.chatOutputModeLayout)
|
||||
self.chatOutputModeFrame.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
|
||||
self.chatOutputModeLayout.addWidget(self.chatOutputModeLabel)
|
||||
self.chatOutputModeLayout.addWidget(self.chatOutputChatroomOption)
|
||||
self.chatOutputModeLayout.addWidget(self.chatOutputScrollingOption)
|
||||
self.chatOutputLayout.addWidget(self.chatOutputModeFrame)
|
||||
|
||||
self.subitems['chatOutputEnabled'] = [self.chatOutputModeLabel.objectName(), self.chatOutputChatroomOption.objectName(),
|
||||
self.chatOutputScrollingOption.objectName(),self.chatOutputFontButton.objectName(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user