mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-16 01:47:17 -05: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;
|
this->peerId = peerId;
|
||||||
|
|
||||||
ChatWidget *cw = getChatWidget();
|
ChatWidget *cw = getChatWidget();
|
||||||
if (cw) {
|
if (cw) {
|
||||||
cw->init(peerId, peerName);
|
cw->init(peerId, title);
|
||||||
|
|
||||||
connect(cw, SIGNAL(infoChanged(ChatWidget*)), this, SLOT(chatInfoChanged(ChatWidget*)));
|
connect(cw, SIGNAL(infoChanged(ChatWidget*)), this, SLOT(chatInfoChanged(ChatWidget*)));
|
||||||
connect(cw, SIGNAL(newMessage(ChatWidget*)), this, SLOT(chatNewMessage(ChatWidget*)));
|
connect(cw, SIGNAL(newMessage(ChatWidget*)), this, SLOT(chatNewMessage(ChatWidget*)));
|
||||||
@ -282,7 +282,7 @@ QString ChatDialog::getTitle()
|
|||||||
{
|
{
|
||||||
ChatWidget *cw = getChatWidget();
|
ChatWidget *cw = getChatWidget();
|
||||||
if (cw) {
|
if (cw) {
|
||||||
return cw->getPeerName();
|
return cw->getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
@ -76,7 +76,7 @@ protected:
|
|||||||
explicit ChatDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
|
explicit ChatDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||||
virtual ~ChatDialog();
|
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 onChatChanged(int list, int type) {}
|
||||||
|
|
||||||
virtual void addIncomingChatMsg(const ChatInfo& info) = 0;
|
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)));
|
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;
|
lastUpdateListTime = 0;
|
||||||
|
|
||||||
@ -96,6 +100,7 @@ void ChatLobbyDialog::processSettings(bool load)
|
|||||||
void ChatLobbyDialog::setNickName(const QString& nick)
|
void ChatLobbyDialog::setNickName(const QString& nick)
|
||||||
{
|
{
|
||||||
rsMsgs->setNickNameForChatLobby(lobbyId, nick.toUtf8().constData());
|
rsMsgs->setNickNameForChatLobby(lobbyId, nick.toUtf8().constData());
|
||||||
|
ui.chatWidget->setName(nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatLobbyDialog::addIncomingChatMsg(const ChatInfo& info)
|
void ChatLobbyDialog::addIncomingChatMsg(const ChatInfo& info)
|
||||||
|
@ -52,7 +52,7 @@ protected:
|
|||||||
|
|
||||||
void processSettings(bool load);
|
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);
|
virtual void addIncomingChatMsg(const ChatInfo& info);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
@ -147,12 +147,15 @@ ChatWidget::~ChatWidget()
|
|||||||
delete ui;
|
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->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;
|
ChatLobbyId lid;
|
||||||
if (rsMsgs->isLobbyId(peerId, lid)) {
|
if (rsMsgs->isLobbyId(peerId, lid)) {
|
||||||
@ -400,15 +403,13 @@ void ChatWidget::sendChat()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ownId = rsPeers->getOwnId();
|
|
||||||
|
|
||||||
#ifdef CHAT_DEBUG
|
#ifdef CHAT_DEBUG
|
||||||
std::cout << "ChatWidget:sendChat " << std::endl;
|
std::cout << "ChatWidget:sendChat " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (rsMsgs->sendPrivateChat(peerId, msg)) {
|
if (rsMsgs->sendPrivateChat(peerId, msg)) {
|
||||||
QDateTime currentTime = QDateTime::currentDateTime();
|
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();
|
chatWidget->clear();
|
||||||
@ -562,9 +563,8 @@ void ChatWidget::fileHashingFinished(QList<HashedFile> hashedFiles)
|
|||||||
std::wstring msg = textBrowser.toHtml().toStdWString();
|
std::wstring msg = textBrowser.toHtml().toStdWString();
|
||||||
|
|
||||||
if (rsMsgs->sendPrivateChat(peerId, msg)) {
|
if (rsMsgs->sendPrivateChat(peerId, msg)) {
|
||||||
std::string ownId = rsPeers->getOwnId();
|
|
||||||
QDateTime currentTime = QDateTime::currentDateTime();
|
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) {
|
if (peer_id.toStdString() == peerId) {
|
||||||
// the peers status has changed
|
// the peers status has changed
|
||||||
|
|
||||||
|
QString peerName = QString::fromUtf8(rsPeers->getPeerName(peerId).c_str());
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case RS_STATUS_OFFLINE:
|
case RS_STATUS_OFFLINE:
|
||||||
ui->infoframe->setVisible(true);
|
ui->infoframe->setVisible(true);
|
||||||
@ -678,6 +680,11 @@ void ChatWidget::updateStatusString(const QString &statusMask, const QString &st
|
|||||||
QTimer::singleShot(5000, this, SLOT(resetStatusBar())) ;
|
QTimer::singleShot(5000, this, SLOT(resetStatusBar())) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatWidget::setName(const QString &name)
|
||||||
|
{
|
||||||
|
this->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
bool ChatWidget::setStyle()
|
bool ChatWidget::setStyle()
|
||||||
{
|
{
|
||||||
if (style.showDialog(window())) {
|
if (style.showDialog(window())) {
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
explicit ChatWidget(QWidget *parent = 0);
|
explicit ChatWidget(QWidget *parent = 0);
|
||||||
~ChatWidget();
|
~ChatWidget();
|
||||||
|
|
||||||
void init(const std::string &peerId, const QString &peerName);
|
void init(const std::string &peerId, const QString &title);
|
||||||
|
|
||||||
bool hasNewMessages() { return newMessages; }
|
bool hasNewMessages() { return newMessages; }
|
||||||
bool isTyping() { return typing; }
|
bool isTyping() { return typing; }
|
||||||
@ -64,8 +64,9 @@ public:
|
|||||||
void addToolsAction(QAction *action);
|
void addToolsAction(QAction *action);
|
||||||
|
|
||||||
std::string getPeerId() { return peerId; }
|
std::string getPeerId() { return peerId; }
|
||||||
QString getPeerName() { return peerName; }
|
QString getTitle() { return title; }
|
||||||
int getPeerStatus() { return peerStatus; }
|
int getPeerStatus() { return peerStatus; }
|
||||||
|
void setName(const QString &name);
|
||||||
|
|
||||||
bool setStyle();
|
bool setStyle();
|
||||||
const RSStyle *getStyle() { return &style; }
|
const RSStyle *getStyle() { return &style; }
|
||||||
@ -120,7 +121,8 @@ private:
|
|||||||
void processSettings(bool load);
|
void processSettings(bool load);
|
||||||
|
|
||||||
std::string peerId;
|
std::string peerId;
|
||||||
QString peerName;
|
QString title;
|
||||||
|
QString name;
|
||||||
|
|
||||||
QColor currentColor;
|
QColor currentColor;
|
||||||
QFont currentFont;
|
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)));
|
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 */
|
/* Hide or show the avatar frames */
|
||||||
showAvatarFrame(PeerSettings->getShowAvatarFrame(peerId));
|
showAvatarFrame(PeerSettings->getShowAvatarFrame(peerId));
|
||||||
|
@ -45,7 +45,7 @@ protected:
|
|||||||
/** Default destructor */
|
/** Default destructor */
|
||||||
virtual ~PopupChatDialog();
|
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 void showDialog(uint chatflags);
|
||||||
virtual ChatWidget *getChatWidget();
|
virtual ChatWidget *getChatWidget();
|
||||||
virtual bool hasPeerStatus() { return true; }
|
virtual bool hasPeerStatus() { return true; }
|
||||||
|
Loading…
Reference in New Issue
Block a user