Add chat to GUI
This commit is contained in:
parent
a3324a80f3
commit
586c12ec68
@ -657,6 +657,7 @@ guiIcons = ['resources/accept.png', 'resources/arrow_undo.png', 'resources/clock
|
||||
'resources/film_go.png', 'resources/world_go.png', 'resources/arrow_refresh.png', 'resources/bullet_right_grey.png',
|
||||
'resources/film_folder_edit.png',
|
||||
'resources/shield_edit.png',
|
||||
'resources/email_go.png',
|
||||
'resources/world_add.png', 'resources/film_add.png', 'resources/delete.png', 'resources/spinner.mng'
|
||||
]
|
||||
resources = ["resources/icon.ico", "resources/syncplay.png"]
|
||||
|
||||
BIN
resources/email_go.png
Normal file
BIN
resources/email_go.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 754 B |
@ -1,4 +1,4 @@
|
||||
version = '1.4.0'
|
||||
version = '1.5.0'
|
||||
milestone = 'Yoitsu'
|
||||
release_number = '28'
|
||||
projectURL = 'http://syncplay.pl/'
|
||||
|
||||
@ -1703,7 +1703,6 @@ class FileSwitchManager(object):
|
||||
if highPriority and self.folderSearchEnabled:
|
||||
directoryList = self.mediaDirectories
|
||||
# Spin up hard drives to prevent premature timeout
|
||||
randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+u".txt"
|
||||
for directory in directoryList:
|
||||
startTime = time.time()
|
||||
if os.path.isfile(os.path.join(directory, randomFilename)):
|
||||
|
||||
@ -79,6 +79,7 @@ MPV_UNRESPONSIVE_THRESHOLD = 60.0
|
||||
CONTROLLED_ROOMS_MIN_VERSION = "1.3.0"
|
||||
USER_READY_MIN_VERSION = "1.3.0"
|
||||
SHARED_PLAYLIST_MIN_VERSION = "1.4.0"
|
||||
CHAT_MIN_VERSION = "1.5.0"
|
||||
MPC_PATHS = [
|
||||
r"c:\program files (x86)\mpc-hc\mpc-hc.exe",
|
||||
r"c:\program files\mpc-hc\mpc-hc.exe",
|
||||
|
||||
@ -248,6 +248,8 @@ de = {
|
||||
"autoplay-guipushbuttonlabel" : u"Automatisch abspielen wenn alle bereit sind",
|
||||
"autoplay-minimum-label" : u"Minimum an Nutzern:",
|
||||
|
||||
"sendmessage-label" : u"Send", # TODO: Translate
|
||||
|
||||
"ready-guipushbuttonlabel" : u"Ich bin bereit den Film anzuschauen!",
|
||||
|
||||
"roomuser-heading-label" : u"Raum / Benutzer",
|
||||
@ -350,6 +352,7 @@ de = {
|
||||
"ready-tooltip" : u"Zeigt an, ob du bereit zum anschauen bist",
|
||||
"autoplay-tooltip" : u"Automatisch abspielen, wenn alle Nutzer bereit sind oder die minimale Nutzerzahl erreicht ist.",
|
||||
"switch-to-file-tooltip" : u"Doppelklicken um zu {} zu wechseln", # Filename
|
||||
"sendmessage-tooltip" : u"Send message to room", # TODO: Translate
|
||||
|
||||
# In-userlist notes (GUI)
|
||||
"differentsize-note" : u"Verschiedene Größe!",
|
||||
|
||||
@ -250,6 +250,8 @@ en = {
|
||||
"autoplay-guipushbuttonlabel" : u"Play when all ready",
|
||||
"autoplay-minimum-label" : u"Min users:",
|
||||
|
||||
"sendmessage-label" : u"Send",
|
||||
|
||||
"ready-guipushbuttonlabel" : u"I'm ready to watch!",
|
||||
|
||||
"roomuser-heading-label" : "Room / User",
|
||||
@ -350,6 +352,7 @@ en = {
|
||||
"ready-tooltip" : "Indicates whether you are ready to watch.",
|
||||
"autoplay-tooltip" : "Auto-play when all users who have readiness indicator are ready and minimum user threshold met.",
|
||||
"switch-to-file-tooltip" : u"Double click to switch to {}", # Filename
|
||||
"sendmessage-tooltip" : u"Send message to room",
|
||||
|
||||
# In-userlist notes (GUI)
|
||||
"differentsize-note" : "Different size!",
|
||||
|
||||
@ -250,6 +250,8 @@ ru = {
|
||||
"autoplay-guipushbuttonlabel" : u"Воспроизвести автоматически, когда все будут готовы",
|
||||
"autoplay-minimum-label" : u"Минимум пользователей:",
|
||||
|
||||
"sendmessage-label" : u"Send", # TODO: Translate
|
||||
|
||||
"ready-guipushbuttonlabel" : u"Я готов к просмотру!",
|
||||
|
||||
"roomuser-heading-label" : u"Комната / Пользователь",
|
||||
@ -350,6 +352,7 @@ ru = {
|
||||
"ready-tooltip" : u"Показывает, готовы ли Вы к просмотру или нет.",
|
||||
"autoplay-tooltip" : u"Автоматическое воспроизведение, когда все пользователи с индикаторами готовности будут готовы и присутствует достаточное число пользователей.",
|
||||
"switch-to-file-tooltip" : u"Double click to switch to {}", # Filename # TODO: Translate to Russian
|
||||
"sendmessage-tooltip" : u"Send message to room", # TODO: Translate
|
||||
|
||||
# In-userlist notes (GUI)
|
||||
"differentsize-note" : u"Размер файла не совпадает!",
|
||||
|
||||
@ -246,7 +246,8 @@ class SyncClientProtocol(JSONCommandProtocol):
|
||||
}
|
||||
})
|
||||
def handleChat(self,message):
|
||||
messageString = '<'+message['username']+'>'+message['message']
|
||||
userMessage = message['message'].replace(u"<",u"<<").replace(u">",u">>")
|
||||
messageString = u"<{}> {}".format(message['username'], userMessage)
|
||||
self._client.ui.showMessage(messageString)
|
||||
#TODO
|
||||
|
||||
|
||||
@ -328,8 +328,12 @@ class MainWindow(QtGui.QMainWindow):
|
||||
def showMessage(self, message, noTimestamp=False):
|
||||
message = unicode(message)
|
||||
message = message.replace(u"&", u"&").replace(u'"', u""").replace(u"<", u"<").replace(">", u">")
|
||||
message = message.replace(u"<<", u"<LT>")
|
||||
message = message.replace(u">>", u"<GT>")
|
||||
message = message.replace(u"<", u"<span style=\"{}\"><".format(constants.STYLE_USERNAME))
|
||||
message = message.replace(u">", u"></span>")
|
||||
message = message.replace(u"<LT>;", u"<")
|
||||
message = message.replace(u"<GT>", u">")
|
||||
message = message.replace(u"\n", u"<br />")
|
||||
if noTimestamp:
|
||||
self.newMessage(u"{}<br />".format(message))
|
||||
@ -962,6 +966,11 @@ class MainWindow(QtGui.QMainWindow):
|
||||
self._syncplayClient.playlist.changePlaylist(newPlaylist)
|
||||
self._syncplayClient.fileSwitch.updateInfo()
|
||||
|
||||
def sendChatMessage(self):
|
||||
if self.chatInput.text() <> "":
|
||||
self._syncplayClient.sendChat(self.chatInput.text())
|
||||
self.chatInput.setText("")
|
||||
|
||||
def addTopLayout(self, window):
|
||||
window.topSplit = self.topSplitter(Qt.Horizontal, self)
|
||||
|
||||
@ -977,12 +986,28 @@ class MainWindow(QtGui.QMainWindow):
|
||||
window.outputbox.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
|
||||
|
||||
window.outputlabel = QtGui.QLabel(getMessage("notifications-heading-label"))
|
||||
window.chatInput = QtGui.QLineEdit()
|
||||
window.chatInput.returnPressed.connect(self.sendChatMessage)
|
||||
window.chatButton = QtGui.QPushButton(QtGui.QIcon(self.resourcespath + 'email_go.png'),
|
||||
getMessage("sendmessage-label"))
|
||||
window.chatButton.pressed.connect(self.sendChatMessage)
|
||||
window.chatLayout = QtGui.QHBoxLayout()
|
||||
window.chatFrame = QtGui.QFrame()
|
||||
window.chatFrame.setLayout(self.chatLayout)
|
||||
window.chatFrame.setContentsMargins(0,0,0,0)
|
||||
window.chatFrame.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
|
||||
window.chatLayout.setContentsMargins(0,0,0,0)
|
||||
self.chatButton.setToolTip(getMessage("sendmessage-tooltip"))
|
||||
window.chatLayout.addWidget(window.chatInput)
|
||||
window.chatLayout.addWidget(window.chatButton)
|
||||
window.chatFrame.setMaximumHeight(window.chatFrame.sizeHint().height())
|
||||
window.outputFrame = QtGui.QFrame()
|
||||
window.outputFrame.setLineWidth(0)
|
||||
window.outputFrame.setMidLineWidth(0)
|
||||
window.outputLayout.setContentsMargins(0, 0, 0, 0)
|
||||
window.outputLayout.addWidget(window.outputlabel)
|
||||
window.outputLayout.addWidget(window.outputbox)
|
||||
window.outputLayout.addWidget(window.chatFrame)
|
||||
window.outputFrame.setLayout(window.outputLayout)
|
||||
|
||||
window.listLayout = QtGui.QVBoxLayout()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user