Add chat output options to GuiConfig (initial)
This commit is contained in:
parent
671f40a737
commit
5de0fe0ae2
@ -18,6 +18,13 @@ local MOOD_NEUTRAL = 0
|
||||
local MOOD_BAD = 1
|
||||
local MOOD_GOOD = 2
|
||||
|
||||
local ALPHA_WARNING_TEXT_COLOUR = "FF00FF" -- RBG
|
||||
local HINT_TEXT_COLOUR = "00FFFF" -- RBG
|
||||
local NEUTRAL_ALERT_TEXT_COLOUR = "FFFFFF" -- RBG
|
||||
local BAD_ALERT_TEXT_COLOUR = "0000FF" -- RBG
|
||||
local GOOD_ALERT_TEXT_COLOUR = "00FF00" -- RBG
|
||||
local NOTIFICATION_TEXT_COLOUR = "FFFF00" -- RBG
|
||||
|
||||
local chat_log = {}
|
||||
|
||||
local assdraw = require "mp.assdraw"
|
||||
@ -108,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}You can temporarily use old mpv bindings with a-z keys.\n{\\a6}Press [TAB] to return to Syncplay chat mode." -- TODO: Move message to messages.py
|
||||
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
|
||||
ass:append(alphawarning_ass)
|
||||
else
|
||||
ass:append(chat_ass)
|
||||
@ -125,11 +132,13 @@ function process_alert_osd()
|
||||
local ypos
|
||||
local messageColour
|
||||
if alert_osd_mood == MOOD_NEUTRAL then
|
||||
messageColour = "{\\1c&HFFFFFF}"
|
||||
|
||||
|
||||
messageColour = "{\\1c&H"..NEUTRAL_ALERT_TEXT_COLOUR.."}"
|
||||
elseif alert_osd_mood == MOOD_BAD then
|
||||
messageColour = "{\\1c&H0000FF}"
|
||||
messageColour = "{\\1c&H"..BAD_ALERT_TEXT_COLOUR.."}"
|
||||
elseif alert_osd_mood == MOOD_GOOD then
|
||||
messageColour = "{\\1c&H00FF00}"
|
||||
messageColour = "{\\1c&H"..GOOD_ALERT_TEXT_COLOUR.."}"
|
||||
end
|
||||
local messageString
|
||||
local startRow = 0
|
||||
@ -156,7 +165,7 @@ function process_notification_osd(startRow)
|
||||
if notification_osd ~= "" and mp.get_time() - last_notification_osd_time < opts['alertTimeout'] and last_notification_osd_time ~= nil then
|
||||
local xpos = opts['chatLeftMargin']
|
||||
local messageColour
|
||||
messageColour = "{\\1c&HFFFF00}"
|
||||
messageColour = "{\\1c&H"..NOTIFICATION_TEXT_COLOUR.."}"
|
||||
local messageString
|
||||
local startRow = startRow
|
||||
local stringLeftToProccess = notification_osd
|
||||
@ -326,7 +335,7 @@ opts = {
|
||||
['chatInputPosition'] = "Top",
|
||||
['MaxChatMessageLength'] = 50,
|
||||
['chatSplitMessageAt'] = 70,
|
||||
['chatOutputFontFamily'] = 'sans serif',
|
||||
['chatOutputFontFamily'] = "sans serif",
|
||||
['chatOutputFontSize'] = 50,
|
||||
['chatOutputFontWeight'] = 1,
|
||||
['chatOutputFontUnderline'] = false,
|
||||
@ -337,7 +346,6 @@ opts = {
|
||||
['chatMaxLines'] = 7,
|
||||
['chatTopMargin'] = 25,
|
||||
['chatLeftMargin'] = 20,
|
||||
['chatBottomMargin'] = 30,
|
||||
['chatDirectInput'] = true,
|
||||
--
|
||||
['notificationTimeout'] = 3,
|
||||
@ -444,7 +452,7 @@ function input_ass()
|
||||
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['chatInputFontFamily'] .. '\\fs' .. (opts['chatInputFontSize']/2) .. '}' .. osd_help_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
|
||||
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
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ MAXIMUM_TAB_WIDTH = 350
|
||||
DEFAULT_WINDOWS_MONOSPACE_FONT = "Consolas"
|
||||
DEFAULT_OSX_MONOSPACE_FONT = "Menlo"
|
||||
FALLBACK_MONOSPACE_FONT = "Monospace"
|
||||
DEFAULT_CHAT_INPUT_FONT_SIZE = 18
|
||||
DEFAULT_CHAT_INPUT_FONT_SIZE = 46
|
||||
DEFAULT_CHAT_INPUT_FONT_COLOR = "#FFFFFF"
|
||||
DEFAULT_CHAT_INPUT_FONT_WEIGHT = 1
|
||||
|
||||
@ -176,7 +176,12 @@ MPV_ARGS = ['--force-window', '--idle', '--hr-seek=always', '--keep-open']
|
||||
MPV_SLAVE_ARGS = ['--msg-level=all=error,cplayer=info,term-msg=info', '--input-terminal=no', '--input-file=/dev/stdin']
|
||||
MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=<SyncplayUpdateFile>\nANS_filename=${filename}\nANS_length=${=length:${=duration:0}}\nANS_path=${path}\n</SyncplayUpdateFile>', '--terminal=yes']
|
||||
MPV_NEW_VERSION = False
|
||||
MPV_SYNCPLAYINTF_OPTIONS_TO_SEND = ["chatInputFontFamily", "chatInputFontSize", "chatInputFontWeight", "chatInputFontUnderline", "chatInputFontColor", "chatInputPosition","chatDirectInput"]
|
||||
MPV_SYNCPLAYINTF_OPTIONS_TO_SEND = ["chatInputFontFamily", "chatInputFontSize", "chatInputFontWeight","chatInputFontUnderline",
|
||||
"chatInputFontColor", "chatInputPosition","chatOutputFontFamily","chatOutputFontSize",
|
||||
"chatOutputFontWeight","chatOutputFontUnderline","chatOutputMode","chatMaxLines",
|
||||
"chatTopMargin","chatLeftMargin","chatBottomMargin","chatDirectInput",
|
||||
"notificationTimeout","alertTimeout","chatTimeout","chatOutputEnabled"]
|
||||
|
||||
MPV_SYNCPLAYINTF_CONSTANTS_TO_SEND = ["MaxChatMessageLength={}".format(MAX_CHAT_MESSAGE_LENGTH)]
|
||||
VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek',
|
||||
'--play-and-pause', '--start-time=0']
|
||||
@ -224,6 +229,9 @@ OSD_NOTIFICATION = "notification" # Also known as PrimaryOSD
|
||||
OSD_ALERT = "alert" # Also known as SecondaryOSD
|
||||
OSD_CHAT = "chat"
|
||||
|
||||
CHATROOM_MODE = "Chatroom"
|
||||
SCROLLING_MODE = "Scrolling"
|
||||
|
||||
SYNCPLAY_UPDATE_URL = u"http://syncplay.pl/checkforupdate?{}" # Params
|
||||
SYNCPLAY_DOWNLOAD_URL = "http://syncplay.pl/download/"
|
||||
SYNCPLAY_PUBLIC_SERVER_LIST_URL = u"http://syncplay.pl/listpublicservers?{}" # Params
|
||||
|
||||
@ -66,5 +66,6 @@ def getMessage(type_, locale=None):
|
||||
if messages["en"].has_key(type_):
|
||||
return unicode(messages["en"][type_])
|
||||
else:
|
||||
raise KeyError(type_)
|
||||
#print u"WARNING: Cannot find message '{}'!".format(type_)
|
||||
print u"WARNING: Cannot find message '{}'!".format(type_)
|
||||
return "!{}".format(type_) # TODO: Remove
|
||||
#raise KeyError(type_)
|
||||
@ -72,6 +72,19 @@ class ConfigurationGetter(object):
|
||||
"chatInputFontColor": constants.DEFAULT_CHAT_INPUT_FONT_COLOR,
|
||||
"chatInputPosition": constants.INPUT_POSITION_TOP,
|
||||
"chatDirectInput": True,
|
||||
"chatOutputEnabled": True,
|
||||
"chatOutputFontFamily": 'sans-serif',
|
||||
"chatOutputFontSize": 50,
|
||||
"chatOutputFontWeight": 1,
|
||||
"chatOutputFontUnderline": False,
|
||||
"chatOutputMode": constants.CHATROOM_MODE,
|
||||
"chatMaxLines": 7,
|
||||
"chatTopMargin": 25,
|
||||
"chatLeftMargin": 20,
|
||||
"chatBottomMargin": 30,
|
||||
"notificationTimeout": 3,
|
||||
"alertTimeout": 5,
|
||||
"chatTimeout": 7,
|
||||
}
|
||||
|
||||
self._defaultConfig = self._config.copy()
|
||||
@ -116,7 +129,9 @@ class ConfigurationGetter(object):
|
||||
"onlySwitchToTrustedDomains",
|
||||
"chatInputEnabled",
|
||||
"chatInputFontUnderline",
|
||||
"chatDirectInput"
|
||||
"chatDirectInput",
|
||||
"chatOutputEnabled",
|
||||
"chatOutputFontUnderline"
|
||||
]
|
||||
self._tristate = [
|
||||
"checkForUpdatesAutomatically",
|
||||
@ -135,7 +150,16 @@ class ConfigurationGetter(object):
|
||||
"fastforwardThreshold",
|
||||
"autoplayMinUsers",
|
||||
"chatInputFontSize",
|
||||
"chatInputFontWeight"
|
||||
"chatInputFontWeight",
|
||||
"chatOutputFontWeight",
|
||||
"chatOutputFontSize",
|
||||
"chatMaxLines",
|
||||
"chatTopMargin",
|
||||
"chatLeftMargin",
|
||||
"chatBottomMargin",
|
||||
"notificationTimeout",
|
||||
"alertTimeout",
|
||||
"chatTimeout"
|
||||
]
|
||||
|
||||
self._hexadecimal = [
|
||||
@ -162,7 +186,14 @@ class ConfigurationGetter(object):
|
||||
"chatInputEnabled","chatInputFontUnderline",
|
||||
"chatInputFontFamily", "chatInputFontSize",
|
||||
"chatInputFontWeight", "chatInputFontColor",
|
||||
"chatInputPosition","chatDirectInput"],
|
||||
"chatInputPosition","chatDirectInput",
|
||||
"chatOutputFontFamily", "chatOutputFontSize",
|
||||
"chatOutputFontWeight", "chatOutputFontUnderline",
|
||||
"chatOutputMode", "chatMaxLines",
|
||||
"chatTopMargin", "chatLeftMargin",
|
||||
"chatBottomMargin", "chatDirectInput",
|
||||
"notificationTimeout", "alertTimeout",
|
||||
"chatTimeout","chatOutputEnabled"],
|
||||
"general": ["language", "checkForUpdatesAutomatically",
|
||||
"lastCheckedForUpdates"]
|
||||
}
|
||||
|
||||
@ -884,9 +884,52 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.chatInputMiddleOption.objectName(), self.chatInputBottomOption.objectName(),
|
||||
self.chatInputFontButton.objectName(), self.chatFontLabel.objectName(),
|
||||
self.chatInputColourButton.objectName()]
|
||||
# Output
|
||||
self.chatOutputGroup = QtGui.QGroupBox(u"Chat message output")
|
||||
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.setObjectName("chatOutputEnabled")
|
||||
self.chatOutputLayout.addWidget(self.chatOutputEnabledCheckbox, 1, 0, 1,1, Qt.AlignLeft)
|
||||
|
||||
self.outputFontLayout = QtGui.QHBoxLayout()
|
||||
self.outputFontLayout.setContentsMargins(0, 0, 0, 0)
|
||||
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.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + u"chevrons_right.png"))
|
||||
self.chatOutputFontLabel.setObjectName("font-output-label")
|
||||
self.chatOutputFontButton = QtGui.QPushButton(getMessage("chatfont-label"))
|
||||
self.chatOutputFontButton.setObjectName("set-output-font")
|
||||
self.chatOutputFontButtonGroup = QtGui.QButtonGroup()
|
||||
self.chatOutputFontButtonGroup.addButton(self.chatOutputFontButton)
|
||||
self.chatOutputFontButton.released.connect(lambda: self.fontDialog("chatOutput"))
|
||||
self.chatOutputColourButton = QtGui.QPushButton(getMessage("chatcolour-label"))
|
||||
self.outputFontLayout.addWidget(self.chatOutputFontLabel, Qt.AlignLeft)
|
||||
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.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.chatOutputModeGroup.addButton(self.chatOutputChatroomOption)
|
||||
self.chatOutputModeGroup.addButton(self.chatOutputScrollingOption)
|
||||
|
||||
self.chatOutputModeLabel.setObjectName("chatoutputmode")
|
||||
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.subitems['chatOutputEnabled'] = [self.chatOutputModeLabel.objectName(), self.chatOutputChatroomOption.objectName(),
|
||||
self.chatOutputScrollingOption.objectName(),self.chatOutputFontButton.objectName(),
|
||||
self.chatOutputFontLabel.objectName()]
|
||||
# chatFrame
|
||||
self.chatFrame.setLayout(self.chatLayout)
|
||||
self.stackedLayout.addWidget(self.chatFrame)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user