etc/rtt: UPSERT node_update_verified; gui: account delegate (rtt+nat subline), context menu member props (admin/supernode), cleanOrphanedPeers, refreshRtt timer 2s
This commit is contained in:
1 parent
c367144776
commit
090acc1f00
14 files changed
+496
-32
No files matched your search
@@ -1,5 +1,7 @@
|
||||
#include "accountlist.h"
|
||||
#include "accountdelegate.h"
|
||||
#include "memberlistmodel.h"
|
||||
#include "memberpropsdialog.h"
|
||||
#include "../db/db_manager.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
@@ -52,11 +54,13 @@ AccountList::AccountList(DbManager* db, QWidget *parent)
|
||||
layout->addWidget(header);
|
||||
|
||||
m_listView->setModel(m_model);
|
||||
m_listView->setItemDelegate(new AccountDelegate(m_listView));
|
||||
m_listView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
m_listView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
m_listView->setIconSize(QSize(24, 24));
|
||||
m_listView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_listView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
m_listView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
layout->addWidget(m_listView, 3);
|
||||
|
||||
m_detailText = new QPlainTextEdit(this);
|
||||
@@ -69,6 +73,13 @@ AccountList::AccountList(DbManager* db, QWidget *parent)
|
||||
layout->addWidget(m_detailText, 2);
|
||||
|
||||
connect(m_listView, &QListView::clicked, this, &AccountList::onMemberClicked);
|
||||
|
||||
m_refreshTimer = new QTimer(this);
|
||||
m_refreshTimer->start(2000);
|
||||
connect(m_refreshTimer, &QTimer::timeout, m_model, &MemberListModel::refreshRtt);
|
||||
|
||||
connect(m_listView, &QWidget::customContextMenuRequested,
|
||||
this, &AccountList::onMemberContextMenu);
|
||||
}
|
||||
|
||||
void AccountList::setChannel(const QString& channelId) {
|
||||
@@ -153,3 +164,21 @@ void AccountList::showMemberDetail(quint64 nodeId) {
|
||||
|
||||
m_detailText->setPlainText(text);
|
||||
}
|
||||
|
||||
void AccountList::onMemberContextMenu(const QPoint& pos) {
|
||||
QModelIndex index = m_listView->indexAt(pos);
|
||||
if (!index.isValid()) return;
|
||||
|
||||
quint64 nodeId = m_model->nodeIdAt(index.row());
|
||||
if (!nodeId) return;
|
||||
|
||||
QString name = m_model->data(index, Qt::DisplayRole).toString();
|
||||
|
||||
QMenu menu(m_listView);
|
||||
QAction* editAction = menu.addAction("Edit");
|
||||
QAction* chosen = menu.exec(m_listView->viewport()->mapToGlobal(pos));
|
||||
if (chosen != editAction) return;
|
||||
|
||||
MemberPropsDialog dlg(m_db, m_channelId, nodeId, name, this);
|
||||
dlg.exec();
|
||||
}
|
||||
Reference in new issue
Block a user