change the Avatar border image when status has changed in Friends Dialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3870 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-11-25 16:45:44 +00:00
parent 461ae260df
commit 546fa15364
2 changed files with 37 additions and 0 deletions

View File

@ -43,6 +43,7 @@
#include <retroshare/rsmsgs.h>
#include <retroshare/rsnotify.h>
#include "settings/rsharesettings.h"
#include "notifyqt.h"
#include "chat/PopupChatDialog.h"
#include "msgs/MessageComposer.h"
@ -129,6 +130,8 @@ PeersDialog::PeersDialog(QWidget *parent)
connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) );
connect( ui.peertreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend(QTreeWidgetItem *)));
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateOwnStatus(QString,int)));
connect( ui.avatartoolButton, SIGNAL(clicked()), SLOT(getAvatar()));
connect( ui.mypersonalstatuslabel, SIGNAL(clicked()), SLOT(statusmessage()));
@ -2152,3 +2155,36 @@ void PeersDialog::newsFeedChanged(int count)
ui.peertabWidget->tabBar()->setTabIcon(newsFeedTabIndex, QIcon(IMAGE_NEWSFEED));
}
}
void PeersDialog::updateOwnStatus(const QString &peer_id, int status)
{
// add self nick + own status
if (peer_id.toStdString() == rsPeers->getOwnId())
{
// my status has changed
switch (status) {
case RS_STATUS_OFFLINE:
ui.avatartoolButton->setStyleSheet("QToolButton#avatartoolButton{border-image:url(:/images/mystatus_bg_offline.png); }");
break;
case RS_STATUS_INACTIVE:
ui.avatartoolButton->setStyleSheet("QToolButton#avatartoolButton{border-image:url(:/images/mystatus_bg_idle.png); }");
break;
case RS_STATUS_ONLINE:
ui.avatartoolButton->setStyleSheet("QToolButton#avatartoolButton{border-image:url(:/images/mystatus_bg_online.png); }");
break;
case RS_STATUS_AWAY:
ui.avatartoolButton->setStyleSheet("QToolButton#avatartoolButton{border-image:url(:/images/mystatus_bg_idle.png); }");
break;
case RS_STATUS_BUSY:
ui.avatartoolButton->setStyleSheet("QToolButton#avatartoolButton{border-image:url(:/images/mystatus_bg_busy.png); }");
break;
}
return;
}
}

View File

@ -145,6 +145,7 @@ private slots:
void changeAvatarClicked();
void getAvatar();
void updateOwnStatus(const QString &peer_id, int status);
void on_actionAdd_Group_activated();
void on_actionCreate_New_Forum_activated();