some bugs and corner cases

This commit is contained in:
Blue 2019-12-24 11:42:46 +03:00
parent dd62f84acc
commit 0bcfd779b8
4 changed files with 44 additions and 6 deletions

View File

@ -1556,7 +1556,11 @@ void Core::Account::onOwnVCardReceived(const QXmppVCardIq& card)
QString Core::Account::getAvatarPath() const QString Core::Account::getAvatarPath() const
{ {
if (avatarType.size() == 0) {
return "";
} else {
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/" + name + "/" + "avatar." + avatarType; return QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/" + name + "/" + "avatar." + avatarType;
}
} }
void Core::Account::onContactAvatarChanged(Shared::Avatar type, const QString& path) void Core::Account::onContactAvatarChanged(Shared::Avatar type, const QString& path)

View File

@ -212,8 +212,8 @@ void MessageLine::setPalAvatar(const QString& jid, const QString& path)
void MessageLine::dropPalAvatar(const QString& jid) void MessageLine::dropPalAvatar(const QString& jid)
{ {
std::map<QString, QString>::iterator itr = palAvatars.find(jid); std::map<QString, QString>::iterator itr = palAvatars.find(jid);
if (itr != palNames.end()) { if (itr != palAvatars.end()) {
palNames.erase(itr); palAvatars.erase(itr);
std::map<QString, Index>::iterator pItr = palMessages.find(jid); std::map<QString, Index>::iterator pItr = palMessages.find(jid);
if (pItr != palMessages.end()) { if (pItr != palMessages.end()) {

View File

@ -386,7 +386,11 @@ void Conversation::onClearButton()
void Conversation::setAvatar(const QString& path) void Conversation::setAvatar(const QString& path)
{ {
m_ui->avatar->setPixmap(path.size() == 0 ? Shared::iconPath("user", true) : path); if (path.size() == 0) {
m_ui->avatar->setPixmap(Shared::icon("user", true).pixmap(QSize(50, 50)));
} else {
m_ui->avatar->setPixmap(path);
}
} }
void Conversation::onAttachResize(const QSize& oldSize, const QSize& newSize) void Conversation::onAttachResize(const QSize& oldSize, const QSize& newSize)

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>572</width> <width>572</width>
<height>485</height> <height>484</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
@ -95,11 +95,26 @@
</property> </property>
<item> <item>
<widget class="QLabel" name="statusIcon"> <widget class="QLabel" name="statusIcon">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="scaledContents"> <property name="scaledContents">
<bool>true</bool> <bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
@ -149,18 +164,33 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="avatar"> <widget class="QLabel" name="avatar">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>60</width> <width>60</width>
<height>60</height> <height>60</height>
</size> </size>
</property> </property>
<property name="baseSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="scaledContents"> <property name="scaledContents">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="margin">
<number>5</number>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>