mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 15:09:33 -05:00
fixed 2 other missing postToObject causing GUI calls in async places
This commit is contained in:
parent
aa16be6450
commit
5957a262d3
@ -38,6 +38,7 @@
|
||||
#include "util/misc.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/RsFile.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include "retroshare/rsdisc.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
@ -1098,12 +1099,11 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
registerHelpButton(ui.helpButton,help_str,"TransfersDialog") ;
|
||||
|
||||
mEventHandlerId=0;
|
||||
rsEvents->registerEventsHandler(
|
||||
[this](std::shared_ptr<const RsEvent> event) { handleEvent(event); },
|
||||
mEventHandlerId, RsEventType::FILE_TRANSFER );
|
||||
// Do the GUI events in the GUI thread!
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId, RsEventType::FILE_TRANSFER );
|
||||
}
|
||||
|
||||
void TransfersDialog::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||
void TransfersDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
if(event->mType != RsEventType::FILE_TRANSFER) return;
|
||||
|
||||
@ -1115,6 +1115,7 @@ void TransfersDialog::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
case RsFileTransferEventCode::DOWNLOAD_COMPLETE:
|
||||
case RsFileTransferEventCode::COMPLETED_FILES_REMOVED:
|
||||
|
||||
getUserNotify()->updateIcon();
|
||||
default:
|
||||
break;
|
||||
|
@ -260,7 +260,7 @@ private:
|
||||
bool controlTransferFile(uint32_t flags);
|
||||
void changePriority(int priority);
|
||||
void setChunkStrategy(FileChunksInfo::ChunkStrategy s) ;
|
||||
void handleEvent(std::shared_ptr<const RsEvent> event);
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
QTreeView *downloadList;
|
||||
|
||||
|
@ -153,16 +153,10 @@ IdDialog::IdDialog(QWidget *parent) : MainPage(parent), ui(new Ui::IdDialog)
|
||||
ui->setupUi(this);
|
||||
|
||||
mEventHandlerId_identity = 0;
|
||||
rsEvents->registerEventsHandler(
|
||||
[this](std::shared_ptr<const RsEvent> event)
|
||||
{ RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this); },
|
||||
mEventHandlerId_identity, RsEventType::GXS_IDENTITY );
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this); }, mEventHandlerId_identity, RsEventType::GXS_IDENTITY );
|
||||
|
||||
mEventHandlerId_circles = 0;
|
||||
rsEvents->registerEventsHandler(
|
||||
[this](std::shared_ptr<const RsEvent> event)
|
||||
{ RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this); },
|
||||
mEventHandlerId_circles, RsEventType::GXS_CIRCLES );
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this); }, mEventHandlerId_circles, RsEventType::GXS_CIRCLES );
|
||||
|
||||
// This is used to grab the broadcast of changes from p3GxsCircles, which is discarded by the current dialog, since it expects data for p3Identity only.
|
||||
//mCirclesBroadcastBase = new RsGxsUpdateBroadcastBase(rsGxsCircles, this);
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "util/DateTime.h"
|
||||
#include "util/RsProtectedTimer.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
@ -286,10 +287,10 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
||||
connect(ui.messageTreeWidget->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)), this, SLOT(currentChanged(const QModelIndex&,const QModelIndex&)));
|
||||
|
||||
mEventHandlerId=0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::MAIL_STATUS );
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_STATUS );
|
||||
}
|
||||
|
||||
void MessagesDialog::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||
void MessagesDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
if(event->mType != RsEventType::MAIL_STATUS)
|
||||
return;
|
||||
|
@ -111,7 +111,7 @@ private slots:
|
||||
void tabCloseRequested(int tab);
|
||||
|
||||
private:
|
||||
void handleEvent(std::shared_ptr<const RsEvent> event);
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
void updateInterface();
|
||||
|
||||
|
@ -55,10 +55,10 @@ HashingStatus::HashingStatus(QWidget *parent)
|
||||
statusHashing->hide();
|
||||
|
||||
mEventHandlerId=0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::SHARED_DIRECTORIES );
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId, RsEventType::SHARED_DIRECTORIES );
|
||||
}
|
||||
|
||||
void HashingStatus::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||
void HashingStatus::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
// Warning: no GUI calls should happen here!
|
||||
|
||||
@ -73,7 +73,8 @@ void HashingStatus::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||
|
||||
switch (fe->mEventCode)
|
||||
{
|
||||
case RsSharedDirectoriesEventCode::STARTING_DIRECTORY_SWEEP:
|
||||
default:
|
||||
case RsSharedDirectoriesEventCode::STARTING_DIRECTORY_SWEEP:
|
||||
info = tr("Examining shared files...");
|
||||
break;
|
||||
case RsSharedDirectoriesEventCode::DIRECTORY_SWEEP_ENDED:
|
||||
@ -88,7 +89,7 @@ void HashingStatus::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||
|
||||
// GUI calls should only happen in the GUI thread, which is achieved by postToObject().
|
||||
|
||||
RsQThreadUtils::postToObject( [this,info]() { updateHashingInfo(info); }, this);
|
||||
updateHashingInfo(info);
|
||||
}
|
||||
|
||||
HashingStatus::~HashingStatus()
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
|
||||
private:
|
||||
void updateHashingInfo(const QString& s);
|
||||
void handleEvent(std::shared_ptr<const RsEvent> event);
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
ElidedLabel *statusHashing;
|
||||
QLabel *hashloader;
|
||||
|
Loading…
Reference in New Issue
Block a user