-sendstatus is now on qtimer - think of replacing with rs notify call back

- hack to load file status from previous rs session
- also removed 'offline' status

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2728 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2010-04-18 19:59:41 +00:00
parent e6848bb615
commit 9fb3770066
3 changed files with 15 additions and 36 deletions

View File

@ -113,11 +113,12 @@ 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(currentIndexChanged(int)), this, SLOT(savestatus()));
QTimer *timer = new QTimer(this); QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(sendStatus())); timer->connect(timer, SIGNAL(timeout()), this, SLOT(savestatus()));
timer->start(5000); /* five seconds */ timer->start(1000); /* one second */
/* to hide the header */ /* to hide the header */
ui.messengertreeWidget->header()->hide(); ui.messengertreeWidget->header()->hide();
@ -148,12 +149,14 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
itemFont = QFont("ARIAL", 10); itemFont = QFont("ARIAL", 10);
itemFont.setBold(true); itemFont.setBold(true);
loadOwnStatus(); // hack; placed in constructor to preempt sendstatus, so status loaded from file
insertPeers(); insertPeers();
updateAvatar(); updateAvatar();
loadmystatusmessage(); loadmystatusmessage();
loadstatus();
displayMenu(); displayMenu();
updateMessengerDisplay(); updateMessengerDisplay();
@ -272,7 +275,10 @@ void MessengerWindow::updateMessengerDisplay()
void MessengerWindow::insertPeers() void MessengerWindow::insertPeers()
{ {
std::list<std::string> gpgFriends; std::list<std::string> gpgFriends;
std::list<std::string>::iterator it; std::list<std::string>::iterator it;
std::list<StatusInfo> statusInfo;
rsStatus->getStatus(statusInfo);
if (!rsPeers) { if (!rsPeers) {
/* not ready yet! */ /* not ready yet! */
@ -451,8 +457,6 @@ void MessengerWindow::insertPeers()
} }
} }
std::list<StatusInfo> statusInfo;
rsStatus->getStatus(statusInfo);
RsPeerDetails ssl_details; RsPeerDetails ssl_details;
int i = 0; int i = 0;
@ -922,20 +926,11 @@ void MessengerWindow::displayMenu()
} }
/** Load own status Online,Away,Busy **/ /** Load own status Online,Away,Busy **/
void MessengerWindow::loadstatus() void MessengerWindow::loadOwnStatus()
{ {
//rsiface->lockData(); /* Lock Interface */
/* load up configuration from rsPeers */
RsPeerDetails detail;
std::string ownId = rsPeers->getOwnId(); std::string ownId = rsPeers->getOwnId();
if (!rsPeers->getPeerDetails(ownId, detail))
{
return;
}
StatusInfo si; StatusInfo si;
std::list<StatusInfo> statusList; std::list<StatusInfo> statusList;
std::list<StatusInfo>::iterator it; std::list<StatusInfo>::iterator it;
@ -955,9 +950,6 @@ void MessengerWindow::loadstatus()
int statusIndex = 0; int statusIndex = 0;
switch(si.status) switch(si.status)
{ {
case RS_STATUS_OFFLINE:
statusIndex = 3;
break;
case RS_STATUS_AWAY: case RS_STATUS_AWAY:
statusIndex = 2; statusIndex = 2;
break; break;
@ -972,7 +964,6 @@ void MessengerWindow::loadstatus()
ui.statuscomboBox->setCurrentIndex(statusIndex); ui.statuscomboBox->setCurrentIndex(statusIndex);
//rsiface->unlockData(); /* UnLock Interface */
} }
/** Save own status Online,Away,Busy **/ /** Save own status Online,Away,Busy **/
@ -996,9 +987,6 @@ void MessengerWindow::savestatus()
int status = 0; int status = 0;
switch(statusIndex) switch(statusIndex)
{ {
case 3:
status = RS_STATUS_OFFLINE;
break;
case 2: case 2:
status = RS_STATUS_AWAY; status = RS_STATUS_AWAY;
break; break;
@ -1017,5 +1005,5 @@ void MessengerWindow::savestatus()
rsStatus->sendStatus(si); rsStatus->sendStatus(si);
//rsiface->unlockData(); /* UnLock Interface */ //rsiface->unlockData(); /* UnLock Interface */
return;
} }

View File

@ -57,7 +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(); void loadOwnStatus();
LogoBar & getLogoBar() const; LogoBar & getLogoBar() const;

View File

@ -152,15 +152,6 @@ p, li { white-space: pre-wrap; }
<normaloff>:/images/im-user-away.png</normaloff>:/images/im-user-away.png</iconset> <normaloff>:/images/im-user-away.png</normaloff>:/images/im-user-away.png</iconset>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Apear Offline</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/im-user-offline.png</normaloff>:/images/im-user-offline.png</iconset>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">