mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
Added simple toaster for download complete.
Added new icon in MainWindow and systray icon for existing completed downloads. You can enable/disable the toaster and the systray icon in NotifyPage. Recompile of the GUI needed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3868 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e7813892bc
commit
fc08d1171f
22 changed files with 656 additions and 70 deletions
|
@ -55,6 +55,8 @@
|
|||
#include "pqi/p3connmgr.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
#include "retroshare/rsiface.h"
|
||||
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
#include <stdio.h>
|
||||
#include <sstream>
|
||||
|
@ -733,11 +735,13 @@ bool ftController::completeFile(std::string hash)
|
|||
{
|
||||
/* variables... so we can drop mutex later */
|
||||
std::string path;
|
||||
std::string name;
|
||||
uint64_t size = 0;
|
||||
uint32_t state = 0;
|
||||
uint32_t period = 0;
|
||||
uint32_t flags = 0;
|
||||
uint32_t extraflags = 0;
|
||||
uint32_t completeCount = 0;
|
||||
|
||||
{
|
||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||
|
@ -814,6 +818,7 @@ bool ftController::completeFile(std::string hash)
|
|||
|
||||
/* for extralist additions */
|
||||
path = fc->mDestination;
|
||||
name = fc->mName;
|
||||
//hash = fc->mHash;
|
||||
size = fc->mSize;
|
||||
state = fc->mState;
|
||||
|
@ -831,8 +836,10 @@ bool ftController::completeFile(std::string hash)
|
|||
|
||||
/* switch map */
|
||||
if (!(fc->mFlags & RS_FILE_HINTS_CACHE)) /* clean up completed cache files automatically */
|
||||
{
|
||||
mCompleted[fc->mHash] = fc;
|
||||
else
|
||||
completeCount = mCompleted.size();
|
||||
} else
|
||||
delete fc ;
|
||||
|
||||
mDownloads.erase(it);
|
||||
|
@ -903,6 +910,16 @@ bool ftController::completeFile(std::string hash)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Notify GUI */
|
||||
if ((flags & RS_FILE_HINTS_CACHE) == 0) {
|
||||
pqiNotify *notify = getPqiNotify();
|
||||
if (notify) {
|
||||
notify->AddPopupMessage(RS_POPUP_DOWNLOAD, hash, name, "");
|
||||
}
|
||||
rsicontrol->getNotify().notifyDownloadComplete(hash);
|
||||
rsicontrol->getNotify().notifyDownloadCompleteCount(completeCount);
|
||||
}
|
||||
|
||||
IndicateConfigChanged(); /* completed transfer -> save */
|
||||
return true;
|
||||
|
||||
|
@ -1431,14 +1448,18 @@ bool ftController::FileClearCompleted()
|
|||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftController::FileClearCompleted()" <<std::endl;
|
||||
#endif
|
||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||
{
|
||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||
|
||||
for(std::map<std::string, ftFileControl*>::iterator it(mCompleted.begin());it!=mCompleted.end();++it)
|
||||
delete it->second ;
|
||||
for(std::map<std::string, ftFileControl*>::iterator it(mCompleted.begin());it!=mCompleted.end();++it)
|
||||
delete it->second ;
|
||||
|
||||
mCompleted.clear();
|
||||
mCompleted.clear();
|
||||
|
||||
IndicateConfigChanged();
|
||||
IndicateConfigChanged();
|
||||
} /******* UNLOCKED ********/
|
||||
|
||||
rsicontrol->getNotify().notifyDownloadCompleteCount(0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -200,6 +200,8 @@ class NotifyBase
|
|||
virtual void notifyPeerStatusChangedSummary() {}
|
||||
virtual void notifyChannelMsgReadSatusChanged(const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) {}
|
||||
virtual void notifyDiscInfoChanged() {}
|
||||
virtual void notifyDownloadComplete(const std::string& /* fileHash */) {};
|
||||
virtual void notifyDownloadCompleteCount(uint32_t /* count */) {};
|
||||
|
||||
virtual std::string askForPassword(const std::string& /* key_details */ ,bool /* prev_is_bad */ ) { return "" ;}
|
||||
};
|
||||
|
|
|
@ -45,6 +45,7 @@ const uint32_t RS_POPUP_CHAT = 0x0002;
|
|||
const uint32_t RS_POPUP_CALL = 0x0004;
|
||||
const uint32_t RS_POPUP_CONNECT = 0x0008;
|
||||
const uint32_t RS_SYSTRAY_GROUP_MSG = 0x0010;
|
||||
const uint32_t RS_POPUP_DOWNLOAD = 0x0020;
|
||||
|
||||
/* CHAT flags are here - so they are in the same place as
|
||||
* other Notify flags... not used by libretroshare though
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue