void OverviewThreadsWidget::FillRow(int pRow, ProcessStatistic *pStats)
{
	ThreadStatisticDescriptor tStatValues = pStats->GetThreadStatistic();

	int tScaleFactor = 1;
	if (mScaleToOneCpuCore)
	    tScaleFactor = mCpuCores;

	if (pRow > mTwThreads->rowCount() - 1)
        mTwThreads->insertRow(mTwThreads->rowCount());

    if (mTwThreads->item(pRow, 0) != NULL)
        mTwThreads->item(pRow, 0)->setText(QString(pStats->GetThreadName().c_str()));
    else
        mTwThreads->setItem(pRow, 0, new QTableWidgetItem(QString(pStats->GetThreadName().c_str())));
    mTwThreads->item(pRow, 0)->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
    mTwThreads->item(pRow, 0)->setBackground(QBrush(QColor(Qt::lightGray)));

    FillCellText(pRow, 1, QString("%1").arg(tStatValues.Tid));
    FillCellText(pRow, 2, QString("%1").arg(tStatValues.Pid));
    FillCellText(pRow, 3, QString("%1").arg(tStatValues.PPid));
    FillCellText(pRow, 4, QString("%1").arg(tStatValues.ThreadCount));
    FillCellText(pRow, 5, QString("%1").arg(tStatValues.PriorityBase));
    FillCellText(pRow, 6, QString("%1").arg(tStatValues.Priority));
    FillCellText(pRow, 7, Int2ByteExpression(tStatValues.MemVirtual) + " bytes");
    FillCellText(pRow, 8, Int2ByteExpression(tStatValues.MemPhysical) + " bytes");
    FillCellText(pRow, 9, Int2ByteExpression(tStatValues.MemAllocs) + " bytes");
    FillCellText(pRow, 10, QString("%1 %").arg(tStatValues.LoadUser * tScaleFactor, 0, 'f', 2));
    FillCellText(pRow, 11, QString("%1 %").arg(tStatValues.LoadSystem * tScaleFactor, 0, 'f', 2));
    FillCellText(pRow, 12, QString("%1 %").arg(tStatValues.LoadTotal * tScaleFactor, 0, 'f', 2));
    FillCellText(pRow, 13, QString("%1").arg(pRow));
}
void OverviewDataStreamsWidget::FillRow(QTableWidget *pTable, int pRow, PacketStatistic *pStats)
{
	if (pStats == NULL)
		return;

	PacketStatisticDescriptor tStatValues = pStats->GetPacketStatistic();

	if (pRow > pTable->rowCount() - 1)
        pTable->insertRow(pTable->rowCount());

    if (pTable->item(pRow, 0) != NULL)
        pTable->item(pRow, 0)->setText(QString(pStats->GetStreamName().c_str()));
    else
        pTable->setItem(pRow, 0, new QTableWidgetItem(QString(pStats->GetStreamName().c_str())));
    pTable->item(pRow, 0)->setBackground(QBrush(QColor(Qt::lightGray)));

    FillCellText(pTable, pRow, 1, Int2ByteExpression(tStatValues.MinPacketSize) + " bytes");
    FillCellText(pTable, pRow, 2, Int2ByteExpression(tStatValues.MaxPacketSize) + " bytes");
    FillCellText(pTable, pRow, 3, Int2ByteExpression(tStatValues.AvgPacketSize) + " bytes");
    FillCellText(pTable, pRow, 4, Int2ByteExpression(tStatValues.ByteCount) + " bytes");
    FillCellText(pTable, pRow, 5, Int2ByteExpression(tStatValues.PacketCount));
    FillCellText(pTable, pRow, 6, Int2ByteExpression(tStatValues.LostPacketCount));
    FillCellText(pTable, pRow, 8, QString(pStats->GetTransportTypeStr().c_str()));
    pTable->item(pRow, 8)->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
    FillCellText(pTable, pRow, 9, QString(pStats->GetNetworkTypeStr().c_str()));
    pTable->item(pRow, 9)->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
    FillCellText(pTable, pRow, 10, Int2ByteExpression(tStatValues.MomentAvgDataRate) + " bytes/s");
    FillCellText(pTable, pRow, 11, Int2ByteExpression(tStatValues.AvgDataRate) + " bytes/s");
    FillCellText(pTable, pRow, 12, Int2ByteExpression(pRow));

	if (pTable->item(pRow, 7) != NULL)
        if (tStatValues.Outgoing)
            pTable->item(pRow, 7)->setText(QString("outgoing"));
        else
            pTable->item(pRow, 7)->setText(QString("incoming"));
    else if (tStatValues.Outgoing)
        pTable->setItem(pRow, 7, new QTableWidgetItem(QString("outgoing")));
    else
        pTable->setItem(pRow, 7, new QTableWidgetItem(QString("incoming")));
    pTable->item(pRow, 7)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
    QIcon tIcon11;
    if (tStatValues.Outgoing)
        tIcon11.addPixmap(QPixmap(":/images/32_32/ArrowRight.png"), QIcon::Normal, QIcon::Off);
    else
        tIcon11.addPixmap(QPixmap(":/images/32_32/ArrowLeft.png"), QIcon::Normal, QIcon::Off);
    pTable->item(pRow, 7)->setIcon(tIcon11);

}