mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-17 01:24:15 -05:00
removed groupsChanged and used rsEvents::FRIEND_LIST instead
This commit is contained in:
parent
df02d745d8
commit
0ce2dd8486
19 changed files with 106 additions and 23 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include "GroupSelectionBox.h"
|
||||
#include "GroupDefs.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
|
@ -34,11 +35,40 @@ GroupSelectionBox::GroupSelectionBox(QWidget *parent)
|
|||
{
|
||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(fillGroups()));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(fillGroups()));
|
||||
|
||||
mEventHandlerId = 0;
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=]()
|
||||
{
|
||||
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||
|
||||
if(!fe)
|
||||
return;
|
||||
|
||||
switch(fe->mEventCode)
|
||||
{
|
||||
case RsFriendListEventCode::GROUP_ADDED:
|
||||
case RsFriendListEventCode::GROUP_REMOVED:
|
||||
case RsFriendListEventCode::GROUP_CHANGED: fillGroups();
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
, this );
|
||||
}, mEventHandlerId, RsEventType::FRIEND_LIST );
|
||||
|
||||
// Fill with available groups
|
||||
fillGroups();
|
||||
}
|
||||
|
||||
GroupSelectionBox::~GroupSelectionBox()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
void GroupSelectionBox::fillGroups()
|
||||
{
|
||||
std::list<RsNodeGroupId> selectedIds;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue