mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 16:09:37 -05:00
Added to change the Avatar Border Image when own status has changed.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3469 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
1fc5347fd4
commit
c854b9feb1
@ -181,7 +181,7 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
|
||||
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateMessengerDisplay()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(ownAvatarChanged()), this, SLOT(updateAvatar()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(ownStatusMessageChanged()), this, SLOT(loadmystatusmessage()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(peerStatusChanged(QString,int)));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateOwnStatus(QString,int)));
|
||||
#endif // MINIMAL_RSGUI
|
||||
|
||||
timer = new QTimer(this);
|
||||
@ -235,7 +235,7 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
|
||||
/* Show nick and current state */
|
||||
StatusInfo statusInfo;
|
||||
rsStatus->getOwnStatus(statusInfo);
|
||||
peerStatusChanged(QString::fromStdString(ownId), statusInfo.status);
|
||||
updateOwnStatus(QString::fromStdString(ownId), statusInfo.status);
|
||||
|
||||
MainWindow *pMainWindow = MainWindow::getInstance();
|
||||
if (pMainWindow) {
|
||||
@ -1207,12 +1207,41 @@ void MessengerWindow::savestatusmessage()
|
||||
rsMsgs->setCustomStateString(ui.messagelineEdit->text().toStdString());
|
||||
}
|
||||
|
||||
void MessengerWindow::peerStatusChanged(const QString &peer_id, int status)
|
||||
void MessengerWindow::updateOwnStatus(const QString &peer_id, int status)
|
||||
{
|
||||
if (peer_id.toStdString() == rsPeers->getOwnId()) {
|
||||
std::string statusString;
|
||||
rsStatus->getStatusString(status, statusString);
|
||||
ui.statusButton->setText(m_nickName + " (" + tr(statusString.c_str()) + ")");
|
||||
// add self nick + own status
|
||||
if (peer_id.toStdString() == rsPeers->getOwnId())
|
||||
{
|
||||
// my status has changed
|
||||
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
ui.avatarButton->setStyleSheet("QToolButton#avatarButton{border-image:url(:/images/mystatus_bg_offline.png); }");
|
||||
ui.statusButton->setText(m_nickName + tr(" ") + tr("(Offline)"));
|
||||
break;
|
||||
|
||||
case RS_STATUS_INACTIVE:
|
||||
ui.avatarButton->setStyleSheet("QToolButton#avatarButton{border-image:url(:/images/mystatus_bg_idle.png); }");
|
||||
ui.statusButton->setText(m_nickName + tr(" ") + tr("(Idle)"));
|
||||
break;
|
||||
|
||||
case RS_STATUS_ONLINE:
|
||||
ui.avatarButton->setStyleSheet("QToolButton#avatarButton{border-image:url(:/images/mystatus_bg_online.png); }");
|
||||
ui.statusButton->setText(m_nickName + tr(" ") + tr("(Online)"));
|
||||
break;
|
||||
|
||||
case RS_STATUS_AWAY:
|
||||
ui.avatarButton->setStyleSheet("QToolButton#avatarButton{border-image:url(:/images/mystatus_bg_idle.png); }");
|
||||
ui.statusButton->setText(m_nickName + tr(" ") + tr("(Away)"));
|
||||
break;
|
||||
|
||||
case RS_STATUS_BUSY:
|
||||
ui.avatarButton->setStyleSheet("QToolButton#avatarButton{border-image:url(:/images/mystatus_bg_busy.png); }");
|
||||
ui.statusButton->setText(m_nickName + tr(" ") + tr("(Busy)"));
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ private slots:
|
||||
void getAvatar();
|
||||
|
||||
void changeAvatarClicked();
|
||||
void peerStatusChanged(const QString &peer_id, int status);
|
||||
void updateOwnStatus(const QString &peer_id, int status);
|
||||
|
||||
void savestatusmessage();
|
||||
#endif // MINIMAL_RSGUI
|
||||
|
Loading…
Reference in New Issue
Block a user