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

View File

@ -57,7 +57,7 @@ public slots:
void updatePeersAvatar(const QString& peer_id);
void updateAvatar();
void loadmystatusmessage();
void loadstatus();
void loadOwnStatus();
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>
</property>
</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>
</item>
<item row="2" column="0">