57 """ |
57 """ |
58 super(ChatWidget, self).__init__(parent) |
58 super(ChatWidget, self).__init__(parent) |
59 self.setupUi(self) |
59 self.setupUi(self) |
60 |
60 |
61 self.shareButton.setIcon( |
61 self.shareButton.setIcon( |
62 UI.PixmapCache.getIcon("sharedEditDisconnected.png")) |
62 UI.PixmapCache.getIcon("sharedEditDisconnected")) |
63 self.startEditButton.setIcon( |
63 self.startEditButton.setIcon( |
64 UI.PixmapCache.getIcon("sharedEditStart.png")) |
64 UI.PixmapCache.getIcon("sharedEditStart")) |
65 self.sendEditButton.setIcon( |
65 self.sendEditButton.setIcon( |
66 UI.PixmapCache.getIcon("sharedEditSend.png")) |
66 UI.PixmapCache.getIcon("sharedEditSend")) |
67 self.cancelEditButton.setIcon( |
67 self.cancelEditButton.setIcon( |
68 UI.PixmapCache.getIcon("sharedEditCancel.png")) |
68 UI.PixmapCache.getIcon("sharedEditCancel")) |
69 |
69 |
70 self.__ui = ui |
70 self.__ui = ui |
71 self.__client = CooperationClient(self) |
71 self.__client = CooperationClient(self) |
72 self.__myNickName = self.__client.nickName() |
72 self.__myNickName = self.__client.nickName() |
73 |
73 |
175 self.chatEdit.append(self.tr("* {0} has joined.\n").format(nick)) |
175 self.chatEdit.append(self.tr("* {0} has joined.\n").format(nick)) |
176 self.chatEdit.setTextColor(color) |
176 self.chatEdit.setTextColor(color) |
177 |
177 |
178 QListWidgetItem( |
178 QListWidgetItem( |
179 UI.PixmapCache.getIcon( |
179 UI.PixmapCache.getIcon( |
180 "chatUser{0}.png".format(1 + self.usersList.count() % 6)), |
180 "chatUser{0}".format(1 + self.usersList.count() % 6)), |
181 nick, self.usersList) |
181 nick, self.usersList) |
182 |
182 |
183 if not self.__connected: |
183 if not self.__connected: |
184 self.__setConnected(True) |
184 self.__setConnected(True) |
185 |
185 |
186 if not self.isVisible(): |
186 if not self.isVisible(): |
187 self.__ui.showNotification( |
187 self.__ui.showNotification( |
188 UI.PixmapCache.getPixmap("cooperation48.png"), |
188 UI.PixmapCache.getPixmap("cooperation48"), |
189 self.tr("New User"), self.tr("{0} has joined.") |
189 self.tr("New User"), self.tr("{0} has joined.") |
190 .format(nick)) |
190 .format(nick)) |
191 |
191 |
192 def __participantLeft(self, nick): |
192 def __participantLeft(self, nick): |
193 """ |
193 """ |
214 if not self.__client.hasConnections(): |
214 if not self.__client.hasConnections(): |
215 self.__setConnected(False) |
215 self.__setConnected(False) |
216 |
216 |
217 if not self.isVisible(): |
217 if not self.isVisible(): |
218 self.__ui.showNotification( |
218 self.__ui.showNotification( |
219 UI.PixmapCache.getPixmap("cooperation48.png"), |
219 UI.PixmapCache.getPixmap("cooperation48"), |
220 self.tr("User Left"), self.tr("{0} has left.") |
220 self.tr("User Left"), self.tr("{0} has left.") |
221 .format(nick)) |
221 .format(nick)) |
222 |
222 |
223 def appendMessage(self, from_, message): |
223 def appendMessage(self, from_, message): |
224 """ |
224 """ |
237 bar = self.chatEdit.verticalScrollBar() |
237 bar = self.chatEdit.verticalScrollBar() |
238 bar.setValue(bar.maximum()) |
238 bar.setValue(bar.maximum()) |
239 |
239 |
240 if not self.isVisible(): |
240 if not self.isVisible(): |
241 self.__ui.showNotification( |
241 self.__ui.showNotification( |
242 UI.PixmapCache.getPixmap("cooperation48.png"), |
242 UI.PixmapCache.getPixmap("cooperation48"), |
243 self.tr("Message from <{0}>").format(from_), message) |
243 self.tr("Message from <{0}>").format(from_), message) |
244 |
244 |
245 @pyqtSlot(str) |
245 @pyqtSlot(str) |
246 def on_hostEdit_editTextChanged(self, host): |
246 def on_hostEdit_editTextChanged(self, host): |
247 """ |
247 """ |
415 |
415 |
416 @param checked flag indicating the button state (boolean) |
416 @param checked flag indicating the button state (boolean) |
417 """ |
417 """ |
418 if checked: |
418 if checked: |
419 self.shareButton.setIcon( |
419 self.shareButton.setIcon( |
420 UI.PixmapCache.getIcon("sharedEditConnected.png")) |
420 UI.PixmapCache.getIcon("sharedEditConnected")) |
421 else: |
421 else: |
422 self.shareButton.setIcon( |
422 self.shareButton.setIcon( |
423 UI.PixmapCache.getIcon("sharedEditDisconnected.png")) |
423 UI.PixmapCache.getIcon("sharedEditDisconnected")) |
424 self.startEditButton.setEnabled(checked) |
424 self.startEditButton.setEnabled(checked) |
425 |
425 |
426 self.shareEditor.emit(checked) |
426 self.shareEditor.emit(checked) |
427 |
427 |
428 @pyqtSlot(bool) |
428 @pyqtSlot(bool) |
475 shareable, sharing, editing, remoteEditing = editor.getSharingStatus() |
475 shareable, sharing, editing, remoteEditing = editor.getSharingStatus() |
476 |
476 |
477 self.shareButton.setChecked(sharing) |
477 self.shareButton.setChecked(sharing) |
478 if sharing: |
478 if sharing: |
479 self.shareButton.setIcon( |
479 self.shareButton.setIcon( |
480 UI.PixmapCache.getIcon("sharedEditConnected.png")) |
480 UI.PixmapCache.getIcon("sharedEditConnected")) |
481 else: |
481 else: |
482 self.shareButton.setIcon( |
482 self.shareButton.setIcon( |
483 UI.PixmapCache.getIcon("sharedEditDisconnected.png")) |
483 UI.PixmapCache.getIcon("sharedEditDisconnected")) |
484 self.startEditButton.setChecked(editing) |
484 self.startEditButton.setChecked(editing) |
485 |
485 |
486 self.shareButton.setEnabled(shareable and not editing) |
486 self.shareButton.setEnabled(shareable and not editing) |
487 self.startEditButton.setEnabled( |
487 self.startEditButton.setEnabled( |
488 sharing and not editing and not remoteEditing) |
488 sharing and not editing and not remoteEditing) |
493 """ |
493 """ |
494 Private slot to initialize the chat edit context menu. |
494 Private slot to initialize the chat edit context menu. |
495 """ |
495 """ |
496 self.__chatMenu = QMenu(self) |
496 self.__chatMenu = QMenu(self) |
497 self.__copyChatAct = self.__chatMenu.addAction( |
497 self.__copyChatAct = self.__chatMenu.addAction( |
498 UI.PixmapCache.getIcon("editCopy.png"), |
498 UI.PixmapCache.getIcon("editCopy"), |
499 self.tr("Copy"), self.__copyChat) |
499 self.tr("Copy"), self.__copyChat) |
500 self.__chatMenu.addSeparator() |
500 self.__chatMenu.addSeparator() |
501 self.__cutAllChatAct = self.__chatMenu.addAction( |
501 self.__cutAllChatAct = self.__chatMenu.addAction( |
502 UI.PixmapCache.getIcon("editCut.png"), |
502 UI.PixmapCache.getIcon("editCut"), |
503 self.tr("Cut all"), self.__cutAllChat) |
503 self.tr("Cut all"), self.__cutAllChat) |
504 self.__copyAllChatAct = self.__chatMenu.addAction( |
504 self.__copyAllChatAct = self.__chatMenu.addAction( |
505 UI.PixmapCache.getIcon("editCopy.png"), |
505 UI.PixmapCache.getIcon("editCopy"), |
506 self.tr("Copy all"), self.__copyAllChat) |
506 self.tr("Copy all"), self.__copyAllChat) |
507 self.__chatMenu.addSeparator() |
507 self.__chatMenu.addSeparator() |
508 self.__clearChatAct = self.__chatMenu.addAction( |
508 self.__clearChatAct = self.__chatMenu.addAction( |
509 UI.PixmapCache.getIcon("editDelete.png"), |
509 UI.PixmapCache.getIcon("editDelete"), |
510 self.tr("Clear"), self.__clearChat) |
510 self.tr("Clear"), self.__clearChat) |
511 self.__chatMenu.addSeparator() |
511 self.__chatMenu.addSeparator() |
512 self.__saveChatAct = self.__chatMenu.addAction( |
512 self.__saveChatAct = self.__chatMenu.addAction( |
513 UI.PixmapCache.getIcon("fileSave.png"), |
513 UI.PixmapCache.getIcon("fileSave"), |
514 self.tr("Save"), self.__saveChat) |
514 self.tr("Save"), self.__saveChat) |
515 |
515 |
516 self.on_chatEdit_copyAvailable(False) |
516 self.on_chatEdit_copyAvailable(False) |
517 |
517 |
518 @pyqtSlot(bool) |
518 @pyqtSlot(bool) |
615 """ |
615 """ |
616 Private slot to initialize the users list context menu. |
616 Private slot to initialize the users list context menu. |
617 """ |
617 """ |
618 self.__usersMenu = QMenu(self) |
618 self.__usersMenu = QMenu(self) |
619 self.__kickUserAct = self.__usersMenu.addAction( |
619 self.__kickUserAct = self.__usersMenu.addAction( |
620 UI.PixmapCache.getIcon("chatKickUser.png"), |
620 UI.PixmapCache.getIcon("chatKickUser"), |
621 self.tr("Kick User"), self.__kickUser) |
621 self.tr("Kick User"), self.__kickUser) |
622 self.__banUserAct = self.__usersMenu.addAction( |
622 self.__banUserAct = self.__usersMenu.addAction( |
623 UI.PixmapCache.getIcon("chatBanUser.png"), |
623 UI.PixmapCache.getIcon("chatBanUser"), |
624 self.tr("Ban User"), self.__banUser) |
624 self.tr("Ban User"), self.__banUser) |
625 self.__banKickUserAct = self.__usersMenu.addAction( |
625 self.__banKickUserAct = self.__usersMenu.addAction( |
626 UI.PixmapCache.getIcon("chatBanKickUser.png"), |
626 UI.PixmapCache.getIcon("chatBanKickUser"), |
627 self.tr("Ban and Kick User"), self.__banKickUser) |
627 self.tr("Ban and Kick User"), self.__banKickUser) |
628 |
628 |
629 @pyqtSlot(QPoint) |
629 @pyqtSlot(QPoint) |
630 def on_usersList_customContextMenuRequested(self, pos): |
630 def on_usersList_customContextMenuRequested(self, pos): |
631 """ |
631 """ |