#include "regsexplorer.h" #include "socmodel.h" regsExplorer::regsExplorer(QWidget *parent) : QDockWidget(parent) { mainWidget = new QTabWidget; cfg = new regsExplorerCfg; socViewer = new SocRegsViewerNew(tr("No soc Detected"),this); this->setWidget(this->mainWidget); this->mainWidget->addTab(this->cfg,"Config"); this->mainWidget->addTab(this->socViewer,"View"); this->setWindowTitle(tr("Regs Explorer")); connect(SocExplorerEngine::self(),SIGNAL(enumDeviceAdded(socExplorerEnumDevice*)),this,SLOT(addDev(socExplorerEnumDevice*))); } void regsExplorer::addDev(socExplorerEnumDevice *device) { delegate.device = device; peripheralWidget* peripheral=new peripheralWidget(device->name(),device->baseAddress(),&delegate,this); this->socViewer->addPeripheral(peripheral); peripheralModel periphM=SocExplorerEngine::xmlModel()->getPeripheral(device->name()); int startIndex,stopIndex; QString desc; QString name; bool rw; for(int i=0;iaddRegister(periphM.registers.at(i).name,device->baseAddress() + periphM.registers.at(i).offset); for(int j=0;jregisterAt(i)->setBitFieldAttribute(startIndex,stopIndex,name,desc,rw); } } // connect(peripheral,SIGNAL(readRegSig(qint32)),device,SLOT(readReg(qint32))); // connect(peripheral,SIGNAL(writeRegSig(qint32,qint32)),device,SLOT(writeReg(qint32,qint32))); // QCheckBox* chkbx = this->cfg->addDev(device); // chkbx->setChecked(true); // connect(chkbx,SIGNAL(toggled(bool)),peripheral,SLOT(setVisible(bool))); }