mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fixed shown name in chat list.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4810 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
df741f7c64
commit
1ec716175b
@ -51,13 +51,13 @@ ChatDialog::~ChatDialog()
|
||||
}
|
||||
}
|
||||
|
||||
void ChatDialog::init(const std::string &peerId, const QString &peerName)
|
||||
void ChatDialog::init(const std::string &peerId, const QString &title)
|
||||
{
|
||||
this->peerId = peerId;
|
||||
|
||||
ChatWidget *cw = getChatWidget();
|
||||
if (cw) {
|
||||
cw->init(peerId, peerName);
|
||||
cw->init(peerId, title);
|
||||
|
||||
connect(cw, SIGNAL(infoChanged(ChatWidget*)), this, SLOT(chatInfoChanged(ChatWidget*)));
|
||||
connect(cw, SIGNAL(newMessage(ChatWidget*)), this, SLOT(chatNewMessage(ChatWidget*)));
|
||||
@ -282,7 +282,7 @@ QString ChatDialog::getTitle()
|
||||
{
|
||||
ChatWidget *cw = getChatWidget();
|
||||
if (cw) {
|
||||
return cw->getPeerName();
|
||||
return cw->getTitle();
|
||||
}
|
||||
|
||||
return "";
|
||||
|
@ -76,7 +76,7 @@ protected:
|
||||
explicit ChatDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
virtual ~ChatDialog();
|
||||
|
||||
virtual void init(const std::string &peerId, const QString &peerName);
|
||||
virtual void init(const std::string &peerId, const QString &title);
|
||||
virtual void onChatChanged(int list, int type) {}
|
||||
|
||||
virtual void addIncomingChatMsg(const ChatInfo& info) = 0;
|
||||
|
@ -41,9 +41,13 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::WF
|
||||
connect(ui.participantsFrameButton, SIGNAL(toggled(bool)), this, SLOT(showParticipantsFrame(bool)));
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::init(const std::string &peerId, const QString &peerName)
|
||||
void ChatLobbyDialog::init(const std::string &peerId, const QString &title)
|
||||
{
|
||||
ChatDialog::init(peerId, peerName);
|
||||
ChatDialog::init(peerId, title);
|
||||
|
||||
std::string nickName;
|
||||
rsMsgs->getNickNameForChatLobby(lobbyId, nickName);
|
||||
ui.chatWidget->setName(QString::fromUtf8(nickName.c_str()));
|
||||
|
||||
lastUpdateListTime = 0;
|
||||
|
||||
@ -96,6 +100,7 @@ void ChatLobbyDialog::processSettings(bool load)
|
||||
void ChatLobbyDialog::setNickName(const QString& nick)
|
||||
{
|
||||
rsMsgs->setNickNameForChatLobby(lobbyId, nick.toUtf8().constData());
|
||||
ui.chatWidget->setName(nick);
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::addIncomingChatMsg(const ChatInfo& info)
|
||||
|
@ -52,7 +52,7 @@ protected:
|
||||
|
||||
void processSettings(bool load);
|
||||
|
||||
virtual void init(const std::string &peerId, const QString &peerName);
|
||||
virtual void init(const std::string &peerId, const QString &title);
|
||||
virtual void addIncomingChatMsg(const ChatInfo& info);
|
||||
|
||||
protected slots:
|
||||
|
@ -147,12 +147,15 @@ ChatWidget::~ChatWidget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ChatWidget::init(const std::string &peerId, const QString &peerName)
|
||||
void ChatWidget::init(const std::string &peerId, const QString &title)
|
||||
{
|
||||
this->peerId = peerId;
|
||||
this->peerName = peerName;
|
||||
this->title = title;
|
||||
|
||||
ui->friendnamelabel->setText(peerName);
|
||||
ui->friendnamelabel->setText(title);
|
||||
|
||||
std::string ownId = rsPeers->getOwnId();
|
||||
setName(QString::fromUtf8(rsPeers->getPeerName(ownId).c_str()));
|
||||
|
||||
ChatLobbyId lid;
|
||||
if (rsMsgs->isLobbyId(peerId, lid)) {
|
||||
@ -400,15 +403,13 @@ void ChatWidget::sendChat()
|
||||
return;
|
||||
}
|
||||
|
||||
std::string ownId = rsPeers->getOwnId();
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cout << "ChatWidget:sendChat " << std::endl;
|
||||
#endif
|
||||
|
||||
if (rsMsgs->sendPrivateChat(peerId, msg)) {
|
||||
QDateTime currentTime = QDateTime::currentDateTime();
|
||||
addChatMsg(false, QString::fromUtf8(rsPeers->getPeerName(ownId).c_str()), currentTime, currentTime, QString::fromStdWString(msg), TYPE_NORMAL);
|
||||
addChatMsg(false, name, currentTime, currentTime, QString::fromStdWString(msg), TYPE_NORMAL);
|
||||
}
|
||||
|
||||
chatWidget->clear();
|
||||
@ -562,9 +563,8 @@ void ChatWidget::fileHashingFinished(QList<HashedFile> hashedFiles)
|
||||
std::wstring msg = textBrowser.toHtml().toStdWString();
|
||||
|
||||
if (rsMsgs->sendPrivateChat(peerId, msg)) {
|
||||
std::string ownId = rsPeers->getOwnId();
|
||||
QDateTime currentTime = QDateTime::currentDateTime();
|
||||
addChatMsg(false, QString::fromUtf8(rsPeers->getPeerName(ownId).c_str()), currentTime, currentTime, QString::fromStdWString(msg), TYPE_NORMAL);
|
||||
addChatMsg(false, name, currentTime, currentTime, QString::fromStdWString(msg), TYPE_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -608,6 +608,8 @@ void ChatWidget::updateStatus(const QString &peer_id, int status)
|
||||
if (peer_id.toStdString() == peerId) {
|
||||
// the peers status has changed
|
||||
|
||||
QString peerName = QString::fromUtf8(rsPeers->getPeerName(peerId).c_str());
|
||||
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
ui->infoframe->setVisible(true);
|
||||
@ -678,6 +680,11 @@ void ChatWidget::updateStatusString(const QString &statusMask, const QString &st
|
||||
QTimer::singleShot(5000, this, SLOT(resetStatusBar())) ;
|
||||
}
|
||||
|
||||
void ChatWidget::setName(const QString &name)
|
||||
{
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
bool ChatWidget::setStyle()
|
||||
{
|
||||
if (style.showDialog(window())) {
|
||||
|
@ -48,8 +48,8 @@ public:
|
||||
public:
|
||||
explicit ChatWidget(QWidget *parent = 0);
|
||||
~ChatWidget();
|
||||
|
||||
void init(const std::string &peerId, const QString &peerName);
|
||||
|
||||
void init(const std::string &peerId, const QString &title);
|
||||
|
||||
bool hasNewMessages() { return newMessages; }
|
||||
bool isTyping() { return typing; }
|
||||
@ -64,8 +64,9 @@ public:
|
||||
void addToolsAction(QAction *action);
|
||||
|
||||
std::string getPeerId() { return peerId; }
|
||||
QString getPeerName() { return peerName; }
|
||||
QString getTitle() { return title; }
|
||||
int getPeerStatus() { return peerStatus; }
|
||||
void setName(const QString &name);
|
||||
|
||||
bool setStyle();
|
||||
const RSStyle *getStyle() { return &style; }
|
||||
@ -120,7 +121,8 @@ private:
|
||||
void processSettings(bool load);
|
||||
|
||||
std::string peerId;
|
||||
QString peerName;
|
||||
QString title;
|
||||
QString name;
|
||||
|
||||
QColor currentColor;
|
||||
QFont currentFont;
|
||||
|
@ -50,9 +50,9 @@ PopupChatDialog::PopupChatDialog(QWidget *parent, Qt::WFlags flags)
|
||||
connect(NotifyQt::getInstance(), SIGNAL(chatStatusChanged(const QString&, const QString&, bool)), this, SLOT(chatStatusChanged(const QString&, const QString&, bool)));
|
||||
}
|
||||
|
||||
void PopupChatDialog::init(const std::string &peerId, const QString &peerName)
|
||||
void PopupChatDialog::init(const std::string &peerId, const QString &title)
|
||||
{
|
||||
ChatDialog::init(peerId, peerName);
|
||||
ChatDialog::init(peerId, title);
|
||||
|
||||
/* Hide or show the avatar frames */
|
||||
showAvatarFrame(PeerSettings->getShowAvatarFrame(peerId));
|
||||
|
@ -45,7 +45,7 @@ protected:
|
||||
/** Default destructor */
|
||||
virtual ~PopupChatDialog();
|
||||
|
||||
virtual void init(const std::string &peerId, const QString &peerName);
|
||||
virtual void init(const std::string &peerId, const QString &title);
|
||||
virtual void showDialog(uint chatflags);
|
||||
virtual ChatWidget *getChatWidget();
|
||||
virtual bool hasPeerStatus() { return true; }
|
||||
|
Loading…
Reference in New Issue
Block a user