avatars in chat
This commit is contained in:
parent
babeeb969c
commit
3f9a35e164
@ -127,12 +127,12 @@ class Friend(contact.Contact):
|
|||||||
del self._message_getter
|
del self._message_getter
|
||||||
# don't delete data about active file transfer
|
# don't delete data about active file transfer
|
||||||
if not save_unsent:
|
if not save_unsent:
|
||||||
self._corr = list(filter(lambda x: x.get_type() in (2, 3) and
|
self._corr = list(filter(lambda x: x.get_type() == 2 and
|
||||||
x.get_status() in ft.ACTIVE_FILE_TRANSFERS, self._corr))
|
x.get_status() in ft.ACTIVE_FILE_TRANSFERS, self._corr))
|
||||||
self._unsaved_messages = 0
|
self._unsaved_messages = 0
|
||||||
else:
|
else:
|
||||||
self._corr = list(filter(lambda x: (x.get_type() in (2, 3) and x.get_status() in ft.ACTIVE_FILE_TRANSFERS)
|
self._corr = list(filter(lambda x: (x.get_type() == 2 and x.get_status() in ft.ACTIVE_FILE_TRANSFERS)
|
||||||
or (x.get_type() <= 1 and x.get_owner() == MESSAGE_OWNER['NOT_SENT']),
|
or (x.get_type() <= 1 and x.get_owner() == MESSAGE_OWNER['NOT_SENT']),
|
||||||
self._corr))
|
self._corr))
|
||||||
self._unsaved_messages = len(self.get_unsent_messages())
|
self._unsaved_messages = len(self.get_unsent_messages())
|
||||||
|
|
||||||
|
@ -159,6 +159,14 @@ class MessageItem(QtGui.QWidget):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def set_avatar(self, pixmap):
|
||||||
|
self.name.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
|
self.message.setAlignment(QtCore.Qt.AlignVCenter)
|
||||||
|
self.setFixedHeight(max(self.height(), 36))
|
||||||
|
self.name.setFixedHeight(self.height())
|
||||||
|
self.message.setFixedHeight(self.height())
|
||||||
|
self.name.setPixmap(pixmap.scaled(30, 30, QtCore.Qt.KeepAspectRatio))
|
||||||
|
|
||||||
|
|
||||||
class ContactItem(QtGui.QWidget):
|
class ContactItem(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
|
@ -554,8 +554,8 @@ class InterfaceSettings(CenteredWidget):
|
|||||||
|
|
||||||
def initUI(self):
|
def initUI(self):
|
||||||
self.setObjectName("interfaceForm")
|
self.setObjectName("interfaceForm")
|
||||||
self.setMinimumSize(QtCore.QSize(400, 550))
|
self.setMinimumSize(QtCore.QSize(400, 580))
|
||||||
self.setMaximumSize(QtCore.QSize(400, 550))
|
self.setMaximumSize(QtCore.QSize(400, 580))
|
||||||
self.label = QtGui.QLabel(self)
|
self.label = QtGui.QLabel(self)
|
||||||
self.label.setGeometry(QtCore.QRect(30, 10, 370, 20))
|
self.label.setGeometry(QtCore.QRect(30, 10, 370, 20))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
@ -610,25 +610,30 @@ class InterfaceSettings(CenteredWidget):
|
|||||||
self.messages_font_size.setCurrentIndex(settings['message_font_size'] - 10)
|
self.messages_font_size.setCurrentIndex(settings['message_font_size'] - 10)
|
||||||
|
|
||||||
self.unread = QtGui.QPushButton(self)
|
self.unread = QtGui.QPushButton(self)
|
||||||
self.unread.setGeometry(QtCore.QRect(30, 425, 340, 30))
|
self.unread.setGeometry(QtCore.QRect(30, 465, 340, 30))
|
||||||
self.unread.clicked.connect(self.select_color)
|
self.unread.clicked.connect(self.select_color)
|
||||||
|
|
||||||
self.compact_mode = QtGui.QCheckBox(self)
|
self.compact_mode = QtGui.QCheckBox(self)
|
||||||
self.compact_mode.setGeometry(QtCore.QRect(30, 380, 370, 20))
|
self.compact_mode.setGeometry(QtCore.QRect(30, 380, 370, 20))
|
||||||
self.compact_mode.setChecked(settings['compact_mode'])
|
self.compact_mode.setChecked(settings['compact_mode'])
|
||||||
|
|
||||||
|
self.show_avatars = QtGui.QCheckBox(self)
|
||||||
|
self.show_avatars.setGeometry(QtCore.QRect(30, 410, 370, 20))
|
||||||
|
self.show_avatars.setChecked(settings['show_avatars'])
|
||||||
|
|
||||||
self.import_smileys = QtGui.QPushButton(self)
|
self.import_smileys = QtGui.QPushButton(self)
|
||||||
self.import_smileys.setGeometry(QtCore.QRect(30, 465, 340, 30))
|
self.import_smileys.setGeometry(QtCore.QRect(30, 505, 340, 30))
|
||||||
self.import_smileys.clicked.connect(self.import_sm)
|
self.import_smileys.clicked.connect(self.import_sm)
|
||||||
|
|
||||||
self.import_stickers = QtGui.QPushButton(self)
|
self.import_stickers = QtGui.QPushButton(self)
|
||||||
self.import_stickers.setGeometry(QtCore.QRect(30, 505, 340, 30))
|
self.import_stickers.setGeometry(QtCore.QRect(30, 545, 340, 30))
|
||||||
self.import_stickers.clicked.connect(self.import_st)
|
self.import_stickers.clicked.connect(self.import_st)
|
||||||
|
|
||||||
self.retranslateUi()
|
self.retranslateUi()
|
||||||
QtCore.QMetaObject.connectSlotsByName(self)
|
QtCore.QMetaObject.connectSlotsByName(self)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
|
self.show_avatars.setText(QtGui.QApplication.translate("interfaceForm", "Show avatars in chat", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.setWindowTitle(QtGui.QApplication.translate("interfaceForm", "Interface settings", None, QtGui.QApplication.UnicodeUTF8))
|
self.setWindowTitle(QtGui.QApplication.translate("interfaceForm", "Interface settings", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.label.setText(QtGui.QApplication.translate("interfaceForm", "Theme:", None, QtGui.QApplication.UnicodeUTF8))
|
self.label.setText(QtGui.QApplication.translate("interfaceForm", "Theme:", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.lang.setText(QtGui.QApplication.translate("interfaceForm", "Language:", None, QtGui.QApplication.UnicodeUTF8))
|
self.lang.setText(QtGui.QApplication.translate("interfaceForm", "Language:", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
@ -689,6 +694,9 @@ class InterfaceSettings(CenteredWidget):
|
|||||||
if settings['compact_mode'] != self.compact_mode.isChecked():
|
if settings['compact_mode'] != self.compact_mode.isChecked():
|
||||||
settings['compact_mode'] = self.compact_mode.isChecked()
|
settings['compact_mode'] = self.compact_mode.isChecked()
|
||||||
restart = True
|
restart = True
|
||||||
|
if settings['show_avatars'] != self.show_avatars.isChecked():
|
||||||
|
settings['show_avatars'] = self.show_avatars.isChecked()
|
||||||
|
restart = True
|
||||||
settings['smiley_pack'] = self.smiley_pack.currentText()
|
settings['smiley_pack'] = self.smiley_pack.currentText()
|
||||||
smileys.SmileyLoader.get_instance().load_pack()
|
smileys.SmileyLoader.get_instance().load_pack()
|
||||||
language = self.lang_choose.currentText()
|
language = self.lang_choose.currentText()
|
||||||
|
@ -41,6 +41,8 @@ class Profile(contact.Contact, Singleton):
|
|||||||
self._load_history = True
|
self._load_history = True
|
||||||
settings = Settings.get_instance()
|
settings = Settings.get_instance()
|
||||||
self._show_online = settings['show_online_friends']
|
self._show_online = settings['show_online_friends']
|
||||||
|
self._show_avatars = settings['show_avatars']
|
||||||
|
self._friend_item_height = 40 if settings['compact_mode'] else 70
|
||||||
screen.online_contacts.setCurrentIndex(int(self._show_online))
|
screen.online_contacts.setCurrentIndex(int(self._show_online))
|
||||||
aliases = settings['friends_aliases']
|
aliases = settings['friends_aliases']
|
||||||
data = tox.self_get_friend_list()
|
data = tox.self_get_friend_list()
|
||||||
@ -122,7 +124,7 @@ class Profile(contact.Contact, Singleton):
|
|||||||
friend.visibility = friend.visibility or friend.messages or friend.actions
|
friend.visibility = friend.visibility or friend.messages or friend.actions
|
||||||
if friend.visibility:
|
if friend.visibility:
|
||||||
self._screen.friends_list.item(index).setSizeHint(QtCore.QSize(250,
|
self._screen.friends_list.item(index).setSizeHint(QtCore.QSize(250,
|
||||||
40 if settings['compact_mode'] else 70))
|
self._friend_item_height))
|
||||||
else:
|
else:
|
||||||
self._screen.friends_list.item(index).setSizeHint(QtCore.QSize(250, 0))
|
self._screen.friends_list.item(index).setSizeHint(QtCore.QSize(250, 0))
|
||||||
self._show_online, self._filter_string = show_online, filter_str
|
self._show_online, self._filter_string = show_online, filter_str
|
||||||
@ -532,6 +534,9 @@ class Profile(contact.Contact, Singleton):
|
|||||||
else:
|
else:
|
||||||
name = self._name
|
name = self._name
|
||||||
item = MessageItem(text, time, name, owner != MESSAGE_OWNER['NOT_SENT'], message_type, self._messages)
|
item = MessageItem(text, time, name, owner != MESSAGE_OWNER['NOT_SENT'], message_type, self._messages)
|
||||||
|
if self._show_avatars:
|
||||||
|
item.set_avatar(self._friends[self._active_friend].get_pixmap() if owner == MESSAGE_OWNER[
|
||||||
|
'FRIEND'] else self.get_pixmap())
|
||||||
elem = QtGui.QListWidgetItem()
|
elem = QtGui.QListWidgetItem()
|
||||||
elem.setSizeHint(QtCore.QSize(self._messages.width(), item.height()))
|
elem.setSizeHint(QtCore.QSize(self._messages.width(), item.height()))
|
||||||
if append:
|
if append:
|
||||||
|
@ -110,6 +110,7 @@ class Settings(dict, Singleton):
|
|||||||
'show_online_friends': False,
|
'show_online_friends': False,
|
||||||
'auto_accept_from_friends': [],
|
'auto_accept_from_friends': [],
|
||||||
'friends_aliases': [],
|
'friends_aliases': [],
|
||||||
|
'show_avatars': False,
|
||||||
'typing_notifications': False,
|
'typing_notifications': False,
|
||||||
'calls_sound': True,
|
'calls_sound': True,
|
||||||
'blocked': [],
|
'blocked': [],
|
||||||
|
Loading…
Reference in New Issue
Block a user