From d8e4bc86b8300cf1b729947d4e349d7b7cb85612 Mon Sep 17 00:00:00 2001 From: defnax Date: Wed, 18 Aug 2010 12:02:36 +0000 Subject: [PATCH] Added to switch background border picture for Friend's Avatar Label . Set window title little bit more simple. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3376 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/chat/PopupChatDialog.cpp | 46 ++++++++++++++++++- retroshare-gui/src/gui/chat/PopupChatDialog.h | 2 + 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index 388396f24..eb9798a5e 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include "gui/settings/rsharesettings.h" @@ -61,6 +62,7 @@ * #define CHAT_DEBUG 1 *****/ + static std::map chatDialogs; /** Default constructor */ @@ -116,7 +118,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name, //ui.textBrowser->setOpenExternalLinks ( false ); //ui.textBrowser->setOpenLinks ( false ); - QString title = QString::fromStdString(name) + " :" + tr(" RetroShare - Encrypted Chat") ; + QString title = tr("RetroShare - ") + QString::fromStdString(name) ; setWindowTitle(title); setWindowIcon(QIcon(QString(":/images/rstray3.png"))); @@ -156,9 +158,11 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name, updateAvatar() ; updatePeerAvatar(id) ; + updateStatus(); // load settings processSettings(true); + } /** Destructor. */ @@ -356,6 +360,7 @@ void PopupChatDialog::updateStatusTyping() { if(time(NULL) - last_status_send_time > 5) // limit 'peer is typing' packets to at most every 10 sec { + rsMsgs->sendStatusString(dialogId, rsiface->getConfig().ownName + " is typing..."); last_status_send_time = time(NULL) ; } @@ -1153,3 +1158,42 @@ void PopupChatDialog::setCurrentFileName(const QString &fileName) setWindowModified(false); } + +void PopupChatDialog::updateStatus() +{ + std::list statusInfo; + rsStatus->getStatus(statusInfo); + + uint32_t status = 0; + std::list::iterator it = statusInfo.begin(); + + for(; it != statusInfo.end() ; it++){ + if (it->id == dialogId) { + status = it->status; + break; + } + } + + switch (status) { + case 0: + //here show offline state + ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_offline.png); }"); + break; + + case RS_STATUS_INACTIVE: + ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_idle.png); }"); + break; + + case RS_STATUS_ONLINE: + ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_online.png); }"); + break; + + case RS_STATUS_AWAY: + ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_idle.png); }"); + break; + + case RS_STATUS_BUSY: + ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_busy.png); }"); + break; + } +} diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.h b/retroshare-gui/src/gui/chat/PopupChatDialog.h index 53f86706d..34095a6ee 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.h +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.h @@ -107,6 +107,8 @@ private slots: bool fileSaveAs(); void setCurrentFileName(const QString &fileName); + void updateStatus(); + private: