p3ConnectMgr::connectResult

- added "mStatusChanged = true" on disconnect of a peer - the statusChange was not notified in time

MessengerWindow
- removed unused method updatePeersAvatar

Changes in status service:
- removed unused method statusAvailable
- new notifier for status change
- enabled the tick for receiving items
  - always up to date status map
  - no huge memory usage, if no list is visible who call getStatus and processed the received items
  - send notify on status change
- renamed getStatus to getStatusList and created a new method getStatus to get status of one peer
- fixed: send status directly after the connect of a peer

Now the frame around the avatar in private chat changes when the peer change the state.


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3380 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-08-20 18:45:44 +00:00
parent 331ed93720
commit 340982b996
14 changed files with 198 additions and 138 deletions

View file

@ -45,7 +45,7 @@
#include <retroshare/rsstatus.h>
#include <retroshare/rsiface.h>
#include "gui/settings/rsharesettings.h"
#include "gui/notifyqt.h"
#include "gui/feeds/AttachFileItem.h"
#include "gui/msgs/MessageComposer.h"
@ -108,6 +108,8 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
connect(ui.textBrowser, SIGNAL(anchorClicked(const QUrl &)), SLOT(anchorClicked(const QUrl &)));
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int)));
std::cerr << "Connecting custom context menu" << std::endl;
ui.chattextEdit->setContextMenuPolicy(Qt::CustomContextMenu) ;
connect(ui.chattextEdit,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenu(QPoint)));
@ -158,11 +160,14 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
updateAvatar() ;
updatePeerAvatar(id) ;
updateStatus();
// load settings
// load settings
processSettings(true);
// initialize first status
StatusInfo statusInfo;
rsStatus->getStatus(dialogId, statusInfo);
updateStatus(QString::fromStdString(dialogId), statusInfo.status);
}
/** Destructor. */
@ -1159,24 +1164,15 @@ void PopupChatDialog::setCurrentFileName(const QString &fileName)
setWindowModified(false);
}
void PopupChatDialog::updateStatus()
void PopupChatDialog::updateStatus(const QString &peer_id, int status)
{
std::list<StatusInfo> statusInfo;
rsStatus->getStatus(statusInfo);
uint32_t status = 0;
std::list<StatusInfo>::iterator it = statusInfo.begin();
for(; it != statusInfo.end() ; it++){
if (it->id == dialogId) {
status = it->status;
break;
}
if (peer_id != QString::fromStdString(dialogId)) {
// it's not me
return;
}
switch (status) {
case 0:
//here show offline state
case RS_STATUS_OFFLINE:
ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_offline.png); }");
break;