diff --git a/src/connectionitem.cpp b/src/connectionitem.cpp index 13973cd8..32f03c46 100644 --- a/src/connectionitem.cpp +++ b/src/connectionitem.cpp @@ -10,6 +10,7 @@ ConnectionItem::ConnectionItem(Connection *_con, QObject *parent) : con->setParent(this); connect(con, &Connection::stateChanged, this, &ConnectionItem::onConnectionStateChanged); connect(con, &Connection::stateChanged, this, &ConnectionItem::stateChanged); + connect(con, &Connection::dataUsageChanged, this, &ConnectionItem::dataUsageChanged); connect(con, &Connection::latencyAvailable, this, &ConnectionItem::onConnectionPingFinished); connect(con, &Connection::latencyAvailable, this, &ConnectionItem::latencyChanged); connect(con, &Connection::startFailed, this, &ConnectionItem::onStartFailed); diff --git a/src/connectionitem.h b/src/connectionitem.h index 7610ed50..f2c27f5e 100644 --- a/src/connectionitem.h +++ b/src/connectionitem.h @@ -39,6 +39,7 @@ class ConnectionItem : public QObject signals: void message(const QString&); void stateChanged(bool); + void dataUsageChanged(const quint64 ¤t, const quint64 &total); void latencyChanged(); private: diff --git a/src/connectiontablemodel.cpp b/src/connectiontablemodel.cpp index 16ef3225..fcc13be3 100644 --- a/src/connectiontablemodel.cpp +++ b/src/connectiontablemodel.cpp @@ -106,6 +106,7 @@ bool ConnectionTableModel::appendConnection(Connection *con, const QModelIndex & connect(newItem, &ConnectionItem::message, this, &ConnectionTableModel::message); connect(newItem, &ConnectionItem::stateChanged, this, &ConnectionTableModel::onConnectionStateChanged); connect(newItem, &ConnectionItem::latencyChanged, this, &ConnectionTableModel::onConnectionLatencyChanged); + connect(newItem, &ConnectionItem::dataUsageChanged, this, &ConnectionTableModel::onConnectionDataUsageChanged); beginInsertRows(parent, items.count(), items.count()); items.append(newItem); endInsertRows(); @@ -149,3 +150,10 @@ void ConnectionTableModel::onConnectionLatencyChanged() int row = items.indexOf(item); emit dataChanged(this->index(row, 3), this->index(row, 3)); } + +void ConnectionTableModel::onConnectionDataUsageChanged() +{ + ConnectionItem *item = qobject_cast(sender()); + int row = items.indexOf(item); + emit dataChanged(this->index(row, 5), this->index(row, 6)); +} \ No newline at end of file diff --git a/src/connectiontablemodel.h b/src/connectiontablemodel.h index 374fd164..da45659e 100644 --- a/src/connectiontablemodel.h +++ b/src/connectiontablemodel.h @@ -58,6 +58,7 @@ public slots: private slots: void onConnectionStateChanged(bool running); void onConnectionLatencyChanged(); + void onConnectionDataUsageChanged(); }; #endif // CONNECTIONTABLEMODEL_H