##// END OF EJS Templates
Fixed test order, on RegsExplorer::addDev, must check pointer before members.
Fixed test order, on RegsExplorer::addDev, must check pointer before members.

File last commit:

r111:f5779f536b0f 0.6
r111:f5779f536b0f 0.6
Show More
regsexplorer.cpp
58 lines | 2.0 KiB | text/x-c | CppLexer
#include "regsexplorer.h"
#include "ui_regsexplorernew.h"
#include "socmodel.h"
RegsExplorer::RegsExplorer(QWidget *parent) :
QDockWidget(parent),
ui(new Ui::RegsExplorerNew)
{
ui->setupUi(this);
connect(SocExplorerEngine::self(),SIGNAL(enumDeviceAdded(socExplorerEnumDevice*)),this,SLOT(addDev(socExplorerEnumDevice*)));
delegate.device=NULL;
}
RegsExplorer::~RegsExplorer()
{
delete ui;
}
void RegsExplorer::addDev(socExplorerEnumDevice *device)
{
if((delegate.device==NULL)||(delegate.device->sameSoc(device)))
{
delegate.device = device;
peripheralWidget* peripheral=new peripheralWidget(device->name(),device->baseAddress(),&delegate,this);
this->ui->regsViewer->addPeripheral(peripheral);
peripheralModel periphM=SocExplorerEngine::xmlModel()->getPeripheral(device->name());
int startIndex,stopIndex;
QString desc;
QString name;
bool rw;
this->ui->regsViewer->setSocName(device->socName());
for(int i=0;i<periphM.registers.count();i++)
{
peripheral->addRegister(periphM.registers.at(i).name,device->baseAddress() + periphM.registers.at(i).offset);
for(int j=0;j<periphM.registers.at(i).bitfields.count();j++)
{
startIndex = periphM.registers.at(i).bitfields.at(j).offset;
stopIndex = periphM.registers.at(i).bitfields.at(j).offset+periphM.registers.at(i).bitfields.at(j).size-1;
desc = periphM.registers.at(i).bitfields.at(j).description;
rw = periphM.registers.at(i).bitfields.at(j).rw;
name = periphM.registers.at(i).bitfields.at(j).name;
peripheral->registerAt(i)->setBitFieldAttribute(startIndex,stopIndex,name,desc,rw);
}
}
}
}
void RegsExplorer::changeEvent(QEvent *e)
{
QDockWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}