using new notification system for connection attempts

This commit is contained in:
csoler 2019-12-02 20:53:51 +01:00
parent d8569d813c
commit 65fa54c206
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
13 changed files with 127 additions and 131 deletions

View file

@ -176,6 +176,8 @@ NewFriendList::NewFriendList(QWidget *parent) : /* RsAutoUpdatePage(5000,parent)
ui->filterLineEdit->setPlaceholderText(tr("Search")) ;
ui->filterLineEdit->showFilterIcon();
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId );
mModel = new RsFriendListModel();
mProxyModel = new FriendListSortFilterProxyModel(ui->peerTreeWidget->header(),this);
@ -236,8 +238,6 @@ NewFriendList::NewFriendList(QWidget *parent) : /* RsAutoUpdatePage(5000,parent)
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()) , this, SLOT(forceUpdateDisplay()),Qt::QueuedConnection);
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)) , this, SLOT(forceUpdateDisplay()),Qt::QueuedConnection);
connect(NotifyQt::getInstance(), SIGNAL(peerConnected(const QString&)) , this, SLOT(forceUpdateDisplay()),Qt::QueuedConnection);
connect(NotifyQt::getInstance(), SIGNAL(peerDisconnected(const QString&)), this, SLOT(forceUpdateDisplay()),Qt::QueuedConnection);
connect(ui->actionShowOfflineFriends, SIGNAL(triggered(bool)), this, SLOT(setShowUnconnected(bool)));
connect(ui->actionShowState, SIGNAL(triggered(bool)), this, SLOT(setShowState(bool)) );
@ -254,6 +254,12 @@ NewFriendList::NewFriendList(QWidget *parent) : /* RsAutoUpdatePage(5000,parent)
}
void NewFriendList::handleEvent(std::shared_ptr<const RsEvent> e)
{
if(dynamic_cast<const RsConnectionEvent*>(e.get()) != nullptr)
forceUpdateDisplay();
}
NewFriendList::~NewFriendList()
{
delete ui;

View file

@ -95,6 +95,7 @@ private slots:
protected:
void changeEvent(QEvent *e);
void handleEvent(std::shared_ptr<const RsEvent> e);
private:
Ui::NewFriendList *ui;
@ -117,6 +118,7 @@ private:
// Settings for peer list display
bool mShowState;
RsEventsHandlerId_t mEventHandlerId;
std::set<RsNodeGroupId> openGroups;
std::set<RsPgpId> openPeers;