mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
RsAutoUpdatePage
- Changed the timer of RsAutoUpdatePage to a single-shot timer. The update can take longer than the given timer interval. Changed status service: - send status when the peer connects (new monitor) - send status to all online peers only when user changed it (not in every timer tick) MessengerWindow: - remove load and save of custom state string in settings p3ChatService::sendCustomState - send empty custom state string too git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3307 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f7282edf33
commit
e3e4c97369
@ -47,6 +47,13 @@ const uint32_t RS_STATUS_INACTIVE = 0x0004;
|
||||
*/
|
||||
class StatusInfo
|
||||
{
|
||||
public:
|
||||
StatusInfo()
|
||||
{
|
||||
status = 0;
|
||||
time_stamp = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
std::string id;
|
||||
uint32_t status;
|
||||
@ -62,6 +69,12 @@ class RsStatus
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* This retrieves the own status info
|
||||
* @param statusInfo is populated with own status
|
||||
*/
|
||||
virtual bool getOwnStatus(StatusInfo& statusInfo) = 0;
|
||||
|
||||
/**
|
||||
* This retrieves the status info on the client's peers
|
||||
* @param statusInfo is populated with client's peer's status
|
||||
@ -70,10 +83,11 @@ class RsStatus
|
||||
|
||||
/**
|
||||
* send the client's status to his/her peers
|
||||
* @param statusInfo the status of the peers
|
||||
* @param id the peer to send the status (empty, send to all)
|
||||
* @param status the status of the peers
|
||||
* @return will return false if status info does not belong to client
|
||||
*/
|
||||
virtual bool sendStatus(StatusInfo& statusInfo) = 0;
|
||||
virtual bool sendStatus(std::string id, uint32_t status) = 0;
|
||||
|
||||
/**
|
||||
* checks to see if any status items have been received
|
||||
|
@ -37,15 +37,19 @@ p3Status::~p3Status(){
|
||||
return;
|
||||
}
|
||||
|
||||
bool p3Status::getOwnStatus(StatusInfo& statusInfo){
|
||||
|
||||
return mStatusSrv->getOwnStatus(statusInfo);
|
||||
}
|
||||
|
||||
bool p3Status::getStatus(std::list<StatusInfo >& statusInfo){
|
||||
|
||||
return mStatusSrv->getStatus(statusInfo);
|
||||
}
|
||||
|
||||
bool p3Status::sendStatus(std::string id, uint32_t status){
|
||||
|
||||
bool p3Status::sendStatus(StatusInfo& statusInfo){
|
||||
|
||||
return mStatusSrv->sendStatus(statusInfo);
|
||||
return mStatusSrv->sendStatus(id, status);
|
||||
}
|
||||
|
||||
bool p3Status::statusAvailable(){
|
||||
|
@ -43,8 +43,9 @@ public:
|
||||
virtual ~p3Status();
|
||||
|
||||
|
||||
virtual bool getOwnStatus(StatusInfo& statusInfo);
|
||||
virtual bool getStatus(std::list<StatusInfo>& statusInfo);
|
||||
virtual bool sendStatus(StatusInfo& statusInfo);
|
||||
virtual bool sendStatus(std::string id, uint32_t status);
|
||||
virtual bool statusAvailable();
|
||||
|
||||
virtual void getStatusString(uint32_t status, std::string& statusString);
|
||||
|
@ -2243,6 +2243,7 @@ int RsServer::StartupRetroShare()
|
||||
mConnMgr->addMonitor(mCacheStrapper);
|
||||
mConnMgr->addMonitor(ad);
|
||||
mConnMgr->addMonitor(msgSrv);
|
||||
mConnMgr->addMonitor(mStatusSrv);
|
||||
|
||||
/* must also add the controller as a Monitor...
|
||||
* a little hack to get it to work.
|
||||
|
@ -654,16 +654,10 @@ void p3ChatService::sendCustomState(const std::string& peer_id){
|
||||
std::cerr << "p3chatservice: sending requested status string for peer " << peer_id << std::endl ;
|
||||
#endif
|
||||
|
||||
if(_custom_status_string != ""){
|
||||
RsChatStatusItem *cs = makeOwnCustomStateStringItem();
|
||||
cs->PeerId(peer_id);
|
||||
RsChatStatusItem *cs = makeOwnCustomStateStringItem();
|
||||
cs->PeerId(peer_id);
|
||||
|
||||
sendItem(cs);
|
||||
}else{
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "doing nothing" << std::endl;
|
||||
#endif
|
||||
}
|
||||
sendItem(cs);
|
||||
}
|
||||
|
||||
bool p3ChatService::loadList(std::list<RsItem*> load)
|
||||
|
@ -53,6 +53,23 @@ p3StatusService::~p3StatusService()
|
||||
{
|
||||
}
|
||||
|
||||
bool p3StatusService::getOwnStatus(StatusInfo& statusInfo)
|
||||
{
|
||||
std::map<std::string, StatusInfo>::iterator it;
|
||||
std::string ownId = mConnMgr->getOwnId();
|
||||
|
||||
RsStackMutex stack(mStatusMtx);
|
||||
it = mStatusInfoMap.find(ownId);
|
||||
|
||||
if (it == mStatusInfoMap.end()){
|
||||
std::cerr << "p3StatusService::saveList() :" << "Did not find your status" << ownId << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
statusInfo = it->second;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3StatusService::getStatus(std::list<StatusInfo>& statusInfo)
|
||||
{
|
||||
@ -128,15 +145,17 @@ bool p3StatusService::getStatus(std::list<StatusInfo>& statusInfo)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3StatusService::sendStatus(StatusInfo& statusInfo)
|
||||
/* id = "", status is sent to all online peers */
|
||||
bool p3StatusService::sendStatus(const std::string &id, uint32_t status)
|
||||
{
|
||||
StatusInfo statusInfo;
|
||||
std::list<std::string> onlineList;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mStatusMtx);
|
||||
|
||||
if(statusInfo.id != mConnMgr->getOwnId())
|
||||
return false;
|
||||
statusInfo.id = mConnMgr->getOwnId();
|
||||
statusInfo.status = status;
|
||||
|
||||
// don't save inactive status
|
||||
if(statusInfo.status != RS_STATUS_INACTIVE){
|
||||
@ -147,15 +166,18 @@ bool p3StatusService::sendStatus(StatusInfo& statusInfo)
|
||||
std::pair<std::string, StatusInfo> pr(statusInfo.id, statusInfo);
|
||||
mStatusInfoMap.insert(pr);
|
||||
IndicateConfigChanged();
|
||||
}else
|
||||
if(mStatusInfoMap[statusInfo.id].status != statusInfo.status){
|
||||
} else if(mStatusInfoMap[statusInfo.id].status != statusInfo.status){
|
||||
|
||||
IndicateConfigChanged();
|
||||
mStatusInfoMap[statusInfo.id] = statusInfo;
|
||||
}
|
||||
}
|
||||
|
||||
mConnMgr->getOnlineList(onlineList);
|
||||
if (id.empty()) {
|
||||
mConnMgr->getOnlineList(onlineList);
|
||||
} else {
|
||||
onlineList.push_back(id);
|
||||
}
|
||||
}
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
@ -174,11 +196,9 @@ bool p3StatusService::sendStatus(StatusInfo& statusInfo)
|
||||
sendItem(statusItem);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool p3StatusService::statusAvailable(){
|
||||
return receivedItems();
|
||||
}
|
||||
@ -301,5 +321,18 @@ int p3StatusService::status(){
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*************** pqiMonitor callback ***********************/
|
||||
|
||||
|
||||
void p3StatusService::statusChange(const std::list<pqipeer> &plist)
|
||||
{
|
||||
StatusInfo statusInfo;
|
||||
std::list<pqipeer>::const_iterator it;
|
||||
for (it = plist.begin(); it != plist.end(); it++) {
|
||||
if ((it->state & RS_PEER_S_FRIEND) && (it->state & RS_PEER_CONNECTED)) {
|
||||
/* send current status */
|
||||
if (statusInfo.id.empty() == false || getOwnStatus(statusInfo)) {
|
||||
sendStatus(it->id, statusInfo.status);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
* custom string.
|
||||
* @see rsiface/rsstatus.h for status constants
|
||||
*/
|
||||
class p3StatusService: public p3Service, public p3Config
|
||||
class p3StatusService: public p3Service, public p3Config, public pqiMonitor
|
||||
{
|
||||
public:
|
||||
|
||||
@ -52,13 +52,18 @@ virtual ~p3StatusService();
|
||||
virtual int tick();
|
||||
virtual int status();
|
||||
|
||||
/*************** pqiMonitor callback ***********************/
|
||||
virtual void statusChange(const std::list<pqipeer> &plist);
|
||||
|
||||
/********* RsStatus ***********/
|
||||
|
||||
/**
|
||||
* Status is set to offline as default if no info received from relevant peer
|
||||
*/
|
||||
virtual bool getOwnStatus(StatusInfo& statusInfo);
|
||||
virtual bool getStatus(std::list<StatusInfo>& statusInfo);
|
||||
virtual bool sendStatus(StatusInfo& statusInfo);
|
||||
/* id = "", status is sent to all online peers */
|
||||
virtual bool sendStatus(const std::string &id, uint32_t status);
|
||||
virtual bool statusAvailable();
|
||||
|
||||
/******************************/
|
||||
|
@ -250,8 +250,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
/** StatusBar section ********/
|
||||
/* initialize combobox in status bar */
|
||||
statusComboBox = new QComboBox(statusBar());
|
||||
initializeStatusObject(statusComboBox);
|
||||
connect(statusComboBox, SIGNAL(activated(int)), this, SLOT(statusChangedComboBox(int)));
|
||||
initializeStatusObject(statusComboBox, true);
|
||||
|
||||
QWidget *widget = new QWidget();
|
||||
QHBoxLayout *hbox = new QHBoxLayout();
|
||||
@ -295,7 +294,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
/* Creates a tray icon with a context menu and adds it to the system's * notification area. */
|
||||
createTrayIcon();
|
||||
|
||||
loadOwnStatus(); // hack; placed in constructor to preempt sendstatus, so status loaded from file
|
||||
loadOwnStatus();
|
||||
|
||||
/* Set focus to the current page */
|
||||
ui.stackPages->currentWidget()->setFocus();
|
||||
@ -356,8 +355,7 @@ void MainWindow::createTrayIcon()
|
||||
trayMenu->addAction(QIcon(IMAGE_RETROSHARE), tr("Show/Hide"), this, SLOT(toggleVisibilitycontextmenu()));
|
||||
|
||||
QMenu *pStatusMenu = trayMenu->addMenu(tr("Status"));
|
||||
initializeStatusObject(pStatusMenu);
|
||||
connect(pStatusMenu, SIGNAL(triggered (QAction*)), this, SLOT(statusChanged(QAction*)));
|
||||
initializeStatusObject(pStatusMenu, true);
|
||||
|
||||
trayMenu->addSeparator();
|
||||
trayMenu->addAction(_messengerwindowAct);
|
||||
@ -830,27 +828,6 @@ void MainWindow::setStyle()
|
||||
|
||||
}
|
||||
|
||||
/* get own status */
|
||||
static int getOwnStatus()
|
||||
{
|
||||
std::string ownId = rsPeers->getOwnId();
|
||||
|
||||
StatusInfo si;
|
||||
std::list<StatusInfo> statusList;
|
||||
std::list<StatusInfo>::iterator it;
|
||||
|
||||
if (!rsStatus->getStatus(statusList)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (it = statusList.begin(); it != statusList.end(); it++){
|
||||
if (it->id == ownId)
|
||||
return it->status;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* set status object to status value */
|
||||
static void setStatusObject(QObject *pObject, int nStatus)
|
||||
{
|
||||
@ -888,10 +865,12 @@ void MainWindow::loadOwnStatus()
|
||||
{
|
||||
m_bStatusLoadDone = true;
|
||||
|
||||
int nStatus = getOwnStatus();
|
||||
|
||||
for (std::set <QObject*>::iterator it = m_apStatusObjects.begin(); it != m_apStatusObjects.end(); it++) {
|
||||
setStatusObject(*it, nStatus);
|
||||
StatusInfo statusInfo;
|
||||
if (rsStatus->getOwnStatus(statusInfo)) {
|
||||
/* send status to all added objects */
|
||||
for (std::set <QObject*>::iterator it = m_apStatusObjects.begin(); it != m_apStatusObjects.end(); it++) {
|
||||
setStatusObject(*it, statusInfo.status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -899,8 +878,7 @@ void MainWindow::checkAndSetIdle(int idleTime)
|
||||
{
|
||||
if ((idleTime >= (int) maxTimeBeforeIdle) && !isIdle) {
|
||||
setIdle(true);
|
||||
}else
|
||||
if((idleTime < (int) maxTimeBeforeIdle) && isIdle) {
|
||||
} else if ((idleTime < (int) maxTimeBeforeIdle) && isIdle) {
|
||||
setIdle(false);
|
||||
}
|
||||
|
||||
@ -910,13 +888,18 @@ void MainWindow::checkAndSetIdle(int idleTime)
|
||||
void MainWindow::setIdle(bool idle)
|
||||
{
|
||||
isIdle = idle;
|
||||
setStatus(NULL, getOwnStatus());
|
||||
|
||||
StatusInfo statusInfo;
|
||||
if (rsStatus->getOwnStatus(statusInfo)) {
|
||||
setStatus(NULL, statusInfo.status);
|
||||
}
|
||||
}
|
||||
|
||||
/* add and initialize status object */
|
||||
void MainWindow::initializeStatusObject(QObject *pObject)
|
||||
void MainWindow::initializeStatusObject(QObject *pObject, bool bConnect)
|
||||
{
|
||||
if (m_apStatusObjects.find(pObject) != m_apStatusObjects.end()) {
|
||||
/* already added */
|
||||
return;
|
||||
}
|
||||
|
||||
@ -944,6 +927,10 @@ void MainWindow::initializeStatusObject(QObject *pObject)
|
||||
pAction->setCheckable(true);
|
||||
pMenu->addAction(pAction);
|
||||
pGroup->addAction(pAction);
|
||||
|
||||
if (bConnect) {
|
||||
connect(pMenu, SIGNAL(triggered (QAction*)), this, SLOT(statusChangedMenu(QAction*)));
|
||||
}
|
||||
} else {
|
||||
/* initialize combobox */
|
||||
QComboBox *pComboBox = dynamic_cast<QComboBox*>(pObject);
|
||||
@ -951,15 +938,19 @@ void MainWindow::initializeStatusObject(QObject *pObject)
|
||||
pComboBox->addItem(QIcon(":/images/im-user.png"), tr("Online"), RS_STATUS_ONLINE);
|
||||
pComboBox->addItem(QIcon(":/images/im-user-busy.png"), tr("Busy"), RS_STATUS_BUSY);
|
||||
pComboBox->addItem(QIcon(":/images/im-user-away.png"), tr("Away"), RS_STATUS_AWAY);
|
||||
|
||||
if (bConnect) {
|
||||
connect(pComboBox, SIGNAL(activated(int)), this, SLOT(statusChangedComboBox(int)));
|
||||
}
|
||||
}
|
||||
/* add more objects here */
|
||||
}
|
||||
|
||||
if (m_bStatusLoadDone) {
|
||||
/* loadOwnStatus done, set own status directly */
|
||||
int nStatus = getOwnStatus();
|
||||
if (nStatus != -1) {
|
||||
setStatusObject(pObject, nStatus);
|
||||
StatusInfo statusInfo;
|
||||
if (rsStatus->getOwnStatus(statusInfo)) {
|
||||
setStatusObject(pObject, statusInfo.status);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -968,29 +959,20 @@ void MainWindow::initializeStatusObject(QObject *pObject)
|
||||
void MainWindow::removeStatusObject(QObject *pObject)
|
||||
{
|
||||
m_apStatusObjects.erase(pObject);
|
||||
|
||||
/* disconnect all signals between the object and MainWindow */
|
||||
disconnect(pObject, NULL, this, NULL);
|
||||
}
|
||||
|
||||
/** Save own status Online,Away,Busy **/
|
||||
void MainWindow::setStatus(QObject *pObject, int nStatus)
|
||||
{
|
||||
RsPeerDetails detail;
|
||||
std::string ownId = rsPeers->getOwnId();
|
||||
|
||||
if (!rsPeers->getPeerDetails(ownId, detail)) {
|
||||
return;
|
||||
}
|
||||
|
||||
StatusInfo si;
|
||||
|
||||
if (isIdle && nStatus == (int) RS_STATUS_ONLINE) {
|
||||
/* set idle state only when I am in online state */
|
||||
/* set idle only when I am online */
|
||||
nStatus = RS_STATUS_INACTIVE;
|
||||
}
|
||||
|
||||
si.id = ownId;
|
||||
si.status = nStatus;
|
||||
|
||||
rsStatus->sendStatus(si);
|
||||
rsStatus->sendStatus("", nStatus);
|
||||
|
||||
/* set status in all status objects, but the calling one */
|
||||
for (std::set <QObject*>::iterator it = m_apStatusObjects.begin(); it != m_apStatusObjects.end(); it++) {
|
||||
@ -1001,7 +983,7 @@ void MainWindow::setStatus(QObject *pObject, int nStatus)
|
||||
}
|
||||
|
||||
/* new status from context menu */
|
||||
void MainWindow::statusChanged(QAction *pAction)
|
||||
void MainWindow::statusChangedMenu(QAction *pAction)
|
||||
{
|
||||
if (pAction == NULL) {
|
||||
return;
|
||||
@ -1017,5 +999,6 @@ void MainWindow::statusChangedComboBox(int index)
|
||||
return;
|
||||
}
|
||||
|
||||
setStatus(statusComboBox, statusComboBox->itemData(index, Qt::UserRole).toInt());
|
||||
/* no object known */
|
||||
setStatus(NULL, statusComboBox->itemData(index, Qt::UserRole).toInt());
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public:
|
||||
static void installGroupChatNotifier();
|
||||
|
||||
/* initialize widget with status informations, status constant stored in data or in Qt::UserRole */
|
||||
void initializeStatusObject(QObject *pObject);
|
||||
void initializeStatusObject(QObject *pObject, bool bConnect);
|
||||
void removeStatusObject(QObject *pObject);
|
||||
void setStatus(QObject *pObject, int nStatus);
|
||||
|
||||
@ -181,7 +181,7 @@ private slots:
|
||||
void showMess();
|
||||
void showSettings();
|
||||
void setStyle();
|
||||
void statusChanged(QAction *pAction);
|
||||
void statusChangedMenu(QAction *pAction);
|
||||
void statusChangedComboBox(int index);
|
||||
|
||||
/** Called when user attempts to quit via quit button*/
|
||||
|
@ -163,16 +163,16 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
|
||||
connect(ui.clearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
|
||||
|
||||
connect(ui.messagelineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(savestatusmessage()));
|
||||
connect(ui.statuscomboBox, SIGNAL(activated(int)), this, SLOT(statusChanged(int)));
|
||||
connect(ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged()));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateMessengerDisplay()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(ownAvatarChanged()), this, SLOT(updateAvatar()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(ownStatusMessageChanged()), this, SLOT(loadmystatusmessage()));
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateMessengerDisplay()));
|
||||
timer->start(1000); /* one second */
|
||||
timer->setInterval(1000); /* one second */
|
||||
timer->setSingleShot(true);
|
||||
|
||||
/* to hide the header */
|
||||
ui.messengertreeWidget->header()->hide();
|
||||
@ -208,7 +208,7 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
|
||||
|
||||
MainWindow *pMainWindow = MainWindow::getInstance();
|
||||
if (pMainWindow) {
|
||||
pMainWindow->initializeStatusObject(ui.statuscomboBox);
|
||||
pMainWindow->initializeStatusObject(ui.statuscomboBox, true);
|
||||
}
|
||||
insertPeers();
|
||||
updateAvatar();
|
||||
@ -383,18 +383,19 @@ void MessengerWindow::messengertreeWidgetCostumPopupMenu( QPoint point )
|
||||
|
||||
void MessengerWindow::updateMessengerDisplay()
|
||||
{
|
||||
if(RsAutoUpdatePage::eventsLocked())
|
||||
return ;
|
||||
if (RsAutoUpdatePage::eventsLocked() == false) {
|
||||
// add self nick and Avatar to Friends.
|
||||
RsPeerDetails pd ;
|
||||
RsPeerDetails pd;
|
||||
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),pd)) {
|
||||
|
||||
QString titleStr("<span style=\"font-size:14pt; font-weight:500;"
|
||||
"color:#FFFFFF;\">%1</span>");
|
||||
ui.nicklabel->setText(titleStr.arg(QString::fromStdString(pd.name) + tr(" - ") + QString::fromStdString(pd.location))) ;
|
||||
QString titleStr("<span style=\"font-size:14pt; font-weight:500;"
|
||||
"color:#FFFFFF;\">%1</span>");
|
||||
ui.nicklabel->setText(titleStr.arg(QString::fromStdString(pd.name) + tr(" - ") + QString::fromStdString(pd.location)));
|
||||
}
|
||||
|
||||
insertPeers();
|
||||
}
|
||||
|
||||
timer->start();
|
||||
}
|
||||
|
||||
/* get the list of peers from the RsIface. */
|
||||
@ -1008,21 +1009,7 @@ void MessengerWindow::loadmystatusmessage()
|
||||
/** Save own status message */
|
||||
void MessengerWindow::savestatusmessage()
|
||||
{
|
||||
Settings->setValueToGroup("Profile", "StatusMessage",ui.messagelineEdit->text());
|
||||
|
||||
rsMsgs->setCustomStateString(ui.messagelineEdit->text().toStdString());
|
||||
}
|
||||
|
||||
void MessengerWindow::statusChanged(int index)
|
||||
{
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
MainWindow *pMainWindow = MainWindow::getInstance();
|
||||
if (pMainWindow) {
|
||||
pMainWindow->setStatus(ui.statuscomboBox, ui.statuscomboBox->itemData(index, Qt::UserRole).toInt());
|
||||
}
|
||||
rsMsgs->setCustomStateString(ui.messagelineEdit->text().toStdString());
|
||||
}
|
||||
|
||||
void MessengerWindow::on_actionSort_Peers_Descending_Order_activated()
|
||||
|
@ -88,7 +88,6 @@ private slots:
|
||||
|
||||
void changeAvatarClicked();
|
||||
|
||||
void statusChanged(int index);
|
||||
void savestatusmessage();
|
||||
|
||||
void on_actionSort_Peers_Descending_Order_activated();
|
||||
@ -110,6 +109,7 @@ private:
|
||||
|
||||
/* Worker Functions */
|
||||
/* (1) Update Display */
|
||||
QTimer *timer;
|
||||
|
||||
/* (2) Utility Fns */
|
||||
QTreeWidgetItem *getCurrentPeer();
|
||||
|
@ -1578,8 +1578,7 @@ void PeersDialog::on_actionCreate_New_Channel_activated()
|
||||
/** Loads own personal status */
|
||||
void PeersDialog::loadmypersonalstatus()
|
||||
{
|
||||
|
||||
ui.mypersonalstatuslabel->setText(QString::fromStdString(rsMsgs->getCustomStateString()));
|
||||
ui.mypersonalstatuslabel->setText(QString::fromStdString(rsMsgs->getCustomStateString()));
|
||||
}
|
||||
|
||||
void PeersDialog::statusmessage()
|
||||
|
@ -9,10 +9,12 @@ RsAutoUpdatePage::RsAutoUpdatePage(int ms_update_period,QWidget *parent)
|
||||
: MainPage(parent)
|
||||
{
|
||||
_timer = new QTimer ;
|
||||
_timer->setInterval(ms_update_period);
|
||||
_timer->setSingleShot(true);
|
||||
|
||||
QObject::connect(_timer,SIGNAL(timeout()),this,SLOT(timerUpdate())) ;
|
||||
|
||||
_timer->start(ms_update_period) ;
|
||||
_timer->start() ;
|
||||
}
|
||||
|
||||
void RsAutoUpdatePage::showEvent(QShowEvent *event)
|
||||
@ -26,11 +28,12 @@ void RsAutoUpdatePage::timerUpdate()
|
||||
{
|
||||
// only update when the widget is visible.
|
||||
//
|
||||
if(_locked || !isVisible())
|
||||
return ;
|
||||
|
||||
updateDisplay();
|
||||
update() ; // Qt flush
|
||||
if(_locked == false && isVisible()) {
|
||||
updateDisplay();
|
||||
update() ; // Qt flush
|
||||
}
|
||||
|
||||
_timer->start() ;
|
||||
}
|
||||
|
||||
void RsAutoUpdatePage::lockAllEvents() { _locked = true ; }
|
||||
|
@ -52,27 +52,19 @@ StatusMessage::~StatusMessage()
|
||||
{
|
||||
}
|
||||
|
||||
void StatusMessage::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
QDialog::closeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
/** Saves the changes on this page */
|
||||
void StatusMessage::save()
|
||||
{
|
||||
Settings->setValueToGroup("Profile", "StatusMessage",ui.txt_StatusMessage->text());
|
||||
rsMsgs->setCustomStateString(ui.txt_StatusMessage->text().toStdString());
|
||||
|
||||
rsMsgs->setCustomStateString(ui.txt_StatusMessage->text().toStdString());
|
||||
|
||||
close();
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void StatusMessage::load()
|
||||
{
|
||||
ui.txt_StatusMessage->setText(QString::fromStdString(rsMsgs->getCustomStateString()));
|
||||
ui.txt_StatusMessage->setText(QString::fromStdString(rsMsgs->getCustomStateString()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,23 +31,19 @@ class StatusMessage : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
/** Default constructor */
|
||||
StatusMessage(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
/** Default destructor */
|
||||
~StatusMessage();
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent * event);
|
||||
|
||||
private slots:
|
||||
|
||||
/** Saves the changes on this page */
|
||||
void save();
|
||||
/** Loads the settings for this page */
|
||||
void load();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
/** Qt Designer generated object */
|
||||
Ui::StatusMessage ui;
|
||||
|
Loading…
Reference in New Issue
Block a user