some bug fixes, initial work on avatars in dialog windows
This commit is contained in:
parent
867c3a18e9
commit
f13b43d38b
18 changed files with 125 additions and 42 deletions
|
@ -18,8 +18,8 @@
|
|||
|
||||
#include "chat.h"
|
||||
|
||||
Chat::Chat(Models::Contact* p_contact, QWidget* parent):
|
||||
Conversation(false, p_contact->getAccountJid(), p_contact->getAccountResource(), p_contact->getJid(), "", p_contact->getAccountName(), parent),
|
||||
Chat::Chat(Models::Account* acc, Models::Contact* p_contact, QWidget* parent):
|
||||
Conversation(false, acc, p_contact->getJid(), "", parent),
|
||||
contact(p_contact)
|
||||
{
|
||||
setName(p_contact->getContactName());
|
||||
|
@ -27,8 +27,6 @@ Chat::Chat(Models::Contact* p_contact, QWidget* parent):
|
|||
setStatus(p_contact->getStatus());
|
||||
|
||||
connect(contact, &Models::Contact::childChanged, this, &Chat::onContactChanged);
|
||||
|
||||
line->setMyName(p_contact->getAccountName());
|
||||
}
|
||||
|
||||
Chat::~Chat()
|
||||
|
@ -62,8 +60,7 @@ void Chat::updateState()
|
|||
void Chat::handleSendMessage(const QString& text)
|
||||
{
|
||||
Shared::Message msg(Shared::Message::chat);
|
||||
msg.setFromJid(myJid);
|
||||
msg.setFromResource(myResource);
|
||||
msg.setFrom(account->getFullJid());
|
||||
msg.setToJid(palJid);
|
||||
msg.setToResource(activePalResource);
|
||||
msg.setBody(text);
|
||||
|
|
|
@ -30,7 +30,7 @@ class Chat : public Conversation
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Chat(Models::Contact* p_contact, QWidget* parent = 0);
|
||||
Chat(Models::Account* acc, Models::Contact* p_contact, QWidget* parent = 0);
|
||||
~Chat();
|
||||
|
||||
void addMessage(const Shared::Message & data) override;
|
||||
|
|
|
@ -26,14 +26,12 @@
|
|||
#include <QMimeDatabase>
|
||||
#include <unistd.h>
|
||||
|
||||
Conversation::Conversation(bool muc, const QString& mJid, const QString mRes, const QString pJid, const QString pRes, const QString& acc, QWidget* parent):
|
||||
Conversation::Conversation(bool muc, Models::Account* acc, const QString pJid, const QString pRes, QWidget* parent):
|
||||
QWidget(parent),
|
||||
isMuc(muc),
|
||||
myJid(mJid),
|
||||
myResource(mRes),
|
||||
account(acc),
|
||||
palJid(pJid),
|
||||
activePalResource(pRes),
|
||||
account(acc),
|
||||
line(new MessageLine(muc)),
|
||||
m_ui(new Ui::Conversation()),
|
||||
ker(),
|
||||
|
@ -85,6 +83,9 @@ Conversation::Conversation(bool muc, const QString& mJid, const QString mRes, co
|
|||
m_ui->scrollArea->installEventFilter(&scrollResizeCatcher);
|
||||
m_ui->filesPanel->installEventFilter(&attachResizeCatcher);
|
||||
|
||||
line->setMyAvatarPath(acc->getAvatarPath());
|
||||
line->setMyName(acc->getName());
|
||||
|
||||
applyVisualEffects();
|
||||
}
|
||||
|
||||
|
@ -124,7 +125,7 @@ void Conversation::setName(const QString& name)
|
|||
|
||||
QString Conversation::getAccount() const
|
||||
{
|
||||
return account;
|
||||
return account->getName();
|
||||
}
|
||||
|
||||
QString Conversation::getJid() const
|
||||
|
@ -199,8 +200,7 @@ void Conversation::onEnterPressed()
|
|||
msg.setType(Shared::Message::chat);
|
||||
msg.setToResource(activePalResource);
|
||||
}
|
||||
msg.setFromJid(myJid);
|
||||
msg.setFromResource(myResource);
|
||||
msg.setFrom(account->getFullJid());
|
||||
msg.setToJid(palJid);
|
||||
msg.setOutgoing(true);
|
||||
msg.generateRandomId();
|
||||
|
|
|
@ -21,8 +21,9 @@
|
|||
|
||||
#include <QWidget>
|
||||
#include <QScopedPointer>
|
||||
#include "../../global.h"
|
||||
#include "../../order.h"
|
||||
#include "global.h"
|
||||
#include "order.h"
|
||||
#include "../models/account.h"
|
||||
#include "../utils/messageline.h"
|
||||
#include "../utils/resizer.h"
|
||||
#include "../utils/flowlayout.h"
|
||||
|
@ -63,7 +64,7 @@ class Conversation : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Conversation(bool muc, const QString& mJid, const QString mRes, const QString pJid, const QString pRes, const QString& acc, QWidget* parent = 0);
|
||||
Conversation(bool muc, Models::Account* acc, const QString pJid, const QString pRes, QWidget* parent = 0);
|
||||
~Conversation();
|
||||
|
||||
QString getJid() const;
|
||||
|
@ -115,11 +116,9 @@ protected:
|
|||
keep,
|
||||
down
|
||||
};
|
||||
QString myJid;
|
||||
QString myResource;
|
||||
Models::Account* account;
|
||||
QString palJid;
|
||||
QString activePalResource;
|
||||
QString account;
|
||||
MessageLine* line;
|
||||
QScopedPointer<Ui::Conversation> m_ui;
|
||||
KeyEnterReceiver ker;
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
#include "room.h"
|
||||
|
||||
Room::Room(Models::Room* p_room, QWidget* parent):
|
||||
Conversation(true, p_room->getAccountJid(), p_room->getAccountResource(), p_room->getJid(), "", p_room->getAccountName(), parent),
|
||||
Room::Room(Models::Account* acc, Models::Room* p_room, QWidget* parent):
|
||||
Conversation(true, acc, p_room->getJid(), "", parent),
|
||||
room(p_room)
|
||||
{
|
||||
setName(p_room->getName());
|
||||
|
@ -36,8 +36,7 @@ Room::~Room()
|
|||
void Room::handleSendMessage(const QString& text)
|
||||
{
|
||||
Shared::Message msg(Shared::Message::groupChat);
|
||||
msg.setFromJid(myJid);
|
||||
msg.setFromResource(myResource);
|
||||
msg.setFrom(account->getFullJid());
|
||||
msg.setToJid(palJid);
|
||||
//msg.setToResource(activePalResource);
|
||||
msg.setBody(text);
|
||||
|
|
|
@ -29,7 +29,7 @@ class Room : public Conversation
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Room(Models::Room* p_room, QWidget* parent = 0);
|
||||
Room(Models::Account* acc, Models::Room* p_room, QWidget* parent = 0);
|
||||
~Room();
|
||||
|
||||
bool autoJoined() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue