ahbdevicelist.cpp
74 lines
| 3.0 KiB
| text/x-c
|
CppLexer
r0 | /*------------------------------------------------------------------------------ | |||
Jeandet Alexis
|
r4 | -- This file is a part of the SocExplorer Software | ||
r0 | -- 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 "ahbdevicelist.h" | ||||
ahbdevicelist::ahbdevicelist(QWidget *parent):QTableWidget(parent) | ||||
{ | ||||
this->setColumnCount(7); | ||||
this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("BAR1")<<tr("BAR2")<<tr("BAR3")<<tr("Vendor ID")<<tr("Product ID")); | ||||
} | ||||
void ahbdevicelist::clearAHBdevicesList() | ||||
{ | ||||
this->clear(); | ||||
this->setRowCount(0); | ||||
this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("BAR1")<<tr("BAR2")<<tr("BAR3")<<tr("Vendor ID")<<tr("Product ID")); | ||||
} | ||||
void ahbdevicelist::addAHBdevice(ahbdeviceInfo* device) | ||||
{ | ||||
if(this->rowCount()==0) | ||||
{ | ||||
this->setRowCount(1); | ||||
} | ||||
else | ||||
{ | ||||
this->insertRow(this->rowCount()); | ||||
} | ||||
this->ahbdevices.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<4;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, 5, newItem); | ||||
newItem = new QTableWidgetItem("0x" + QString::number(device->PID , 16)); | ||||
newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); | ||||
this->setItem(this->rowCount()-1, 6, newItem); | ||||
this->resizeColumnsToContents(); | ||||
} | ||||