Updated the notification system. Main changes are:

- the notification system is now a service, p3Notify, that is a public RsNotify.
- RsNotify does nothing except providing a registration system for new notify clients.
- Clients should derive a notify client from the NotifyClient class and register it to rsNotify
- all registered clients get all notifications, so only derive the needed methods. This should allow 
  plugins to get notifications as well.
- updated the code to call RsServer::notify()->[notification method] from inside libretroshare
- pqiNotify has been removed.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6996 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-01-07 22:51:22 +00:00
parent 3cc8c144a8
commit 630824aa1b
47 changed files with 482 additions and 484 deletions

View file

@ -204,7 +204,7 @@ void ConfCertDialog::load()
ui.version->setText(QString::fromStdString(vit->second));
RsPeerCryptoParams cdet ;
if(rsicontrol->getPeerCryptoDetails(detail.id,cdet) && cdet.connexion_state!=0)
if(RsControl::instance()->getPeerCryptoDetails(detail.id,cdet) && cdet.connexion_state!=0)
{
QString ct ;
ct += QString::fromStdString(cdet.cipher_name) ;

View file

@ -34,6 +34,7 @@
#include "ConnectFriendWizard.h"
#include "ui_ConnectFriendWizard.h"
#include "gui/common/PeerDefs.h"
#include "gui/notifyqt.h"
#include "gui/common/GroupDefs.h"
#include "gui/GetStartedDialog.h"
#include "gui/msgs/MessageComposer.h"
@ -713,7 +714,7 @@ void ConnectFriendWizard::accept()
ConnectProgressDialog::showProgress(ssl_id);
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS,1) ;
NotifyQt::getInstance()->notifyListChange(NOTIFY_LIST_NEIGHBOURS,1) ;
QDialog::accept();
}
@ -1018,8 +1019,8 @@ void ConnectFriendWizard::signAllSelectedUsers()
ui->selectedPeersTW->setEnabled(false);
ui->makeFriendButton->setEnabled(false);
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS,0);
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FRIENDS,0);
NotifyQt::getInstance()->notifyListChange(NOTIFY_LIST_NEIGHBOURS,0);
NotifyQt::getInstance()->notifyListChange(NOTIFY_LIST_FRIENDS,0);
}
//============================= RsidPage =====================================

View file

@ -3,6 +3,7 @@
#include <retroshare/rsiface.h>
#include <retroshare/rsturtle.h>
#include <retroshare/rsnotify.h>
#include <QObject>
#include <QMutex>
#include <QPoint>
@ -24,7 +25,7 @@ class SignatureEventData ;
struct TurtleFileInfo;
//class NotifyQt: public NotifyBase, public QObject
class NotifyQt: public QObject, public NotifyBase
class NotifyQt: public QObject, public NotifyClient
{
Q_OBJECT
public:
@ -143,47 +144,23 @@ class NotifyQt: public QObject, public NotifyBase
static NotifyQt *_instance;
/* system notifications */
void startWaitingToasters();
// QMutex waitingToasterMutex; // for lock of the waiting toaster list
QList<Toaster*> waitingToasterList;
QTimer *runningToasterTimer;
// QMutex runningToasterMutex; // for lock of the running toaster list
QList<Toaster*> runningToasterList;
bool _enabled ;
QMutex _mutex ;
std::map<std::string,SignatureEventData*> _deferred_signature_queue ;
// void displayNeighbours();
// void displayFriends();
// void displayDirectories();
// void displaySearch();
// void displayChat();
// void displayMessages();
// void displayChannels();
// void displayTransfers();
// void preDisplayNeighbours();
// void preDisplayFriends();
// void preDisplayDirectories();
// void preDisplaySearch();
// void preDisplayMessages();
// void preDisplayChannels();
// void preDisplayTransfers();
/* so we can update windows */
NetworkDialog *cDialog;
// FriendsDialog *fDialog;
// SharedFilesDialog *dDialog;
// TransfersDialog *tDialog;
// ChatDialog *hDialog;
// MessagesDialog *mDialog;
// ChannelsDialog *sDialog;
// MessengerWindow *mWindow;
// RsIface *iface;
};
#endif

View file

@ -155,8 +155,12 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(images);
// This is needed to allocate rsNotify, so that it can be used to ask for PGP passphrase
//
RsControl::earlyInitNotificationSystem() ;
NotifyQt *notify = NotifyQt::Create();
createRsControl(*notify);
rsNotify->registerNotifyClient(notify);
/* RetroShare Core Objects */
RsInit::InitRsConfig();
@ -303,7 +307,7 @@ int main(int argc, char *argv[])
splashScreen.showMessage(rshare.translate("SplashScreen", "Load configuration"), Qt::AlignHCenter | Qt::AlignBottom);
/* stop Retroshare if startup fails */
if (!rsicontrol->StartupRetroShare())
if (!RsControl::instance()->StartupRetroShare())
{
std::cerr << "libretroshare failed to startup!" << std::endl;
return 1;
@ -419,7 +423,7 @@ int main(int argc, char *argv[])
RsGxsUpdateBroadcast::cleanup();
#endif
rsicontrol->rsGlobalShutDown();
RsControl::instance()->rsGlobalShutDown();
delete(soundManager);
soundManager = NULL;