Browse Source

Add peer port column to PeerListWidget. Closes #1650.

adaptive-webui-19844
Ivanov Juriy 10 years ago committed by jurivan
parent
commit
d5f372fae8
  1. 2
      src/properties/peerlistdelegate.h
  2. 3
      src/properties/peerlistwidget.cpp

2
src/properties/peerlistdelegate.h

@ -39,7 +39,7 @@ class PeerListDelegate: public QItemDelegate { @@ -39,7 +39,7 @@ class PeerListDelegate: public QItemDelegate {
Q_OBJECT
public:
enum PeerListColumns {COUNTRY, IP, CONNECTION, FLAGS, CLIENT, PROGRESS, DOWN_SPEED, UP_SPEED,
enum PeerListColumns {COUNTRY, IP, PORT, CONNECTION, FLAGS, CLIENT, PROGRESS, DOWN_SPEED, UP_SPEED,
TOT_DOWN, TOT_UP, IP_HIDDEN, COL_COUNT};
public:

3
src/properties/peerlistwidget.cpp

@ -62,6 +62,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent): @@ -62,6 +62,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent):
m_listModel = new QStandardItemModel(0, PeerListDelegate::COL_COUNT);
m_listModel->setHeaderData(PeerListDelegate::COUNTRY, Qt::Horizontal, QVariant()); // Country flag column
m_listModel->setHeaderData(PeerListDelegate::IP, Qt::Horizontal, tr("IP"));
m_listModel->setHeaderData(PeerListDelegate::PORT, Qt::Horizontal, tr("Port"));
m_listModel->setHeaderData(PeerListDelegate::FLAGS, Qt::Horizontal, tr("Flags"));
m_listModel->setHeaderData(PeerListDelegate::CONNECTION, Qt::Horizontal, tr("Connection"));
m_listModel->setHeaderData(PeerListDelegate::CLIENT, Qt::Horizontal, tr("Client", "i.e.: Client application"));
@ -371,6 +372,7 @@ QStandardItem* PeerListWidget::addPeer(const QString& ip, const peer_info& peer) @@ -371,6 +372,7 @@ QStandardItem* PeerListWidget::addPeer(const QString& ip, const peer_info& peer)
m_listModel->insertRow(row);
m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip);
m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip, Qt::ToolTipRole);
m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), QString::number(peer.ip.port()));
m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP_HIDDEN), ip);
if (m_displayFlags) {
const QIcon ico = GeoIPManager::CountryISOCodeToIcon(peer.country);
@ -411,6 +413,7 @@ void PeerListWidget::updatePeer(const QString& ip, const peer_info& peer) { @@ -411,6 +413,7 @@ void PeerListWidget::updatePeer(const QString& ip, const peer_info& peer) {
m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), getConnectionString(peer));
QString flags, tooltip;
getFlags(peer, flags, tooltip);
m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), QString::number(peer.ip.port()));
m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), flags);
m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), tooltip, Qt::ToolTipRole);
m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), misc::toQStringU(peer.client));

Loading…
Cancel
Save