mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #1776 from csoler/v0.6-FT
More switch to new notification system
This commit is contained in:
commit
f72b385ccf
@ -136,7 +136,13 @@ void HashStorage::threadTick()
|
|||||||
stopHashThread();
|
stopHashThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_FINISH, "") ;
|
if(rsEvents)
|
||||||
|
{
|
||||||
|
auto ev = std::make_shared<RsSharedDirectoriesEvent>();
|
||||||
|
ev->mEventCode = RsSharedDirectoriesEventCode::DIRECTORY_SWEEP_ENDED;
|
||||||
|
rsEvents->postEvent(ev);
|
||||||
|
}
|
||||||
|
//RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_FINISH, "") ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -181,7 +187,14 @@ void HashStorage::threadTick()
|
|||||||
else
|
else
|
||||||
rs_sprintf(tmpout, "%lu/%lu (%s - %d%%) : %s", (unsigned long int)mHashCounter+1, (unsigned long int)mTotalFilesToHash, friendlyUnit(mTotalHashedSize).c_str(), int(mTotalHashedSize/double(mTotalSizeToHash)*100.0), job.full_path.c_str()) ;
|
rs_sprintf(tmpout, "%lu/%lu (%s - %d%%) : %s", (unsigned long int)mHashCounter+1, (unsigned long int)mTotalFilesToHash, friendlyUnit(mTotalHashedSize).c_str(), int(mTotalHashedSize/double(mTotalSizeToHash)*100.0), job.full_path.c_str()) ;
|
||||||
|
|
||||||
RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_HASH_FILE, tmpout) ;
|
//RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_HASH_FILE, tmpout) ;
|
||||||
|
if(rsEvents)
|
||||||
|
{
|
||||||
|
auto ev = std::make_shared<RsSharedDirectoriesEvent>();
|
||||||
|
ev->mEventCode = RsSharedDirectoriesEventCode::HASHING_FILE;
|
||||||
|
ev->mMessage = tmpout;
|
||||||
|
rsEvents->postEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
double seconds_origin = rstime::RsScopeTimer::currentTime() ;
|
double seconds_origin = rstime::RsScopeTimer::currentTime() ;
|
||||||
|
|
||||||
|
@ -816,10 +816,13 @@ bool ftController::completeFile(const RsFileHash& hash)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Notify GUI */
|
/* Notify GUI */
|
||||||
RsServer::notify()->AddPopupMessage(RS_POPUP_DOWNLOAD, hash.toStdString(), name, "");
|
if(rsEvents)
|
||||||
|
{
|
||||||
RsServer::notify()->notifyDownloadComplete(hash.toStdString());
|
auto ev = std::make_shared<RsFileTransferEvent>();
|
||||||
RsServer::notify()->notifyDownloadCompleteCount(completeCount);
|
ev->mHash = hash;
|
||||||
|
ev->mFileTransferEventCode = RsFileTransferEventCode::DOWNLOAD_COMPLETE;
|
||||||
|
rsEvents->postEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
rsFiles->ForceDirectoryCheck(true) ;
|
rsFiles->ForceDirectoryCheck(true) ;
|
||||||
|
|
||||||
@ -1412,7 +1415,12 @@ bool ftController::FileClearCompleted()
|
|||||||
IndicateConfigChanged();
|
IndicateConfigChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
RsServer::notify()->notifyDownloadCompleteCount(0);
|
if(rsEvents)
|
||||||
|
{
|
||||||
|
auto ev = std::make_shared<RsFileTransferEvent>();
|
||||||
|
ev->mFileTransferEventCode = RsFileTransferEventCode::COMPLETED_FILES_REMOVED;
|
||||||
|
rsEvents->postEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,13 @@ enum class RsEventType : uint32_t
|
|||||||
/// @see RsGxsPostedEvent
|
/// @see RsGxsPostedEvent
|
||||||
GXS_IDENTITY = 12,
|
GXS_IDENTITY = 12,
|
||||||
|
|
||||||
MAX /// Used to detect invalid event type passed
|
/// @see RsFiles
|
||||||
|
SHARED_DIRECTORIES = 13,
|
||||||
|
|
||||||
|
/// @see RsFiles
|
||||||
|
FILE_TRANSFER = 14,
|
||||||
|
|
||||||
|
MAX /// Used to detect invalid event type passed
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "serialiser/rsserializable.h"
|
#include "serialiser/rsserializable.h"
|
||||||
#include "rsturtle.h"
|
#include "rsturtle.h"
|
||||||
#include "util/rstime.h"
|
#include "util/rstime.h"
|
||||||
|
#include "retroshare/rsevents.h"
|
||||||
|
|
||||||
class RsFiles;
|
class RsFiles;
|
||||||
|
|
||||||
@ -114,6 +115,55 @@ const TransferRequestFlags RS_FILE_REQ_NO_SEARCH ( 0x02000000 ); // di
|
|||||||
|
|
||||||
const uint32_t RS_FILE_EXTRA_DELETE = 0x0010;
|
const uint32_t RS_FILE_EXTRA_DELETE = 0x0010;
|
||||||
|
|
||||||
|
enum class RsSharedDirectoriesEventCode: uint8_t {
|
||||||
|
UNKNOWN = 0x00,
|
||||||
|
STARTING_DIRECTORY_SWEEP = 0x01, // (void)
|
||||||
|
HASHING_FILE = 0x02, // mMessage: full path and hashing speed of the file being hashed
|
||||||
|
DIRECTORY_SWEEP_ENDED = 0x03, // (void)
|
||||||
|
SAVING_FILE_INDEX = 0x04, // (void)
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class RsFileTransferEventCode: uint8_t {
|
||||||
|
UNKNOWN = 0x00,
|
||||||
|
DOWNLOAD_COMPLETE = 0x01, // mHash: hash of the complete file
|
||||||
|
COMPLETED_FILES_REMOVED = 0x02, //
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RsSharedDirectoriesEvent: RsEvent
|
||||||
|
{
|
||||||
|
RsSharedDirectoriesEvent() : RsEvent(RsEventType::SHARED_DIRECTORIES), mEventCode(RsSharedDirectoriesEventCode::UNKNOWN) {}
|
||||||
|
~RsSharedDirectoriesEvent() override = default;
|
||||||
|
|
||||||
|
///* @see RsEvent @see RsSerializable
|
||||||
|
void serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx ) override
|
||||||
|
{
|
||||||
|
RsEvent::serial_process(j, ctx);
|
||||||
|
|
||||||
|
RS_SERIAL_PROCESS(mEventCode);
|
||||||
|
RS_SERIAL_PROCESS(mMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
RsSharedDirectoriesEventCode mEventCode;
|
||||||
|
std::string mMessage;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RsFileTransferEvent: RsEvent
|
||||||
|
{
|
||||||
|
RsFileTransferEvent() : RsEvent(RsEventType::FILE_TRANSFER), mFileTransferEventCode(RsFileTransferEventCode::UNKNOWN) {}
|
||||||
|
~RsFileTransferEvent() override = default;
|
||||||
|
|
||||||
|
///* @see RsEvent @see RsSerializable
|
||||||
|
void serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx ) override
|
||||||
|
{
|
||||||
|
RsEvent::serial_process(j, ctx);
|
||||||
|
|
||||||
|
RS_SERIAL_PROCESS(mFileTransferEventCode);
|
||||||
|
RS_SERIAL_PROCESS(mHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
RsFileTransferEventCode mFileTransferEventCode;
|
||||||
|
RsFileHash mHash;
|
||||||
|
};
|
||||||
struct SharedDirInfo : RsSerializable
|
struct SharedDirInfo : RsSerializable
|
||||||
{
|
{
|
||||||
static bool sameLists(const std::list<RsNodeGroupId>& l1,const std::list<RsNodeGroupId>& l2)
|
static bool sameLists(const std::list<RsNodeGroupId>& l1,const std::list<RsNodeGroupId>& l2)
|
||||||
|
@ -105,27 +105,15 @@ struct RsGxsChannelPost : RsSerializable
|
|||||||
|
|
||||||
enum class RsChannelEventCode: uint8_t
|
enum class RsChannelEventCode: uint8_t
|
||||||
{
|
{
|
||||||
UNKNOWN = 0x00,
|
UNKNOWN = 0x00,
|
||||||
NEW_CHANNEL = 0x01, /// emitted when new channel is received
|
NEW_CHANNEL = 0x01, // emitted when new channel is received
|
||||||
|
UPDATED_CHANNEL = 0x02, // emitted when existing channel is updated
|
||||||
/// emitted when existing channel is updated
|
NEW_MESSAGE = 0x03, // new message reeived in a particular channel (group and msg id)
|
||||||
UPDATED_CHANNEL = 0x02,
|
UPDATED_MESSAGE = 0x04, // existing message has been updated in a particular channel
|
||||||
|
RECEIVED_PUBLISH_KEY = 0x05, // publish key for this channel has been received
|
||||||
/// new message reeived in a particular channel (group and msg id)
|
SUBSCRIBE_STATUS_CHANGED = 0x06, // subscription for channel mChannelGroupId changed.
|
||||||
NEW_MESSAGE = 0x03,
|
READ_STATUS_CHANGED = 0x07, // existing message has been read or set to unread
|
||||||
|
RECEIVED_DISTANT_SEARCH_RESULT = 0x08, // result for the given group id available for the given turtle request id
|
||||||
/// existing message has been updated in a particular channel
|
|
||||||
UPDATED_MESSAGE = 0x04,
|
|
||||||
|
|
||||||
/// publish key for this channel has been received
|
|
||||||
RECEIVED_PUBLISH_KEY = 0x05,
|
|
||||||
|
|
||||||
/// subscription for channel mChannelGroupId changed.
|
|
||||||
SUBSCRIBE_STATUS_CHANGED = 0x06,
|
|
||||||
|
|
||||||
/// existing message has been read or set to unread
|
|
||||||
READ_STATUS_CHANGED = 0x07,
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RsGxsChannelEvent: RsEvent
|
struct RsGxsChannelEvent: RsEvent
|
||||||
@ -137,6 +125,7 @@ struct RsGxsChannelEvent: RsEvent
|
|||||||
RsChannelEventCode mChannelEventCode;
|
RsChannelEventCode mChannelEventCode;
|
||||||
RsGxsGroupId mChannelGroupId;
|
RsGxsGroupId mChannelGroupId;
|
||||||
RsGxsMessageId mChannelMsgId;
|
RsGxsMessageId mChannelMsgId;
|
||||||
|
TurtleRequestId mDistantSearchRequestId;
|
||||||
|
|
||||||
///* @see RsEvent @see RsSerializable
|
///* @see RsEvent @see RsSerializable
|
||||||
void serial_process( RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) override
|
void serial_process( RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) override
|
||||||
@ -146,6 +135,7 @@ struct RsGxsChannelEvent: RsEvent
|
|||||||
RS_SERIAL_PROCESS(mChannelEventCode);
|
RS_SERIAL_PROCESS(mChannelEventCode);
|
||||||
RS_SERIAL_PROCESS(mChannelGroupId);
|
RS_SERIAL_PROCESS(mChannelGroupId);
|
||||||
RS_SERIAL_PROCESS(mChannelMsgId);
|
RS_SERIAL_PROCESS(mChannelMsgId);
|
||||||
|
RS_SERIAL_PROCESS(mDistantSearchRequestId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,7 +40,14 @@ typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsMsgMetaData> > GxsMsgRelatedMe
|
|||||||
struct RsGxsNotify
|
struct RsGxsNotify
|
||||||
{
|
{
|
||||||
enum NotifyType
|
enum NotifyType
|
||||||
{ TYPE_PUBLISHED, TYPE_RECEIVED_NEW, TYPE_PROCESSED, TYPE_RECEIVED_PUBLISHKEY, TYPE_RECEIVED_DISTANT_SEARCH_RESULTS };
|
{
|
||||||
|
TYPE_UNKNOWN = 0x00,
|
||||||
|
TYPE_PUBLISHED = 0x01,
|
||||||
|
TYPE_RECEIVED_NEW = 0x02,
|
||||||
|
TYPE_PROCESSED = 0x03,
|
||||||
|
TYPE_RECEIVED_PUBLISHKEY = 0x04,
|
||||||
|
TYPE_RECEIVED_DISTANT_SEARCH_RESULTS = 0x05
|
||||||
|
};
|
||||||
|
|
||||||
virtual ~RsGxsNotify() {}
|
virtual ~RsGxsNotify() {}
|
||||||
virtual NotifyType getType() = 0;
|
virtual NotifyType getType() = 0;
|
||||||
|
@ -245,6 +245,7 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
for(it = changes.begin(); it != changes.end(); ++it)
|
for(it = changes.begin(); it != changes.end(); ++it)
|
||||||
{
|
{
|
||||||
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
|
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
|
||||||
|
|
||||||
if (msgChange)
|
if (msgChange)
|
||||||
{
|
{
|
||||||
if (msgChange->getType() == RsGxsNotify::TYPE_RECEIVED_NEW|| msgChange->getType() == RsGxsNotify::TYPE_PUBLISHED)
|
if (msgChange->getType() == RsGxsNotify::TYPE_RECEIVED_NEW|| msgChange->getType() == RsGxsNotify::TYPE_PUBLISHED)
|
||||||
@ -294,75 +295,84 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
RsGxsGroupChange *grpChange = dynamic_cast<RsGxsGroupChange*>(*it);
|
||||||
|
|
||||||
|
if (grpChange && rsEvents)
|
||||||
{
|
{
|
||||||
if (rsEvents)
|
switch (grpChange->getType())
|
||||||
{
|
{
|
||||||
RsGxsGroupChange *grpChange = dynamic_cast<RsGxsGroupChange*>(*it);
|
default:
|
||||||
if (grpChange)
|
case RsGxsNotify::TYPE_PROCESSED: // happens when the group is subscribed
|
||||||
|
{
|
||||||
|
std::list<RsGxsGroupId> &grpList = grpChange->mGrpIdList;
|
||||||
|
std::list<RsGxsGroupId>::iterator git;
|
||||||
|
for (git = grpList.begin(); git != grpList.end(); ++git)
|
||||||
{
|
{
|
||||||
switch (grpChange->getType())
|
auto ev = std::make_shared<RsGxsChannelEvent>();
|
||||||
{
|
ev->mChannelGroupId = *git;
|
||||||
default:
|
ev->mChannelEventCode = RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED;
|
||||||
case RsGxsNotify::TYPE_PROCESSED: // happens when the group is subscribed
|
rsEvents->postEvent(ev);
|
||||||
{
|
|
||||||
std::list<RsGxsGroupId> &grpList = grpChange->mGrpIdList;
|
|
||||||
std::list<RsGxsGroupId>::iterator git;
|
|
||||||
for (git = grpList.begin(); git != grpList.end(); ++git)
|
|
||||||
{
|
|
||||||
auto ev = std::make_shared<RsGxsChannelEvent>();
|
|
||||||
ev->mChannelGroupId = *git;
|
|
||||||
ev->mChannelEventCode = RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED;
|
|
||||||
rsEvents->postEvent(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RsGxsNotify::TYPE_PUBLISHED:
|
|
||||||
case RsGxsNotify::TYPE_RECEIVED_NEW:
|
|
||||||
{
|
|
||||||
/* group received */
|
|
||||||
std::list<RsGxsGroupId> &grpList = grpChange->mGrpIdList;
|
|
||||||
std::list<RsGxsGroupId>::iterator git;
|
|
||||||
RS_STACK_MUTEX(mKnownChannelsMutex);
|
|
||||||
for (git = grpList.begin(); git != grpList.end(); ++git)
|
|
||||||
{
|
|
||||||
if(mKnownChannels.find(*git) == mKnownChannels.end())
|
|
||||||
{
|
|
||||||
mKnownChannels.insert(std::make_pair(*git,time(NULL))) ;
|
|
||||||
IndicateConfigChanged();
|
|
||||||
|
|
||||||
auto ev = std::make_shared<RsGxsChannelEvent>();
|
|
||||||
ev->mChannelGroupId = *git;
|
|
||||||
ev->mChannelEventCode = RsChannelEventCode::NEW_CHANNEL;
|
|
||||||
rsEvents->postEvent(ev);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
std::cerr << "(II) Not notifying already known channel " << *git << std::endl;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case RsGxsNotify::TYPE_RECEIVED_PUBLISHKEY:
|
|
||||||
{
|
|
||||||
/* group received */
|
|
||||||
std::list<RsGxsGroupId> &grpList = grpChange->mGrpIdList;
|
|
||||||
std::list<RsGxsGroupId>::iterator git;
|
|
||||||
for (git = grpList.begin(); git != grpList.end(); ++git)
|
|
||||||
{
|
|
||||||
auto ev = std::make_shared<RsGxsChannelEvent>();
|
|
||||||
ev->mChannelGroupId = *git;
|
|
||||||
ev->mChannelEventCode = RsChannelEventCode::RECEIVED_PUBLISH_KEY;
|
|
||||||
rsEvents->postEvent(ev);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsGxsNotify::TYPE_PUBLISHED:
|
||||||
|
case RsGxsNotify::TYPE_RECEIVED_NEW:
|
||||||
|
{
|
||||||
|
/* group received */
|
||||||
|
std::list<RsGxsGroupId> &grpList = grpChange->mGrpIdList;
|
||||||
|
std::list<RsGxsGroupId>::iterator git;
|
||||||
|
RS_STACK_MUTEX(mKnownChannelsMutex);
|
||||||
|
for (git = grpList.begin(); git != grpList.end(); ++git)
|
||||||
|
{
|
||||||
|
if(mKnownChannels.find(*git) == mKnownChannels.end())
|
||||||
|
{
|
||||||
|
mKnownChannels.insert(std::make_pair(*git,time(NULL))) ;
|
||||||
|
IndicateConfigChanged();
|
||||||
|
|
||||||
|
auto ev = std::make_shared<RsGxsChannelEvent>();
|
||||||
|
ev->mChannelGroupId = *git;
|
||||||
|
ev->mChannelEventCode = RsChannelEventCode::NEW_CHANNEL;
|
||||||
|
rsEvents->postEvent(ev);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
std::cerr << "(II) Not notifying already known channel " << *git << std::endl;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case RsGxsNotify::TYPE_RECEIVED_PUBLISHKEY:
|
||||||
|
{
|
||||||
|
/* group received */
|
||||||
|
std::list<RsGxsGroupId> &grpList = grpChange->mGrpIdList;
|
||||||
|
std::list<RsGxsGroupId>::iterator git;
|
||||||
|
for (git = grpList.begin(); git != grpList.end(); ++git)
|
||||||
|
{
|
||||||
|
auto ev = std::make_shared<RsGxsChannelEvent>();
|
||||||
|
ev->mChannelGroupId = *git;
|
||||||
|
ev->mChannelEventCode = RsChannelEventCode::RECEIVED_PUBLISH_KEY;
|
||||||
|
|
||||||
|
rsEvents->postEvent(ev);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsGxsDistantSearchResultChange *dsrChange = dynamic_cast<RsGxsDistantSearchResultChange*>(*it);
|
||||||
|
|
||||||
|
if(dsrChange && rsEvents)
|
||||||
|
{
|
||||||
|
auto ev = std::make_shared<RsGxsChannelEvent>();
|
||||||
|
ev->mChannelGroupId = dsrChange->mGroupId;
|
||||||
|
ev->mChannelEventCode = RsChannelEventCode::RECEIVED_DISTANT_SEARCH_RESULT;
|
||||||
|
ev->mDistantSearchRequestId = dsrChange->mRequestId;
|
||||||
|
|
||||||
|
rsEvents->postEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
/* shouldn't need to worry about groups - as they need to be subscribed to */
|
/* shouldn't need to worry about groups - as they need to be subscribed to */
|
||||||
delete *it;
|
delete *it;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
* *
|
* *
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include "retroshare/rsfiles.h"
|
||||||
#include "TransferUserNotify.h"
|
#include "TransferUserNotify.h"
|
||||||
#include "gui/notifyqt.h"
|
#include "gui/notifyqt.h"
|
||||||
#include "gui/MainWindow.h"
|
#include "gui/MainWindow.h"
|
||||||
@ -27,7 +28,7 @@ TransferUserNotify::TransferUserNotify(QObject *parent) :
|
|||||||
{
|
{
|
||||||
newTransferCount = 0;
|
newTransferCount = 0;
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(downloadCompleteCountChanged(int)), this, SLOT(downloadCountChanged(int)));
|
// connect(NotifyQt::getInstance(), SIGNAL(downloadCompleteCountChanged(int)), this, SLOT(downloadCountChanged(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TransferUserNotify::hasSetting(QString *name, QString *group)
|
bool TransferUserNotify::hasSetting(QString *name, QString *group)
|
||||||
@ -50,7 +51,17 @@ QIcon TransferUserNotify::getMainIcon(bool hasNew)
|
|||||||
|
|
||||||
unsigned int TransferUserNotify::getNewCount()
|
unsigned int TransferUserNotify::getNewCount()
|
||||||
{
|
{
|
||||||
return newTransferCount;
|
std::list<RsFileHash> hashs;
|
||||||
|
rsFiles->FileDownloads(hashs);
|
||||||
|
FileInfo info;
|
||||||
|
|
||||||
|
newTransferCount = 0;
|
||||||
|
|
||||||
|
for(auto hash: hashs)
|
||||||
|
if(rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, info) && info.downloadStatus==FT_STATE_COMPLETE)
|
||||||
|
++newTransferCount;
|
||||||
|
|
||||||
|
return newTransferCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TransferUserNotify::getTrayMessage(bool plural)
|
QString TransferUserNotify::getTrayMessage(bool plural)
|
||||||
@ -68,8 +79,3 @@ void TransferUserNotify::iconClicked()
|
|||||||
MainWindow::showWindow(MainWindow::Transfers);
|
MainWindow::showWindow(MainWindow::Transfers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferUserNotify::downloadCountChanged(int count)
|
|
||||||
{
|
|
||||||
newTransferCount = count;
|
|
||||||
updateIcon();
|
|
||||||
}
|
|
||||||
|
@ -32,9 +32,6 @@ public:
|
|||||||
|
|
||||||
virtual bool hasSetting(QString *name, QString *group);
|
virtual bool hasSetting(QString *name, QString *group);
|
||||||
|
|
||||||
private slots:
|
|
||||||
void downloadCountChanged(int count);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual QIcon getIcon();
|
virtual QIcon getIcon();
|
||||||
virtual QIcon getMainIcon(bool hasNew);
|
virtual QIcon getMainIcon(bool hasNew);
|
||||||
|
@ -1091,10 +1091,34 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
|||||||
|
|
||||||
|
|
||||||
registerHelpButton(ui.helpButton,help_str,"TransfersDialog") ;
|
registerHelpButton(ui.helpButton,help_str,"TransfersDialog") ;
|
||||||
|
|
||||||
|
mEventHandlerId=0;
|
||||||
|
rsEvents->registerEventsHandler(RsEventType::FILE_TRANSFER, [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId );
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransfersDialog::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
if(event->mType != RsEventType::FILE_TRANSFER)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const RsFileTransferEvent *fe = dynamic_cast<const RsFileTransferEvent*>(event.get());
|
||||||
|
if(!fe)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (fe->mFileTransferEventCode)
|
||||||
|
{
|
||||||
|
case RsFileTransferEventCode::DOWNLOAD_COMPLETE:
|
||||||
|
case RsFileTransferEventCode::COMPLETED_FILES_REMOVED:
|
||||||
|
getUserNotify()->updateIcon();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TransfersDialog::~TransfersDialog()
|
TransfersDialog::~TransfersDialog()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
|
|
||||||
// save settings
|
// save settings
|
||||||
processSettings(false);
|
processSettings(false);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include <retroshare/rstypes.h>
|
#include <retroshare/rstypes.h>
|
||||||
|
#include <retroshare/rsevents.h>
|
||||||
#include "RsAutoUpdatePage.h"
|
#include "RsAutoUpdatePage.h"
|
||||||
|
|
||||||
#include "ui_TransfersDialog.h"
|
#include "ui_TransfersDialog.h"
|
||||||
@ -259,6 +260,7 @@ private:
|
|||||||
bool controlTransferFile(uint32_t flags);
|
bool controlTransferFile(uint32_t flags);
|
||||||
void changePriority(int priority);
|
void changePriority(int priority);
|
||||||
void setChunkStrategy(FileChunksInfo::ChunkStrategy s) ;
|
void setChunkStrategy(FileChunksInfo::ChunkStrategy s) ;
|
||||||
|
void handleEvent(std::shared_ptr<const RsEvent> event);
|
||||||
|
|
||||||
QTreeView *downloadList;
|
QTreeView *downloadList;
|
||||||
|
|
||||||
@ -273,6 +275,7 @@ private:
|
|||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::TransfersDialog ui;
|
Ui::TransfersDialog ui;
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
public slots:
|
public slots:
|
||||||
// these four functions add entries to the transfers dialog, and return the row id of the entry modified/added
|
// these four functions add entries to the transfers dialog, and return the row id of the entry modified/added
|
||||||
// int addDLItem(int row, const FileInfo &fileInfo);
|
// int addDLItem(int row, const FileInfo &fileInfo);
|
||||||
|
@ -1377,6 +1377,9 @@ void IdDialog::circle_selected()
|
|||||||
|
|
||||||
IdDialog::~IdDialog()
|
IdDialog::~IdDialog()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId_identity);
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId_circles);
|
||||||
|
|
||||||
// save settings
|
// save settings
|
||||||
processSettings(false);
|
processSettings(false);
|
||||||
|
|
||||||
@ -2057,9 +2060,11 @@ QString IdDialog::createUsageString(const RsIdentityUsage& u) const
|
|||||||
return tr("Admin signature verification in service %1").arg(service_name);
|
return tr("Admin signature verification in service %1").arg(service_name);
|
||||||
case RsIdentityUsage::GROUP_AUTHOR_SIGNATURE_CREATION: // not typically used, since most services do not require group author signatures
|
case RsIdentityUsage::GROUP_AUTHOR_SIGNATURE_CREATION: // not typically used, since most services do not require group author signatures
|
||||||
return tr("Creation of author signature in service %1").arg(service_name);
|
return tr("Creation of author signature in service %1").arg(service_name);
|
||||||
case RsIdentityUsage::GROUP_AUTHOR_SIGNATURE_VALIDATION:
|
|
||||||
case RsIdentityUsage::MESSAGE_AUTHOR_SIGNATURE_CREATION: // most common use case. Messages are signed by authors in e.g. forums.
|
case RsIdentityUsage::MESSAGE_AUTHOR_SIGNATURE_CREATION: // most common use case. Messages are signed by authors in e.g. forums.
|
||||||
|
return tr("Message signature creation in group %1 of service %2").arg(QString::fromStdString(u.mGrpId.toStdString())).arg(service_name);
|
||||||
case RsIdentityUsage::GROUP_AUTHOR_KEEP_ALIVE: // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
|
case RsIdentityUsage::GROUP_AUTHOR_KEEP_ALIVE: // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
|
||||||
|
case RsIdentityUsage::GROUP_AUTHOR_SIGNATURE_VALIDATION:
|
||||||
|
return tr("Group author for group %1 in service %2").arg(QString::fromStdString(u.mGrpId.toStdString())).arg(service_name);
|
||||||
break ;
|
break ;
|
||||||
case RsIdentityUsage::MESSAGE_AUTHOR_SIGNATURE_VALIDATION:
|
case RsIdentityUsage::MESSAGE_AUTHOR_SIGNATURE_VALIDATION:
|
||||||
case RsIdentityUsage::MESSAGE_AUTHOR_KEEP_ALIVE: // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
|
case RsIdentityUsage::MESSAGE_AUTHOR_KEEP_ALIVE: // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
|
||||||
@ -2103,18 +2108,9 @@ QString IdDialog::createUsageString(const RsIdentityUsage& u) const
|
|||||||
{
|
{
|
||||||
return tr("Generic signature.");
|
return tr("Generic signature.");
|
||||||
}
|
}
|
||||||
case RsIdentityUsage::IDENTITY_GENERIC_ENCRYPTION:
|
case RsIdentityUsage::IDENTITY_GENERIC_ENCRYPTION: return tr("Generic encryption.");
|
||||||
{
|
case RsIdentityUsage::IDENTITY_GENERIC_DECRYPTION: return tr("Generic decryption.");
|
||||||
return tr("Generic encryption.");
|
case RsIdentityUsage::CIRCLE_MEMBERSHIP_CHECK: return tr("Membership verification in circle %1.").arg(QString::fromStdString(u.mGrpId.toStdString()));
|
||||||
}
|
|
||||||
case RsIdentityUsage::IDENTITY_GENERIC_DECRYPTION:
|
|
||||||
{
|
|
||||||
return tr("Generic decryption.");
|
|
||||||
}
|
|
||||||
case RsIdentityUsage::CIRCLE_MEMBERSHIP_CHECK:
|
|
||||||
{
|
|
||||||
return tr("Membership verification in circle %1.").arg(QString::fromStdString(u.mGrpId.toStdString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
#warning TODO! csoler 2017-01-03: Add the different strings and translations here.
|
#warning TODO! csoler 2017-01-03: Add the different strings and translations here.
|
||||||
default:
|
default:
|
||||||
|
@ -83,6 +83,7 @@ void PostedDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
|||||||
|
|
||||||
PostedDialog::~PostedDialog()
|
PostedDialog::~PostedDialog()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserNotify *PostedDialog::createUserNotify(QObject *parent)
|
UserNotify *PostedDialog::createUserNotify(QObject *parent)
|
||||||
|
@ -266,6 +266,7 @@ void NewFriendList::handleEvent(std::shared_ptr<const RsEvent> e)
|
|||||||
|
|
||||||
NewFriendList::~NewFriendList()
|
NewFriendList::~NewFriendList()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,8 +155,6 @@ private:
|
|||||||
|
|
||||||
void initUi();
|
void initUi();
|
||||||
|
|
||||||
void updateSearchResults();
|
|
||||||
|
|
||||||
void openGroupInNewTab(const RsGxsGroupId &groupId);
|
void openGroupInNewTab(const RsGxsGroupId &groupId);
|
||||||
void groupSubscribe(bool subscribe);
|
void groupSubscribe(bool subscribe);
|
||||||
|
|
||||||
@ -185,6 +183,8 @@ private:
|
|||||||
// void loadGroupSummary_CurrentGroup(const uint32_t &token);
|
// void loadGroupSummary_CurrentGroup(const uint32_t &token);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void updateSearchResults();
|
||||||
|
|
||||||
bool mCountChildMsgs; // Count unread child messages?
|
bool mCountChildMsgs; // Count unread child messages?
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -42,11 +42,6 @@ void RsGxsUpdateBroadcastPage::setUpdateWhenInvisible(bool update)
|
|||||||
mBase->setUpdateWhenInvisible(update);
|
mBase->setUpdateWhenInvisible(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::set<TurtleRequestId>& RsGxsUpdateBroadcastPage::getSearchResults()
|
|
||||||
{
|
|
||||||
return mBase->getSearchResults();
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIdsMeta()
|
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIdsMeta()
|
||||||
{
|
{
|
||||||
return mBase->getGrpIdsMeta();
|
return mBase->getGrpIdsMeta();
|
||||||
|
@ -51,7 +51,8 @@ public:
|
|||||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
||||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
||||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||||
const std::set<TurtleRequestId>& getSearchResults();
|
|
||||||
|
virtual const std::set<TurtleRequestId> getSearchResults() const { return std::set<TurtleRequestId>(); } // overload this for subclasses that provide distant search
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *event);
|
virtual void showEvent(QShowEvent *event);
|
||||||
|
@ -76,6 +76,11 @@ void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> ev
|
|||||||
updateMessageSummaryList(e->mChannelGroupId);
|
updateMessageSummaryList(e->mChannelGroupId);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RsChannelEventCode::RECEIVED_DISTANT_SEARCH_RESULT:
|
||||||
|
mSearchResults.insert(e->mDistantSearchRequestId);
|
||||||
|
updateSearchResults();
|
||||||
|
break;
|
||||||
|
|
||||||
case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]];
|
case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]];
|
||||||
case RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED:
|
case RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED:
|
||||||
updateDisplay(true);
|
updateDisplay(true);
|
||||||
@ -88,6 +93,7 @@ void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> ev
|
|||||||
|
|
||||||
GxsChannelDialog::~GxsChannelDialog()
|
GxsChannelDialog::~GxsChannelDialog()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GxsChannelDialog::getHelpString() const
|
QString GxsChannelDialog::getHelpString() const
|
||||||
|
@ -48,6 +48,7 @@ protected:
|
|||||||
virtual QString getHelpString() const ;
|
virtual QString getHelpString() const ;
|
||||||
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||||
virtual bool getDistantSearchResults(TurtleRequestId id, std::map<RsGxsGroupId,RsGxsGroupSummary>& group_infos);
|
virtual bool getDistantSearchResults(TurtleRequestId id, std::map<RsGxsGroupId,RsGxsGroupSummary>& group_infos);
|
||||||
|
virtual const std::set<TurtleRequestId> getSearchResults() const override { return mSearchResults ; }
|
||||||
|
|
||||||
virtual TurtleRequestId distantSearch(const QString& search_string) ;
|
virtual TurtleRequestId distantSearch(const QString& search_string) ;
|
||||||
virtual void checkRequestGroup(const RsGxsGroupId& grpId) ;
|
virtual void checkRequestGroup(const RsGxsGroupId& grpId) ;
|
||||||
@ -76,6 +77,8 @@ private:
|
|||||||
|
|
||||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||||
|
|
||||||
|
std::set<TurtleRequestId> mSearchResults;
|
||||||
|
|
||||||
RsEventsHandlerId_t mEventHandlerId;
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ void GxsChannelPostsWidget::handleEvent_main_thread(std::shared_ptr<const RsEven
|
|||||||
|
|
||||||
GxsChannelPostsWidget::~GxsChannelPostsWidget()
|
GxsChannelPostsWidget::~GxsChannelPostsWidget()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
// save settings
|
// save settings
|
||||||
processSettings(false);
|
processSettings(false);
|
||||||
|
|
||||||
|
@ -490,6 +490,7 @@ void GxsForumThreadWidget::blank()
|
|||||||
|
|
||||||
GxsForumThreadWidget::~GxsForumThreadWidget()
|
GxsForumThreadWidget::~GxsForumThreadWidget()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
// save settings
|
// save settings
|
||||||
processSettings(false);
|
processSettings(false);
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ void GxsForumsDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> eve
|
|||||||
|
|
||||||
GxsForumsDialog::~GxsForumsDialog()
|
GxsForumsDialog::~GxsForumsDialog()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GxsForumsDialog::getHelpString() const
|
QString GxsForumsDialog::getHelpString() const
|
||||||
|
@ -349,6 +349,7 @@ void NotifyQt::notifyDiscInfoChanged()
|
|||||||
emit discInfoChanged() ;
|
emit discInfoChanged() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TO_REMOVE
|
||||||
void NotifyQt::notifyDownloadComplete(const std::string& fileHash)
|
void NotifyQt::notifyDownloadComplete(const std::string& fileHash)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -376,6 +377,7 @@ void NotifyQt::notifyDownloadCompleteCount(uint32_t count)
|
|||||||
|
|
||||||
emit downloadCompleteCountChanged(count);
|
emit downloadCompleteCountChanged(count);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void NotifyQt::notifyDiskFull(uint32_t loc,uint32_t size_in_mb)
|
void NotifyQt::notifyDiskFull(uint32_t loc,uint32_t size_in_mb)
|
||||||
{
|
{
|
||||||
@ -582,6 +584,7 @@ void NotifyQt::notifyTurtleSearchResult(const RsPeerId& pid,uint32_t search_id,c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TO_REMOVE
|
||||||
void NotifyQt::notifyHashingInfo(uint32_t type, const std::string& fileinfo)
|
void NotifyQt::notifyHashingInfo(uint32_t type, const std::string& fileinfo)
|
||||||
{
|
{
|
||||||
QString info;
|
QString info;
|
||||||
@ -608,6 +611,7 @@ void NotifyQt::notifyHashingInfo(uint32_t type, const std::string& fileinfo)
|
|||||||
|
|
||||||
emit hashingInfoChanged(info);
|
emit hashingInfoChanged(info);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void NotifyQt::notifyHistoryChanged(uint32_t msgId, int type)
|
void NotifyQt::notifyHistoryChanged(uint32_t msgId, int type)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,9 @@ class NotifyQt: public QObject, public NotifyClient
|
|||||||
virtual void notifyChatStatus(const ChatId &chat_id,const std::string& status_string);
|
virtual void notifyChatStatus(const ChatId &chat_id,const std::string& status_string);
|
||||||
virtual void notifyChatCleared(const ChatId &chat_id);
|
virtual void notifyChatCleared(const ChatId &chat_id);
|
||||||
virtual void notifyCustomState(const std::string& peer_id, const std::string& status_string);
|
virtual void notifyCustomState(const std::string& peer_id, const std::string& status_string);
|
||||||
|
#ifdef TO_REMOVE
|
||||||
virtual void notifyHashingInfo(uint32_t type, const std::string& fileinfo);
|
virtual void notifyHashingInfo(uint32_t type, const std::string& fileinfo);
|
||||||
|
#endif
|
||||||
virtual void notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list<TurtleFileInfo>& found_files);
|
virtual void notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list<TurtleFileInfo>& found_files);
|
||||||
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleGxsInfo>& found_groups);
|
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleGxsInfo>& found_groups);
|
||||||
virtual void notifyPeerHasNewAvatar(std::string peer_id) ;
|
virtual void notifyPeerHasNewAvatar(std::string peer_id) ;
|
||||||
@ -85,8 +87,10 @@ class NotifyQt: public QObject, public NotifyClient
|
|||||||
virtual void notifyHistoryChanged(uint32_t msgId, int type);
|
virtual void notifyHistoryChanged(uint32_t msgId, int type);
|
||||||
|
|
||||||
virtual void notifyDiscInfoChanged() ;
|
virtual void notifyDiscInfoChanged() ;
|
||||||
|
#ifdef TO_REMOVE
|
||||||
virtual void notifyDownloadComplete(const std::string& fileHash);
|
virtual void notifyDownloadComplete(const std::string& fileHash);
|
||||||
virtual void notifyDownloadCompleteCount(uint32_t count);
|
virtual void notifyDownloadCompleteCount(uint32_t count);
|
||||||
|
#endif
|
||||||
virtual bool askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad, std::string& password, bool &cancelled);
|
virtual bool askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad, std::string& password, bool &cancelled);
|
||||||
virtual bool askForPluginConfirmation(const std::string& plugin_filename, const std::string& plugin_file_hash,bool first_time);
|
virtual bool askForPluginConfirmation(const std::string& plugin_filename, const std::string& plugin_file_hash,bool first_time);
|
||||||
|
|
||||||
@ -153,8 +157,6 @@ class NotifyQt: public QObject, public NotifyClient
|
|||||||
void chatMessageReceived(ChatMessage msg);
|
void chatMessageReceived(ChatMessage msg);
|
||||||
void groupsChanged(int type) const ;
|
void groupsChanged(int type) const ;
|
||||||
void discInfoChanged() const ;
|
void discInfoChanged() const ;
|
||||||
void downloadComplete(const QString& /* fileHash */);
|
|
||||||
void downloadCompleteCountChanged(int /* count */);
|
|
||||||
#ifdef REMOVE
|
#ifdef REMOVE
|
||||||
void forumMsgReadSatusChanged(const QString& forumId, const QString& msgId, int status);
|
void forumMsgReadSatusChanged(const QString& forumId, const QString& msgId, int status);
|
||||||
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
|
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
|
||||||
|
@ -52,11 +52,42 @@ HashingStatus::HashingStatus(QWidget *parent)
|
|||||||
hashloader->hide();
|
hashloader->hide();
|
||||||
statusHashing->hide();
|
statusHashing->hide();
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(hashingInfoChanged(const QString&)), SLOT(updateHashingInfo(const QString&)));
|
mEventHandlerId=0;
|
||||||
|
rsEvents->registerEventsHandler(RsEventType::SHARED_DIRECTORIES, [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId );
|
||||||
|
}
|
||||||
|
|
||||||
|
void HashingStatus::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
if(event->mType != RsEventType::SHARED_DIRECTORIES)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const RsSharedDirectoriesEvent *fe = dynamic_cast<const RsSharedDirectoriesEvent*>(event.get());
|
||||||
|
if(!fe)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QString info;
|
||||||
|
|
||||||
|
switch (fe->mEventCode)
|
||||||
|
{
|
||||||
|
case RsSharedDirectoriesEventCode::STARTING_DIRECTORY_SWEEP:
|
||||||
|
info = tr("Examining shared files...");
|
||||||
|
break;
|
||||||
|
case RsSharedDirectoriesEventCode::DIRECTORY_SWEEP_ENDED:
|
||||||
|
break;
|
||||||
|
case RsSharedDirectoriesEventCode::HASHING_FILE:
|
||||||
|
info = tr("Hashing file") + " " + QString::fromUtf8(fe->mMessage.c_str());
|
||||||
|
break;
|
||||||
|
case RsSharedDirectoriesEventCode::SAVING_FILE_INDEX:
|
||||||
|
info = tr("Saving file index...");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateHashingInfo(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashingStatus::~HashingStatus()
|
HashingStatus::~HashingStatus()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
delete(movie);
|
delete(movie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#define HASHINGSTATUS_H
|
#define HASHINGSTATUS_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include "retroshare/rsevents.h"
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class ElidedLabel;
|
class ElidedLabel;
|
||||||
@ -37,15 +38,16 @@ public:
|
|||||||
void setCompactMode(bool compact) {_compactMode = compact; }
|
void setCompactMode(bool compact) {_compactMode = compact; }
|
||||||
void mousePressEvent(QMouseEvent *);
|
void mousePressEvent(QMouseEvent *);
|
||||||
|
|
||||||
public slots:
|
|
||||||
void updateHashingInfo(const QString&) ;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateHashingInfo(const QString& s);
|
||||||
|
void handleEvent(std::shared_ptr<const RsEvent> event);
|
||||||
|
|
||||||
ElidedLabel *statusHashing;
|
ElidedLabel *statusHashing;
|
||||||
QLabel *hashloader;
|
QLabel *hashloader;
|
||||||
QString mLastText ;
|
QString mLastText ;
|
||||||
QMovie *movie;
|
QMovie *movie;
|
||||||
bool _compactMode;
|
bool _compactMode;
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,6 +45,11 @@ RsGxsUpdateBroadcast::RsGxsUpdateBroadcast(RsGxsIfaceHelper *ifaceImpl) :
|
|||||||
}, mEventHandlerId );
|
}, mEventHandlerId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsGxsUpdateBroadcast::~RsGxsUpdateBroadcast()
|
||||||
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
|
}
|
||||||
|
|
||||||
void RsGxsUpdateBroadcast::cleanup()
|
void RsGxsUpdateBroadcast::cleanup()
|
||||||
{
|
{
|
||||||
QMap<RsGxsIfaceHelper*, RsGxsUpdateBroadcast*>::iterator it;
|
QMap<RsGxsIfaceHelper*, RsGxsUpdateBroadcast*>::iterator it;
|
||||||
|
@ -40,6 +40,9 @@ public:
|
|||||||
|
|
||||||
static RsGxsUpdateBroadcast *get(RsGxsIfaceHelper* ifaceImpl);
|
static RsGxsUpdateBroadcast *get(RsGxsIfaceHelper* ifaceImpl);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ~RsGxsUpdateBroadcast();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed();
|
||||||
void msgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
void msgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
||||||
|
Loading…
Reference in New Issue
Block a user