Fix JSON API event handler registering behavior

As a bonus the behaviour is now homogeneous between C++ API and JSON API
Fix a bunch of compiler warning
RsEvents implementation is now safer
mHandlerMaps size is known at compile time, so use an std::array instead
  of vector
This commit is contained in:
Gioacchino Mazzurco 2020-04-01 19:34:49 +02:00
parent ce5f5faa97
commit 4c0baa1ec3
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
17 changed files with 165 additions and 139 deletions

View file

@ -38,14 +38,15 @@ public:
};
/** Constructor */
GxsForumsDialog::GxsForumsDialog(QWidget *parent)
: GxsGroupFrameDialog(rsGxsForums, parent)
GxsForumsDialog::GxsForumsDialog(QWidget *parent) :
GxsGroupFrameDialog(rsGxsForums, parent), mEventHandlerId(0)
{
mCountChildMsgs = true;
mEventHandlerId = 0;
// Needs to be asynced because this function is likely to be called by another thread!
rsEvents->registerEventsHandler(RsEventType::GXS_FORUMS, [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [=]() { handleEvent_main_thread(event); }, this ); }, mEventHandlerId );
rsEvents->registerEventsHandler(
[this](std::shared_ptr<const RsEvent> event)
{ RsQThreadUtils::postToObject( [=]() { handleEvent_main_thread(event); }, this ); },
mEventHandlerId, RsEventType::GXS_FORUMS );
}
void GxsForumsDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)