mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-18 10:57:18 -05:00
Messenger Window linked with RsAutoupdate
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1855 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b524a4cf86
commit
d975d8bf1f
@ -123,7 +123,9 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
|
||||
/* Create all the dialogs of which we only want one instance */
|
||||
_bandwidthGraph = new BandwidthGraph();
|
||||
messengerWindow = new MessengerWindow();
|
||||
|
||||
/*messengerWindow instance is created statically so that RsAutoUpdatePage can access it*/
|
||||
messengerWindow = MessengerWindow::getInstance();
|
||||
applicationWindow = new ApplicationWindow();
|
||||
applicationWindow->hide();
|
||||
|
||||
|
@ -70,7 +70,24 @@
|
||||
/******
|
||||
* #define MSG_DEBUG 1
|
||||
*****/
|
||||
MessengerWindow* MessengerWindow::mv = 0;
|
||||
|
||||
MessengerWindow* MessengerWindow::getInstance()
|
||||
{
|
||||
if(mv == 0)
|
||||
{
|
||||
mv = new MessengerWindow();
|
||||
}
|
||||
return mv;
|
||||
}
|
||||
|
||||
void MessengerWindow::releaseInstance()
|
||||
{
|
||||
if(mv != 0)
|
||||
{
|
||||
delete mv;
|
||||
}
|
||||
}
|
||||
|
||||
/** Constructor */
|
||||
MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
|
||||
@ -115,7 +132,7 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
|
||||
ui.searchlineEdit->setMinimumWidth(20);
|
||||
|
||||
updateAvatar();
|
||||
|
||||
insertPeers();
|
||||
itemFont = QFont("ARIAL", 10);
|
||||
itemFont.setBold(true);
|
||||
|
||||
@ -175,13 +192,12 @@ void MessengerWindow::messengertreeWidgetCostumPopupMenu( QPoint point )
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* get the list of peers from the RsIface. */
|
||||
void MessengerWindow::insertPeers()
|
||||
{
|
||||
if (!rsPeers)
|
||||
{
|
||||
|
||||
/* not ready yet! */
|
||||
return;
|
||||
}
|
||||
@ -190,7 +206,7 @@ void MessengerWindow::insertPeers()
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
rsPeers->getFriendList(peers);
|
||||
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *peerWidget = ui.messengertreeWidget;
|
||||
|
||||
@ -200,13 +216,12 @@ void MessengerWindow::insertPeers()
|
||||
|
||||
for(it = peers.begin(); it != peers.end(); it++)
|
||||
{
|
||||
|
||||
RsPeerDetails details;
|
||||
if (!rsPeers->getPeerDetails(*it, details))
|
||||
{
|
||||
continue; /* BAD */
|
||||
}
|
||||
|
||||
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
|
||||
@ -274,7 +289,6 @@ void MessengerWindow::insertPeers()
|
||||
peerWidget->update(); /* update display */
|
||||
}
|
||||
|
||||
|
||||
/* Utility Fns */
|
||||
std::string getMessengerPeerRsCertId(QTreeWidgetItem *i)
|
||||
{
|
||||
|
@ -38,16 +38,16 @@ class MessengerWindow : public RWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
MessengerWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
void setChatDialog(PeersDialog *cd);
|
||||
|
||||
|
||||
NetworkDialog *networkDialog2;
|
||||
|
||||
QPixmap picture;
|
||||
|
||||
static MessengerWindow* getInstance();
|
||||
static void releaseInstance();
|
||||
|
||||
public slots:
|
||||
void insertPeers();
|
||||
@ -58,6 +58,9 @@ public slots:
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent * event);
|
||||
/** Default Constructor */
|
||||
MessengerWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
|
||||
private slots:
|
||||
@ -98,6 +101,7 @@ private slots:
|
||||
|
||||
private:
|
||||
|
||||
static MessengerWindow *mv;
|
||||
/* Worker Functions */
|
||||
/* (1) Update Display */
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <iostream>
|
||||
#include <QTimer>
|
||||
#include "RsAutoUpdatePage.h"
|
||||
#include "MessengerWindow.h"
|
||||
|
||||
RsAutoUpdatePage::RsAutoUpdatePage(int ms_update_period,QWidget *parent)
|
||||
: MainPage(parent)
|
||||
@ -24,8 +25,9 @@ void RsAutoUpdatePage::timerUpdate()
|
||||
//
|
||||
if(!isVisible())
|
||||
return ;
|
||||
|
||||
updateDisplay() ;
|
||||
|
||||
updateDisplay();
|
||||
MessengerWindow::getInstance()->insertPeers();
|
||||
update() ; // Qt flush
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user