|
|
/*------------------------------------------------------------------------------
|
|
|
-- This file is a part of the LPPMON Software
|
|
|
-- Copyright (C) 2011, Laboratory of Plasmas Physic - CNRS
|
|
|
--
|
|
|
-- This program is free software; you can redistribute it and/or modify
|
|
|
-- it under the terms of the GNU General Public License as published by
|
|
|
-- the Free Software Foundation; either version 3 of the License, or
|
|
|
-- (at your option) any later version.
|
|
|
--
|
|
|
-- This program is distributed in the hope that it will be useful,
|
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
-- GNU General Public License for more details.
|
|
|
--
|
|
|
-- You should have received a copy of the GNU General Public License
|
|
|
-- along with this program; if not, write to the Free Software
|
|
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
-------------------------------------------------------------------------------*/
|
|
|
/*-- Author : Alexis Jeandet
|
|
|
-- Mail : alexis.jeandet@lpp.polytechnique.fr
|
|
|
----------------------------------------------------------------------------*/
|
|
|
#include "apbdevicelist.h"
|
|
|
|
|
|
|
|
|
|
|
|
apbdevicelist::apbdevicelist(QWidget *parent):QTableWidget(parent)
|
|
|
{
|
|
|
this->setColumnCount(4);
|
|
|
this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("Vendor ID")<<tr("Product ID"));
|
|
|
}
|
|
|
|
|
|
void apbdevicelist::clearAPBdevicesList()
|
|
|
{
|
|
|
this->clear();
|
|
|
this->setRowCount(0);
|
|
|
this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("Vendor ID")<<tr("Product ID"));
|
|
|
}
|
|
|
|
|
|
void apbdevicelist::addAPBdevice(apbdeviceInfo* device)
|
|
|
{
|
|
|
if(this->rowCount()==0)
|
|
|
{
|
|
|
this->setRowCount(1);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this->insertRow(this->rowCount());
|
|
|
}
|
|
|
|
|
|
this->apbdevices.append(device);
|
|
|
QTableWidgetItem *newItem = new QTableWidgetItem(device->deviceName);
|
|
|
newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
|
|
|
this->setItem(this->rowCount()-1, 0, newItem);
|
|
|
|
|
|
for(int i=0;i<1;i++)
|
|
|
{
|
|
|
if(device->BAR[i].size!=0)
|
|
|
{
|
|
|
newItem = new QTableWidgetItem("0x" + QString::number(device->BAR[i].address, 16)+" -> 0x"+ QString::number(device->BAR[i].address + device->BAR[i].size-1, 16)+" size = "+device->barAdressSize(i));
|
|
|
newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
|
|
|
this->setItem(this->rowCount()-1, i+1, newItem);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
newItem = new QTableWidgetItem("0x" + QString::number(device->VID , 16));
|
|
|
newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
|
|
|
this->setItem(this->rowCount()-1, 2, newItem);
|
|
|
newItem = new QTableWidgetItem("0x" + QString::number(device->PID , 16));
|
|
|
newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
|
|
|
this->setItem(this->rowCount()-1, 3, newItem);
|
|
|
this->resizeColumnsToContents();
|
|
|
|
|
|
}
|
|
|
|