void RoutingStatsScene::add(uint32_t nodeId, qreal time, QString rt) { if(m_nodeIdTimeValues.find(nodeId) == m_nodeIdTimeValues.end()) { TimeValue <QString> tv; tv.add(time, rt); m_nodeIdTimeValues[nodeId] = tv; addToProxyWidgetsMap(nodeId, "", rt); return; } TimeValue <QString> & tv = m_nodeIdTimeValues[nodeId]; tv.add(time, rt); }
void InterfaceStatsScene::add (uint32_t nodeId, QString pointADescription, uint32_t otherNodeId, QString pointBDescription, QString linkDescription) { if (!StatsMode::getInstance ()->isNodeActive (nodeId)) { return; } if (!pointADescription.contains ("~")) { return; } showInfoWidget (false); QStringList parts = pointADescription.split ('~'); //qDebug (pointADescription); QString IP = parts.at (0); //qDebug (IP); QString MAC = parts.at (1); QString otherIP = ""; QString otherMAC = ""; if (pointBDescription != "") { parts = pointBDescription.split ('~'); otherIP = parts.at (0); otherMAC = parts.at (1); } QString title = "Node:" + QString::number (nodeId); QString content = "IP:" + IP ; content += "\nMAC:" + MAC ; if (pointBDescription != "") { content += "\nOther Node:" + QString::number (otherNodeId) ; content += "\nOther IP:" + otherIP; content += "\nOther MAC:" + otherMAC; content += "\nInfo:" + linkDescription; } TextBubble * tb = new TextBubble (title, content); QGraphicsProxyWidget * pw = addWidget (tb); QFont f (tb->font ()); f.setPointSizeF (StatsMode::getInstance ()->getCurrentFontSize ()); tb->setFont (f); QFontMetrics fm (f); pw->setMaximumHeight (fm.height () * tb->text ().count ("\n")); addToProxyWidgetsMap (nodeId, pw); qreal newX = m_lastX + pw->widget ()->width (); m_currentMaxHeight = qMax (m_currentMaxHeight, pw->size ().height ()); if (newX >= sceneRect ().right ()) { m_lastX = 0; m_lastY += m_currentMaxHeight + INTERSTATS_SPACE; m_currentMaxHeight = 0; } pw->setPos (m_lastX, m_lastY); m_lastX = pw->pos ().x () + pw->widget ()->width () + INTERSTATS_SPACE; m_lastY = pw->pos ().y (); m_bottomY = m_lastY + m_currentMaxHeight; //qDebug (QString ("Last X" + QString::number (m_lastX) + " w:" + QString::number (pw->widget ()->width ()))); adjustRect (); }