From 9fb3770066de1c029b3f2ee8633c32ea6be143d8 Mon Sep 17 00:00:00 2001 From: chrisparker126 Date: Sun, 18 Apr 2010 19:59:41 +0000 Subject: [PATCH] -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 --- retroshare-gui/src/gui/MessengerWindow.cpp | 40 ++++++++-------------- retroshare-gui/src/gui/MessengerWindow.h | 2 +- retroshare-gui/src/gui/MessengerWindow.ui | 9 ----- 3 files changed, 15 insertions(+), 36 deletions(-) diff --git a/retroshare-gui/src/gui/MessengerWindow.cpp b/retroshare-gui/src/gui/MessengerWindow.cpp index 10616fa57..c40936aab 100644 --- a/retroshare-gui/src/gui/MessengerWindow.cpp +++ b/retroshare-gui/src/gui/MessengerWindow.cpp @@ -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 gpgFriends; - std::list::iterator it; + std::list::iterator it; + + std::list statusInfo; + rsStatus->getStatus(statusInfo); if (!rsPeers) { /* not ready yet! */ @@ -451,8 +457,6 @@ void MessengerWindow::insertPeers() } } - std::list 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 statusList; std::list::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; } diff --git a/retroshare-gui/src/gui/MessengerWindow.h b/retroshare-gui/src/gui/MessengerWindow.h index 5dc7262b8..fc3027dfe 100644 --- a/retroshare-gui/src/gui/MessengerWindow.h +++ b/retroshare-gui/src/gui/MessengerWindow.h @@ -57,7 +57,7 @@ public slots: void updatePeersAvatar(const QString& peer_id); void updateAvatar(); void loadmystatusmessage(); - void loadstatus(); + void loadOwnStatus(); LogoBar & getLogoBar() const; diff --git a/retroshare-gui/src/gui/MessengerWindow.ui b/retroshare-gui/src/gui/MessengerWindow.ui index e0b66f056..0b0faa90d 100644 --- a/retroshare-gui/src/gui/MessengerWindow.ui +++ b/retroshare-gui/src/gui/MessengerWindow.ui @@ -152,15 +152,6 @@ p, li { white-space: pre-wrap; } :/images/im-user-away.png:/images/im-user-away.png - - - Apear Offline - - - - :/images/im-user-offline.png:/images/im-user-offline.png - -