FlowMonStatsScene::FlowMonStatsScene():QGraphicsScene(100, 0, STATSSCENE_WIDTH_DEFAULT, STATSSCENE_HEIGHT_DEFAULT),
    m_flowProbeWidget(0)
{
    m_infoWidget = addWidget(new TextBubble("Info:", "No data available\nDid you load the XML file?"));
    showInfoWidget();

}
void
RoutingStatsScene::addToProxyWidgetsMap(uint32_t nodeId, QString title, QString content)
{

    if(m_nodeIdProxyWidgets.find(nodeId) == m_nodeIdProxyWidgets.end())
    {
        TextBubble * tb = new TextBubble (title, content);
        QFont f(tb->font());
        f.setPointSizeF(StatsMode::getInstance()->getCurrentFontSize());
        tb->setFont(f);
        QGraphicsProxyWidget * pw = addWidget(tb);


        QFontMetrics fm(f);
        pw->setMaximumHeight(fm.height() * tb->text().count("\n"));
        pw->adjustSize();
        showInfoWidget(false);
        m_nodeIdProxyWidgets[nodeId] = pw;
        qreal newX = m_lastX + pw->widget()->width();
        if(newX >= sceneRect().right())
        {
            m_lastX = 0;
            m_lastY += pw->widget()->height() + INTERSTATS_SPACE;
        }
        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 + pw->widget()->height();
        //qDebug(QString("Last X" + QString::number(m_lastX) + " w:" + QString::number(pw->widget()->width())));
        adjustRect();
        return;
    }

}
Exemplo n.º 3
0
void MainWindow::onResetPassword()
{
	infoWidget->setTitleLabel(tr(PASSWORD_INFO_WIDGET_TITLE));
	infoWidget->setDescriptionLabel(tr(PASSWORD_INFO_WIDGET_TEXT));
	showInfoWidget();

	forgotPasswordWidget->clearData();
}
Exemplo n.º 4
0
InterfaceStatsScene::InterfaceStatsScene ():QGraphicsScene (100, 0, STATSSCENE_WIDTH_DEFAULT, STATSSCENE_HEIGHT_DEFAULT),
  m_dirty (true)
{
  m_lastX = 0;
  m_lastY = 0;
  m_infoWidget = addWidget (new TextBubble ("Info:", "No data available\nDid you load the XML file from the Animator Tab?"));
  showInfoWidget ();
}
RoutingStatsScene::RoutingStatsScene():QGraphicsScene(100, 0, STATSSCENE_WIDTH_DEFAULT, STATSSCENE_HEIGHT_DEFAULT),
    m_dirty(true)
{
    m_lastX = 0;
    m_lastY = 0;
    m_lastTime = -1;
    m_infoWidget = addWidget(new TextBubble("Info:", "No data available\nDid you load the XML file?"));
    showInfoWidget();
}
void
FlowMonStatsScene::systemReset()
{
    m_lastX = 0;
    m_lastY = 0;
    m_bottomY = 0;
    clearProxyWidgetsMap();
    m_flowIdFlowStats.clear();
    m_flowIdIpv4Classifiers.clear();
    showInfoWidget();
}
Exemplo n.º 7
0
void MainWindow::onRegistrationSuccess()
{
	stopWaitingWidget();
	showWelcomeScreen = true;
	
	logonWidget->setLoginAndPassword(registrationWidget->getLogin(), registrationWidget->getPassword());
	infoWidget->setTitleLabel(tr(REGISTERED_INFO_WIDGET_TITLE));
	infoWidget->setDescriptionLabel(tr(REGISTERED_INFO_WIDGET_TEXT).arg(registrationWidget->getLogin()));
	showInfoWidget();

	registrationWidget->clearData();
	inviteCodeWidget->clearData();
}
void
RoutingStatsScene::clearProxyWidgetsMap()
{
    showInfoWidget();
    for(NodeIdProxyWidgetMap_t::const_iterator i = m_nodeIdProxyWidgets.begin();
        i != m_nodeIdProxyWidgets.end();
        ++i)
    {

        removeItem(i->second);
        delete(i->second);

    }
    m_nodeIdProxyWidgets.clear();
}
void
FlowMonStatsScene::addProxyWidgets()
{
    for(FlowIdFlowStatsMap_t::const_iterator i = m_flowIdFlowStats.begin();
        i != m_flowIdFlowStats.end();
        ++i)
    {
        uint32_t flowId = i->first;
        FlowStatsFlow_t flowStats = i->second;
        Ipv4Classifier_t ipv4Classifer = m_flowIdIpv4Classifiers[flowId];
        QString content = ipv4ClassifierToString(ipv4Classifer) + "\n" + flowStatsToString(flowStats);
        TextBubble * tb = new TextBubble("Flow Id:" + QString::number(flowId) + "\n======", content);
        m_flowIdProxyWidgets[flowId] = addWidget(tb);
        showInfoWidget(false);
    }
    if(m_flowProbes.empty())
    {
        return;
    }

    QString str;
    uint32_t probeIndex = 0;
    for(FlowProbes_t::const_iterator i = m_flowProbes.begin();
        i != m_flowProbes.end();
        ++i, ++probeIndex)
    {
        str += "\nIndex:" + QString::number(probeIndex) + "\n";
        FlowProbe_t probe = *i;
        for(FlowProbe_t::const_iterator j = probe.begin();
            j != probe.end();
            ++j)
        {
            FlowProbeFlowStats_t flowStat = *j;
            str += " FlowId:" + QString::number(flowStat.flowId);
            str += " Packets:" + QString::number(flowStat.packets);
            str += " Bytes:" + QString::number(flowStat.bytes);
            str += " DelayFromFirstProbeSum:" + QString::number(flowStat.delayFromFirstProbeSum) + "ns";
            str += "\n";
        }

    }
    TextBubble * tb = new TextBubble("Flow Probes:", str);
    m_flowProbeWidget = addWidget(tb);


}
Exemplo n.º 10
0
void
InterfaceStatsScene::clearProxyWidgetsMap ()
{
  showInfoWidget ();
  for (NodeIdProxyWidgetVectorMap_t::const_iterator i = m_nodeIdProxyWidgets.begin ();
      i != m_nodeIdProxyWidgets.end ();
      ++i)
    {
      ProxyWidgetVector_t v = i->second;
      for (ProxyWidgetVector_t::const_iterator j = v.begin ();
          j != v.end ();
          ++j)
        {
          removeItem (*j);
          delete (*j);
        }
      v.clear ();
    }
  m_nodeIdProxyWidgets.clear ();
}
Exemplo n.º 11
0
void TupGraphicsScene::addSvgObject(TupSvgItem *svgItem, double opacity)
{
    #ifdef K_DEBUG
           T_FUNCINFO;
    #endif

    if (svgItem) {

        k->onionSkin.opacityMap.insert(svgItem, opacity);
        svgItem->setSelected(false);

        TupLayer *layer = k->scene->layer(k->framePosition.layer);

        if (layer) {

            TupFrame *frame = layer->frame(k->framePosition.frame);

            if (frame) {
                svgItem->setOpacity(opacity);

                if (svgItem->symbolName().compare("dollar.svg")==0)
                    connect(svgItem, SIGNAL(enabledChanged()), this, SIGNAL(showInfoWidget()));

                addItem(svgItem);
            } else {
                #ifdef K_DEBUG
                       tFatal() << "TupGraphicsScene::addSvgObject() - Error: Frame #" << k->framePosition.frame << " NO available!";
                #endif
            }
        } else {
                #ifdef K_DEBUG
                       tFatal() << "TupGraphicsScene::addSvgObject() - Error: Layer #" << k->framePosition.layer << " NO available!";
                #endif
        }

    } else {
        #ifdef K_DEBUG
               tFatal() << "TupGraphicsScene::addSvgObject() - Error: No SVG item!";
        #endif
    } 
} 
Exemplo n.º 12
0
int SMEngine::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: showMe(); break;
        case 1: setLabel((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 2: setWidget((*reinterpret_cast< QWidget*(*)>(_a[1]))); break;
        case 3: setLayout((*reinterpret_cast< QLayout*(*)>(_a[1]))); break;
        case 4: breakIsOver(); break;
        case 5: yesClicked(); break;
        case 6: noClicked(); break;
        case 7: confirnClicked(); break;
        case 8: skipClicked(); break;
        case 9: createGuiWithList((*reinterpret_cast< QList<QMap<QString,QString> >*(*)>(_a[1]))); break;
        case 10: createInputGuiWithDataSet((*reinterpret_cast< QMap<QString,QString>(*)>(_a[1]))); break;
        case 11: repaintGui(); break;
        case 12: changeWidget((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break;
        case 13: changeWidget((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 14: parseXMLFile((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 15: showInfoWidget((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 16: showInputWidget(); break;
        case 17: addLayout(); break;
        case 18: addWidgetToLayout((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break;
        case 19: addWidgetToLayout((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 20: toggleFirstUse((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 21: finished(); break;
        case 22: executeSpec((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 23: acceptButton(); break;
        case 24: saveToDom((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 25: timeOut(); break;
        case 26: emitClickSignal((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 27;
    }
    return _id;
}
void
FlowMonStatsScene::clearProxyWidgetsMap()
{
    showInfoWidget();
    for(FlowIdProxyWidgetMap_t::const_iterator i = m_flowIdProxyWidgets.begin();
        i != m_flowIdProxyWidgets.end();
        ++i)
    {
        removeItem(i->second);
        delete(i->second);
    }
    m_flowIdProxyWidgets.clear();
    m_flowProbes.clear();
    if(m_flowProbeWidget)
    {
        removeItem(m_flowProbeWidget);
        delete(m_flowProbeWidget);
        m_flowProbeWidget = 0;
    }
    m_flowIdFlowStats.clear();
    m_flowIdIpv4Classifiers.clear();
}
Exemplo n.º 14
0
int MoodBox::MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: onUserAccountUpdated(); break;
        case 1: onUserStatusChanged((*reinterpret_cast< UserStatus::UserStatusEnum(*)>(_a[1]))); break;
        case 2: onServerError((*reinterpret_cast< ServerResponseHandler::ServerError(*)>(_a[1]))); break;
        case 3: onShowExceptionDialogSendingMessage((*reinterpret_cast< ContactResultCode::ContactResultCodeEnum(*)>(_a[1])),(*reinterpret_cast< qint32(*)>(_a[2]))); break;
        case 4: onLogonStarted(); break;
        case 5: onLogonStopped(); break;
        case 6: onLogonSuccess(); break;
        case 7: showWindow(); break;
        case 8: shutDown(); break;
        case 9: onLogoutCompleted(); break;
        case 10: relogon(); break;
        case 11: offline((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 12: offline(); break;
        case 13: { bool _r = logout((*reinterpret_cast< bool(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 14: { bool _r = logout();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 15: showSettings(); break;
        case 16: ipcMessage((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 17: addFriendByLogin(); break;
        case 18: forceQuit(); break;
        case 19: onTrayIconActivated((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break;
        case 20: on_contactListButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 21: on_drawButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 22: on_historyButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 23: onDownloadNewVersion(); break;
        case 24: onInviteCodeAccepted(); break;
        case 25: onRegistrationSuccess(); break;
        case 26: onResetPassword(); break;
        case 27: onShowClipart(); break;
        case 28: onReply((*reinterpret_cast< const QImage(*)>(_a[1]))); break;
        case 29: showTvWidget(); break;
        case 30: showLogonWidget((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 31: showLogonWidget(); break;
        case 32: showInviteCodeWidget(); break;
        case 33: showRegistrationWidget(); break;
        case 34: showForgotPasswordWidget(); break;
        case 35: showInfoWidget(); break;
        case 36: showWaitingWidget(); break;
        case 37: stopWaitingWidget(); break;
        case 38: hideWaitingWidget(); break;
        case 39: cancelWaitingWidget(); break;
        case 40: onRegistrationBack(); break;
        case 41: onInviteCodeNeeded(); break;
        case 42: onContactSelected((*reinterpret_cast< qint32(*)>(_a[1]))); break;
        case 43: onContactImageDrop((*reinterpret_cast< qint32(*)>(_a[1])),(*reinterpret_cast< const QImage(*)>(_a[2]))); break;
        case 44: onSoundStateChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 45: onPrivateMessageReceived((*reinterpret_cast< qint32(*)>(_a[1])),(*reinterpret_cast< const MessageKey(*)>(_a[2]))); break;
        case 46: onChannelMessageReceived((*reinterpret_cast< qint32(*)>(_a[1])),(*reinterpret_cast< const MessageKey(*)>(_a[2]))); break;
        case 47: onFriendsMessageReceived((*reinterpret_cast< const MessageKey(*)>(_a[1]))); break;
        case 48: onMessageSent(); break;
        case 49: showHelp(); break;
        case 50: requestFinished((*reinterpret_cast< QNetworkReply*(*)>(_a[1]))); break;
        case 51: dataProcessedProgress((*reinterpret_cast< qint64(*)>(_a[1])),(*reinterpret_cast< qint64(*)>(_a[2]))); break;
        case 52: cancelHttpRequest(); break;
        default: ;
        }
        _id -= 53;
    }
    return _id;
}
Exemplo n.º 15
0
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 ();

}
Exemplo n.º 16
0
void
InterfaceStatsScene::reloadContent (bool force)
{
  if (!m_dirty && !force)
    {
      return;
    }
  m_lastX = 0;
  m_lastY = 0;
  m_bottomY = 0;
  clearProxyWidgetsMap ();

  typedef std::vector <LinkProperty_t> LinkPropertyVector_t;
  typedef std::map <uint32_t, LinkPropertyVector_t> NodeIdLinkPropertyMap_t;

  NodeIdLinkPropertyMap_t flatMap ;
  for (LinkManager::NodeIdAnimLinkVectorMap_t::const_iterator i = LinkManager::getInstance ()->getLinks ()->begin ();
       i != LinkManager::getInstance ()->getLinks ()->end ();
       ++i) // 1
    {

      LinkManager::AnimLinkVector_t v = i->second;
      for (LinkManager::AnimLinkVector_t::const_iterator j = v.begin ();
          j != v.end ();
          ++j)
        {
          m_dirty = false;
          showInfoWidget (false);
          AnimLink * pLink = *j;
          LinkProperty_t link = {pLink->m_toId, "", "", ""};
          LinkProperty_t reverseLink = {i->first, "", "", ""};

          if (pLink->m_pointADescription)
            {
              link.pointADescription = *pLink->m_pointADescription;
              reverseLink.pointBDescription = *pLink->m_pointADescription;
            }
          if (pLink->m_pointBDescription)
            {
              link.pointBDescription = *pLink->m_pointBDescription;
              reverseLink.pointADescription = *pLink->m_pointBDescription;
            }
          if (pLink->m_currentLinkDescription)
            {
              link.linkDescription = *pLink->m_currentLinkDescription;
              reverseLink.linkDescription = *pLink->m_currentLinkDescription;
            }

          if (flatMap.find (i->first) == flatMap.end ())
            {
              LinkPropertyVector_t lpv;
              lpv.push_back (link);
              flatMap[i->first] = lpv;
            }
          else
            {
              LinkPropertyVector_t & lpv = flatMap[i->first];
              lpv.push_back (link);
            }
          if (pLink->m_toId == i->first)
            {
              continue;  //Wireless
            }

          if (flatMap.find (pLink->m_toId) == flatMap.end ())
            {
              LinkPropertyVector_t lpv;
              lpv.push_back (reverseLink);
              flatMap[pLink->m_toId] = lpv;
            }
          else
            {
              LinkPropertyVector_t & lpv = flatMap[pLink->m_toId];
              lpv.push_back (reverseLink);
            }
        }

    } // 1


  for (NodeIdLinkPropertyMap_t::const_iterator i = flatMap.begin ();
      i != flatMap.end ();
      ++i)
    {
      uint32_t fromNodeId = i->first;
      LinkPropertyVector_t lpv = i->second;
      for (LinkPropertyVector_t::const_iterator j = lpv.begin ();
          j != lpv.end ();
          ++j)
        {
          LinkProperty_t lp = *j;
          //qDebug (QString::number (fromNodeId) + ":" +QString::number (lp.toId) + ":" + lp.pointADescription + lp.pointBDescription + lp.linkDescription);
          InterfaceStatsScene::getInstance ()->add (fromNodeId, lp.pointADescription, lp.toId, lp.pointBDescription, lp.linkDescription);
        }

    }

}