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
{
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/" + name + "/" + "avatar." + avatarType;
if (avatarType.size() == 0) {
return "";
} else {
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/" + name + "/" + "avatar." + avatarType;
}
}
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)
{
std::map<QString, QString>::iterator itr = palAvatars.find(jid);
if (itr != palNames.end()) {
palNames.erase(itr);
if (itr != palAvatars.end()) {
palAvatars.erase(itr);
std::map<QString, Index>::iterator pItr = palMessages.find(jid);
if (pItr != palMessages.end()) {

View File

@ -386,7 +386,11 @@ void Conversation::onClearButton()
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)

View File

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