mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
This is the gui part of the commit where the wire feed is refreshed if there is any event published.
This commit is contained in:
parent
b543281bb3
commit
dbddf7166f
@ -59,7 +59,7 @@
|
||||
WireDialog::WireDialog(QWidget *parent)
|
||||
: MainPage(parent), mGroupSet(GROUP_SET_ALL)
|
||||
, mAddDialog(nullptr), mGroupSelected(nullptr), mWireQueue(nullptr)
|
||||
, mHistoryIndex(-1)
|
||||
, mHistoryIndex(-1), mEventHandlerId(0)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
@ -89,6 +89,42 @@ WireDialog::WireDialog(QWidget *parent)
|
||||
|
||||
// load settings
|
||||
processSettings(true);
|
||||
|
||||
// Needs to be asynced because this function is called by another thread!
|
||||
rsEvents->registerEventsHandler(
|
||||
[this](std::shared_ptr<const RsEvent> event)
|
||||
{ RsQThreadUtils::postToObject([=]() { handleEvent_main_thread(event); }, this ); },
|
||||
mEventHandlerId, RsEventType::WIRE );
|
||||
}
|
||||
|
||||
void WireDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
const RsWireEvent *e = dynamic_cast<const RsWireEvent*>(event.get());
|
||||
|
||||
if(e)
|
||||
switch(e->mWireEventCode)
|
||||
{
|
||||
case RsWireEventCode::NEW_POST: // [[fallthrough]];
|
||||
refreshGroups();
|
||||
break;
|
||||
case RsWireEventCode::NEW_REPLY: // [[fallthrough]];
|
||||
refreshGroups();
|
||||
break;
|
||||
case RsWireEventCode::NEW_LIKE: // [[fallthrough]];
|
||||
refreshGroups();
|
||||
break;
|
||||
case RsWireEventCode::NEW_REPUBLISH: // [[fallthrough]];
|
||||
refreshGroups();
|
||||
break;
|
||||
case RsWireEventCode::NEW_WIRE: // [[fallthrough]];
|
||||
refreshGroups();
|
||||
break;
|
||||
case RsWireEventCode::FOLLOW_STATUS_CHANGED: // [[fallthrough]];
|
||||
refreshGroups();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
WireDialog::~WireDialog()
|
||||
@ -97,7 +133,9 @@ WireDialog::~WireDialog()
|
||||
processSettings(false);
|
||||
|
||||
clearTwitterView();
|
||||
delete(mWireQueue);
|
||||
delete(mWireQueue);
|
||||
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
|
||||
void WireDialog::processSettings(bool load)
|
||||
|
@ -164,6 +164,9 @@ private:
|
||||
std::map<RsGxsGroupId, RsWireGroup> mAllGroups;
|
||||
std::vector<RsWireGroup> mOwnGroups;
|
||||
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
|
||||
int32_t mHistoryIndex;
|
||||
std::vector<WireViewHistory> mHistory;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user