little bit worked on rsStatus, and added a tooltip for status message lineedit

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2412 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-02-23 23:53:44 +00:00
parent e4a508ab5b
commit e7a78af546
3 changed files with 58 additions and 7 deletions

View File

@ -112,6 +112,7 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
connect( ui.actionHide_Offline_Friends, SIGNAL(triggered()), this, SLOT(insertPeers())); connect( ui.actionHide_Offline_Friends, SIGNAL(triggered()), this, SLOT(insertPeers()));
connect(ui.messagelineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(savestatusmessage())); connect(ui.messagelineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(savestatusmessage()));
connect(ui.statuscomboBox, SIGNAL(clicked()), this, SLOT(savestatus()));
/* to hide the header */ /* to hide the header */
ui.messengertreeWidget->header()->hide(); ui.messengertreeWidget->header()->hide();
@ -146,6 +147,8 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
updateAvatar(); updateAvatar();
loadmystatusmessage(); loadmystatusmessage();
loadstatus();
displayMenu(); displayMenu();
updateMessengerDisplay(); updateMessengerDisplay();
@ -928,20 +931,22 @@ void MessengerWindow::displayMenu()
void MessengerWindow::loadstatus() void MessengerWindow::loadstatus()
{ {
/* load up configuration from rsPeers */ /* load up configuration from rsPeers */
/*RsPeerDetails detail; RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail)) std::string ownId = rsPeers->getOwnId();
if (!rsPeers->getPeerDetails(ownId, detail))
{ {
return; return;
} }
StatusInfo si; StatusInfo si;
if (!rsStatus->getStatus(detail.id, si)) if (!rsStatus->getStatus(ownId, si))
{ {
return; return;
}*/ }
/* set status mode */ /* set status mode */
/*int statusIndex = 0; int statusIndex = 0;
switch(si.status) switch(si.status)
{ {
case RS_STATUS_OFFLINE: case RS_STATUS_OFFLINE:
@ -958,5 +963,47 @@ void MessengerWindow::loadstatus()
statusIndex = 0; statusIndex = 0;
break; break;
} }
ui.statuscomboBox->setCurrentIndex(statusIndex);*/
ui.statuscomboBox->setCurrentIndex(statusIndex);
}
/** Save own status Online,Away,Busy **/
void MessengerWindow::savestatus()
{
RsPeerDetails detail;
std::string ownId = rsPeers->getOwnId();
if (!rsPeers->getPeerDetails(ownId, detail))
{
return;
}
StatusInfo si;
int statusIndex = ui.statuscomboBox->currentIndex();
/* Check if status has changed */
int status = 0;
switch(statusIndex)
{
case 3:
status = RS_STATUS_OFFLINE;
break;
case 2:
status = RS_STATUS_AWAY;
break;
case 1:
status = RS_STATUS_BUSY;
break;
default:
case 0:
status = RS_STATUS_ONLINE;
break;
}
si.id = ownId;
si.status = status;
rsStatus->setStatus(si);
} }

View File

@ -57,6 +57,7 @@ public slots:
void updatePeersAvatar(const QString& peer_id); void updatePeersAvatar(const QString& peer_id);
void updateAvatar(); void updateAvatar();
void loadmystatusmessage(); void loadmystatusmessage();
void loadstatus();
LogoBar & getLogoBar() const; LogoBar & getLogoBar() const;
@ -97,7 +98,7 @@ private slots:
void savestatusmessage(); void savestatusmessage();
void loadstatus(); void savestatus();
void on_actionSort_Peers_Descending_Order_activated(); void on_actionSort_Peers_Descending_Order_activated();
void on_actionSort_Peers_Ascending_Order_activated(); void on_actionSort_Peers_Ascending_Order_activated();

View File

@ -165,6 +165,9 @@ p, li { white-space: pre-wrap; }
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLineEdit" name="messagelineEdit"> <widget class="QLineEdit" name="messagelineEdit">
<property name="toolTip">
<string>Change your Personal Status here...</string>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">border: 1px solid #CCCCCC;</string> <string notr="true">border: 1px solid #CCCCCC;</string>
</property> </property>