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

@ -52,9 +52,9 @@
#include "turtle/p3turtle.h"
#include "util/rsdir.h"
#include "rsserver/p3face.h"
#include "pqi/p3linkmgr.h"
#include "pqi/pqinotify.h"
#include "retroshare/rsiface.h"
#include "retroshare/rspeers.h"
@ -722,7 +722,7 @@ bool ftController::moveFile(const std::string& source,const std::string& dest)
return true ;
else
{
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File erase error", "Error while removing hash file " + dest + "\nRead-only file system ?");
RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "File erase error", "Error while removing hash file " + dest + "\nRead-only file system ?");
return false ;
}
}
@ -733,7 +733,7 @@ bool ftController::copyFile(const std::string& source,const std::string& dest)
if(in == NULL)
{
//getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nCannot open input file "+source);
//RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nCannot open input file "+source);
std::cerr << "******************** FT CONTROLLER ERROR ************************" << std::endl;
std::cerr << "Error while copying file " + dest + "\nCannot open input file "+source << std::endl;
std::cerr << "*****************************************************************" << std::endl;
@ -744,7 +744,7 @@ bool ftController::copyFile(const std::string& source,const std::string& dest)
if(out == NULL)
{
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nCheck for disk full, or write permission ?\nOriginal file kept under the name "+source);
RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nCheck for disk full, or write permission ?\nOriginal file kept under the name "+source);
fclose (in);
return false ;
}
@ -764,7 +764,7 @@ bool ftController::copyFile(const std::string& source,const std::string& dest)
if(t != s)
{
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nIs your disc full ?\nOriginal file kept under the name "+source);
RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nIs your disc full ?\nOriginal file kept under the name "+source);
bRet = false ;
break;
}
@ -965,12 +965,10 @@ bool ftController::completeFile(std::string hash)
/* Notify GUI */
if ((flags & RS_FILE_REQ_CACHE) == 0) {
pqiNotify *notify = getPqiNotify();
if (notify) {
notify->AddPopupMessage(RS_POPUP_DOWNLOAD, hash, name, "");
}
rsicontrol->getNotify().notifyDownloadComplete(hash);
rsicontrol->getNotify().notifyDownloadCompleteCount(completeCount);
RsServer::notify()->AddPopupMessage(RS_POPUP_DOWNLOAD, hash, name, "");
RsServer::notify()->notifyDownloadComplete(hash);
RsServer::notify()->notifyDownloadCompleteCount(completeCount);
rsFiles->ForceDirectoryCheck() ;
}
@ -1523,7 +1521,7 @@ bool ftController::FileClearCompleted()
IndicateConfigChanged();
} /******* UNLOCKED ********/
rsicontrol->getNotify().notifyDownloadCompleteCount(0);
RsServer::notify()->notifyDownloadCompleteCount(0);
return false;
}