Show current state after the name and location in MessengerWindow.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3468 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-09-11 18:08:38 +00:00
parent 1c2db7eb9b
commit 1fc5347fd4
3 changed files with 32 additions and 16 deletions

View File

@ -181,6 +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)));
#endif // MINIMAL_RSGUI
timer = new QTimer(this);
@ -221,11 +222,21 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
// add self nick
RsPeerDetails pd;
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),pd)) {
ui.statusButton->setText(QString::fromStdString(pd.name) + tr(" - ") + QString::fromStdString(pd.location));
std::string ownId = rsPeers->getOwnId();
if (rsPeers->getPeerDetails(ownId, pd)) {
/* calculate only once */
m_nickName = QString::fromStdString(pd.name) + tr(" - ") + QString::fromStdString(pd.location);
#ifdef MINIMAL_RSGUI
ui.statusButton->setText(m_nickName);
#endif
}
#ifndef MINIMAL_RSGUI
/* Show nick and current state */
StatusInfo statusInfo;
rsStatus->getOwnStatus(statusInfo);
peerStatusChanged(QString::fromStdString(ownId), statusInfo.status);
MainWindow *pMainWindow = MainWindow::getInstance();
if (pMainWindow) {
QMenu *pStatusMenu = new QMenu();
@ -1195,6 +1206,16 @@ void MessengerWindow::savestatusmessage()
{
rsMsgs->setCustomStateString(ui.messagelineEdit->text().toStdString());
}
void MessengerWindow::peerStatusChanged(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()) + ")");
}
}
#endif // MINIMAL_RSGUI
void MessengerWindow::on_actionSort_Peers_Descending_Order_activated()

View File

@ -91,6 +91,7 @@ private slots:
void getAvatar();
void changeAvatarClicked();
void peerStatusChanged(const QString &peer_id, int status);
void savestatusmessage();
#endif // MINIMAL_RSGUI
@ -128,6 +129,7 @@ private:
LogoBar * _rsLogoBarmessenger;
QFont itemFont;
QString m_nickName;
/** Qt Designer generated object */
Ui::MessengerWindow ui;

View File

@ -86,8 +86,14 @@ stop:0 #05538B, stop:1 #E4F1E5);
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" colspan="2">
<item row="0" column="0" colspan="3">
<widget class="QPushButton" name="statusButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
@ -130,19 +136,6 @@ stop:0 #05538B, stop:1 #E4F1E5);
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>50</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="3">
<widget class="QLineEdit" name="messagelineEdit">
<property name="toolTip">