qeditor: add soc panel, to display soc information
Change-Id: Ie442b82d96fb150c7466f1a274240f9b111fd91e
This commit is contained in:
parent
3daa6d64f6
commit
ef0299c62e
4 changed files with 92 additions and 6 deletions
|
@ -16,6 +16,40 @@ QByteArray RegItemEditorCreator::valuePropertyName () const
|
|||
return QByteArray("text");
|
||||
}
|
||||
|
||||
/**
|
||||
* SocDisplayPanel
|
||||
*/
|
||||
SocDisplayPanel::SocDisplayPanel(QWidget *parent, const SocRef& dev_ref)
|
||||
:QGroupBox(parent), m_soc(dev_ref)
|
||||
{
|
||||
QVBoxLayout *right_layout = new QVBoxLayout;
|
||||
|
||||
m_name = new QLabel(this);
|
||||
m_name->setTextFormat(Qt::RichText);
|
||||
m_name->setText("<h1>" + QString::fromStdString(m_soc.GetSoc().name) + "</h1>");
|
||||
|
||||
m_desc = new QLabel(this);
|
||||
m_name->setTextFormat(Qt::RichText);
|
||||
m_desc->setText(QString::fromStdString(m_soc.GetSoc().desc));
|
||||
|
||||
right_layout->addWidget(m_name, 0);
|
||||
right_layout->addWidget(m_desc, 0);
|
||||
right_layout->addStretch(1);
|
||||
|
||||
setTitle("System-on-Chip Description");
|
||||
setLayout(right_layout);
|
||||
}
|
||||
|
||||
void SocDisplayPanel::AllowWrite(bool en)
|
||||
{
|
||||
Q_UNUSED(en);
|
||||
}
|
||||
|
||||
QWidget *SocDisplayPanel::GetWidget()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* DevDisplayPanel
|
||||
*/
|
||||
|
@ -51,8 +85,8 @@ DevDisplayPanel::DevDisplayPanel(QWidget *parent, const SocDevRef& dev_ref)
|
|||
m_name->setTextFormat(Qt::RichText);
|
||||
m_desc->setText(QString::fromStdString(m_dev.GetDev().desc));
|
||||
|
||||
right_layout->addLayout(top_layout, 0);
|
||||
right_layout->addWidget(m_name, 0);
|
||||
right_layout->addLayout(top_layout, 0);
|
||||
right_layout->addWidget(m_desc, 0);
|
||||
right_layout->addStretch(1);
|
||||
|
||||
|
|
|
@ -23,6 +23,23 @@ public:
|
|||
virtual QByteArray valuePropertyName () const;
|
||||
};
|
||||
|
||||
class SocDisplayPanel : public QGroupBox, public RegTabPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SocDisplayPanel(QWidget *parent, const SocRef& reg);
|
||||
void Reload();
|
||||
void AllowWrite(bool en);
|
||||
QWidget *GetWidget();
|
||||
bool Quit();
|
||||
|
||||
protected:
|
||||
|
||||
const SocRef& m_soc;
|
||||
QLabel *m_name;
|
||||
QLabel *m_desc;
|
||||
};
|
||||
|
||||
class DevDisplayPanel : public QGroupBox, public RegTabPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -16,7 +16,19 @@ namespace
|
|||
enum
|
||||
{
|
||||
RegTreeDevType = QTreeWidgetItem::UserType,
|
||||
RegTreeRegType
|
||||
RegTreeRegType,
|
||||
RegTreeSocType
|
||||
};
|
||||
|
||||
class SocTreeItem : public QTreeWidgetItem
|
||||
{
|
||||
public:
|
||||
SocTreeItem(const QString& string, const SocRef& ref)
|
||||
:QTreeWidgetItem(QStringList(string), RegTreeSocType), m_ref(ref) {}
|
||||
|
||||
const SocRef& GetRef() { return m_ref; }
|
||||
private:
|
||||
SocRef m_ref;
|
||||
};
|
||||
|
||||
class DevTreeItem : public QTreeWidgetItem
|
||||
|
@ -293,6 +305,11 @@ void RegTab::OnRegItemClicked(QTreeWidgetItem *current, int col)
|
|||
Q_UNUSED(col);
|
||||
if(current == 0)
|
||||
return;
|
||||
if(current->type() == RegTreeSocType)
|
||||
{
|
||||
SocTreeItem *item = dynamic_cast< SocTreeItem * >(current);
|
||||
DisplaySoc(item->GetRef());
|
||||
}
|
||||
if(current->type() == RegTreeRegType)
|
||||
{
|
||||
RegTreeItem *item = dynamic_cast< RegTreeItem * >(current);
|
||||
|
@ -329,6 +346,11 @@ void RegTab::DisplayDevice(const SocDevRef& ref)
|
|||
SetPanel(new DevDisplayPanel(this, ref));
|
||||
}
|
||||
|
||||
void RegTab::DisplaySoc(const SocRef& ref)
|
||||
{
|
||||
SetPanel(new SocDisplayPanel(this, ref));
|
||||
}
|
||||
|
||||
void RegTab::SetPanel(RegTabPanel *panel)
|
||||
{
|
||||
delete m_right_content;
|
||||
|
@ -410,21 +432,32 @@ void RegTab::FillDevSubTree(QTreeWidgetItem *_item)
|
|||
}
|
||||
}
|
||||
|
||||
void RegTab::FillRegTree()
|
||||
void RegTab::FillSocSubTree(QTreeWidgetItem *_item)
|
||||
{
|
||||
for(size_t i = 0; i < m_cur_soc.GetSoc().dev.size(); i++)
|
||||
SocTreeItem *item = dynamic_cast< SocTreeItem* >(_item);
|
||||
const soc_t& soc = item->GetRef().GetSoc();
|
||||
for(size_t i = 0; i < soc.dev.size(); i++)
|
||||
{
|
||||
const soc_dev_t& dev = m_cur_soc.GetSoc().dev[i];
|
||||
const soc_dev_t& dev = soc.dev[i];
|
||||
for(size_t j = 0; j < dev.addr.size(); j++)
|
||||
{
|
||||
DevTreeItem *dev_item = new DevTreeItem(dev.addr[j].name.c_str(),
|
||||
SocDevRef(m_cur_soc, i, j));
|
||||
FillDevSubTree(dev_item);
|
||||
m_reg_tree->addTopLevelItem(dev_item);
|
||||
item->addChild(dev_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RegTab::FillRegTree()
|
||||
{
|
||||
SocTreeItem *soc_item = new SocTreeItem(m_cur_soc.GetSoc().name.c_str(),
|
||||
m_cur_soc);
|
||||
FillSocSubTree(soc_item);
|
||||
m_reg_tree->addTopLevelItem(soc_item);
|
||||
m_reg_tree->expandItem(soc_item);
|
||||
}
|
||||
|
||||
void RegTab::FillAnalyserList()
|
||||
{
|
||||
m_analysers_list->clear();
|
||||
|
|
|
@ -57,11 +57,13 @@ protected:
|
|||
};
|
||||
|
||||
void FillDevSubTree(QTreeWidgetItem *item);
|
||||
void FillSocSubTree(QTreeWidgetItem *item);
|
||||
void FillRegTree();
|
||||
void FillAnalyserList();
|
||||
void UpdateSocList();
|
||||
void DisplayRegister(const SocRegRef& ref);
|
||||
void DisplayDevice(const SocDevRef& ref);
|
||||
void DisplaySoc(const SocRef& ref);
|
||||
void SetDataSocName(const QString& socname);
|
||||
void SetPanel(RegTabPanel *panel);
|
||||
void UpdateSocFilename();
|
||||
|
|
Loading…
Reference in a new issue