Browse Source

some bugs and corner cases

pull/39/head
Blue 2 years ago
parent
commit
0bcfd779b8
  1. 6
      core/account.cpp
  2. 4
      ui/utils/messageline.cpp
  3. 6
      ui/widgets/conversation.cpp
  4. 34
      ui/widgets/conversation.ui

6
core/account.cpp

@ -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)

4
ui/utils/messageline.cpp

@ -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()) {

6
ui/widgets/conversation.cpp

@ -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)

34
ui/widgets/conversation.ui

@ -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>

Loading…
Cancel
Save