2013-08-21 18:16:26 +00:00
|
|
|
#include "regtab.h"
|
|
|
|
|
|
|
|
#include <QSizePolicy>
|
|
|
|
#include <QStringBuilder>
|
|
|
|
#include <QFileDialog>
|
2014-02-03 23:18:51 +00:00
|
|
|
#include <QDebug>
|
2014-02-10 22:10:55 +00:00
|
|
|
#include <QStyle>
|
2013-08-21 18:16:26 +00:00
|
|
|
#include "backend.h"
|
|
|
|
#include "analyser.h"
|
2014-04-07 09:28:04 +00:00
|
|
|
#include "regdisplaypanel.h"
|
2013-08-21 18:16:26 +00:00
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
namespace
|
2014-02-10 22:10:55 +00:00
|
|
|
{
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
enum
|
2014-02-10 22:10:55 +00:00
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
RegTreeDevType = QTreeWidgetItem::UserType,
|
|
|
|
RegTreeRegType
|
|
|
|
};
|
2014-02-10 22:10:55 +00:00
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
class DevTreeItem : public QTreeWidgetItem
|
2014-02-10 22:10:55 +00:00
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
public:
|
|
|
|
DevTreeItem(const QString& string, const SocDevRef& ref)
|
|
|
|
:QTreeWidgetItem(QStringList(string), RegTreeDevType), m_ref(ref) {}
|
2014-02-10 22:10:55 +00:00
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
const SocDevRef& GetRef() { return m_ref; }
|
|
|
|
private:
|
|
|
|
SocDevRef m_ref;
|
|
|
|
};
|
2014-02-10 22:10:55 +00:00
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
class RegTreeItem : public QTreeWidgetItem
|
2014-02-10 22:10:55 +00:00
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
public:
|
|
|
|
RegTreeItem(const QString& string, const SocRegRef& ref)
|
|
|
|
:QTreeWidgetItem(QStringList(string), RegTreeRegType), m_ref(ref) {}
|
2014-02-10 22:10:55 +00:00
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
const SocRegRef& GetRef() { return m_ref; }
|
|
|
|
private:
|
|
|
|
SocRegRef m_ref;
|
|
|
|
};
|
2014-02-10 22:10:55 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-07 09:28:04 +00:00
|
|
|
* EmptyRegTabPanel
|
2014-02-10 22:10:55 +00:00
|
|
|
*/
|
2014-04-07 09:28:04 +00:00
|
|
|
EmptyRegTabPanel::EmptyRegTabPanel(QWidget *parent)
|
|
|
|
:QWidget(parent)
|
2014-02-10 22:10:55 +00:00
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
QVBoxLayout *l = new QVBoxLayout;
|
|
|
|
l->addStretch();
|
|
|
|
setLayout(l);
|
2014-02-10 22:10:55 +00:00
|
|
|
}
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
void EmptyRegTabPanel::AllowWrite(bool en)
|
2014-02-10 22:10:55 +00:00
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
Q_UNUSED(en);
|
2014-02-10 22:10:55 +00:00
|
|
|
}
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
QWidget *EmptyRegTabPanel::GetWidget()
|
2014-02-10 22:10:55 +00:00
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
return this;
|
2014-02-10 22:10:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* RegTab
|
|
|
|
*/
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
RegTab::RegTab(Backend *backend, QWidget *parent)
|
|
|
|
:QSplitter(parent), m_backend(backend)
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
|
|
|
QWidget *left = new QWidget;
|
2014-02-04 16:35:09 +00:00
|
|
|
this->addWidget(left);
|
|
|
|
this->setStretchFactor(0, 1);
|
2013-08-21 18:16:26 +00:00
|
|
|
QVBoxLayout *left_layout = new QVBoxLayout;
|
|
|
|
left->setLayout(left_layout);
|
|
|
|
|
|
|
|
QGroupBox *top_group = new QGroupBox("SOC selection");
|
|
|
|
QVBoxLayout *top_group_layout = new QVBoxLayout;
|
|
|
|
m_soc_selector = new QComboBox;
|
|
|
|
top_group_layout->addWidget(m_soc_selector);
|
|
|
|
top_group->setLayout(top_group_layout);
|
|
|
|
|
|
|
|
m_reg_tree = new QTreeWidget();
|
|
|
|
m_reg_tree->setColumnCount(1);
|
|
|
|
m_reg_tree->setHeaderLabel(QString("Name"));
|
|
|
|
|
|
|
|
m_analysers_list = new QListWidget;
|
|
|
|
|
|
|
|
m_type_selector = new QTabWidget;
|
|
|
|
m_type_selector->addTab(m_reg_tree, "Registers");
|
|
|
|
m_type_selector->addTab(m_analysers_list, "Analyzers");
|
|
|
|
m_type_selector->setTabPosition(QTabWidget::West);
|
|
|
|
|
|
|
|
left_layout->addWidget(top_group);
|
|
|
|
left_layout->addWidget(m_type_selector);
|
|
|
|
|
|
|
|
m_right_panel = new QVBoxLayout;
|
|
|
|
QGroupBox *data_sel_group = new QGroupBox("Data selection");
|
|
|
|
QHBoxLayout *data_sel_layout = new QHBoxLayout;
|
|
|
|
m_data_selector = new QComboBox;
|
2014-04-07 09:28:04 +00:00
|
|
|
m_data_selector->addItem(QIcon::fromTheme("text-x-generic"), "Explore", QVariant(DataSelNothing));
|
2013-08-21 18:16:26 +00:00
|
|
|
m_data_selector->addItem(QIcon::fromTheme("document-open"), "File...", QVariant(DataSelFile));
|
2014-02-03 23:18:51 +00:00
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
m_data_selector->addItem(QIcon::fromTheme("multimedia-player"), "Device...", QVariant(DataSelDevice));
|
|
|
|
#endif
|
2013-08-21 18:16:26 +00:00
|
|
|
m_data_sel_edit = new QLineEdit;
|
|
|
|
m_data_sel_edit->setReadOnly(true);
|
2014-02-10 22:10:55 +00:00
|
|
|
m_readonly_check = new QCheckBox("Read-only");
|
|
|
|
m_readonly_check->setCheckState(Qt::Checked);
|
2013-08-21 18:16:26 +00:00
|
|
|
m_data_soc_label = new QLabel;
|
|
|
|
QPushButton *data_sel_reload = new QPushButton;
|
|
|
|
data_sel_reload->setIcon(QIcon::fromTheme("view-refresh"));
|
2014-02-10 22:10:55 +00:00
|
|
|
data_sel_reload->setToolTip("Reload data");
|
2013-08-21 18:16:26 +00:00
|
|
|
data_sel_layout->addWidget(m_data_selector);
|
2014-04-07 09:28:04 +00:00
|
|
|
data_sel_layout->addWidget(m_data_sel_edit, 1);
|
|
|
|
data_sel_layout->addStretch(0);
|
2014-02-03 23:18:51 +00:00
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
m_dev_selector = new QComboBox;
|
|
|
|
data_sel_layout->addWidget(m_dev_selector, 1);
|
|
|
|
#endif
|
2014-02-10 22:10:55 +00:00
|
|
|
data_sel_layout->addWidget(m_readonly_check);
|
2013-08-21 18:16:26 +00:00
|
|
|
data_sel_layout->addWidget(m_data_soc_label);
|
|
|
|
data_sel_layout->addWidget(data_sel_reload);
|
|
|
|
data_sel_group->setLayout(data_sel_layout);
|
|
|
|
m_data_soc_label->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
m_right_panel->addWidget(data_sel_group, 0);
|
|
|
|
m_right_content = 0;
|
|
|
|
SetPanel(new EmptyRegTabPanel);
|
2013-08-21 18:16:26 +00:00
|
|
|
QWidget *w = new QWidget;
|
|
|
|
w->setLayout(m_right_panel);
|
2014-02-04 16:35:09 +00:00
|
|
|
this->addWidget(w);
|
|
|
|
this->setStretchFactor(1, 2);
|
2013-08-21 18:16:26 +00:00
|
|
|
|
|
|
|
m_io_backend = m_backend->CreateDummyIoBackend();
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
connect(m_soc_selector, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(OnSocChanged(int)));
|
2013-08-21 18:16:26 +00:00
|
|
|
connect(m_backend, SIGNAL(OnSocListChanged()), this, SLOT(OnSocListChanged()));
|
|
|
|
connect(m_reg_tree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
|
|
|
|
this, SLOT(OnRegItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
|
|
|
|
connect(m_data_selector, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(OnDataSelChanged(int)));
|
|
|
|
connect(m_data_soc_label, SIGNAL(linkActivated(const QString&)), this,
|
|
|
|
SLOT(OnDataSocActivated(const QString&)));
|
|
|
|
connect(m_analysers_list, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
|
|
|
|
this, SLOT(OnAnalyserChanged(QListWidgetItem *, QListWidgetItem *)));
|
2014-02-03 23:18:51 +00:00
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
connect(m_dev_selector, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(OnDevChanged(int)));
|
|
|
|
#endif
|
2014-02-10 22:10:55 +00:00
|
|
|
connect(m_readonly_check, SIGNAL(clicked(bool)), this, SLOT(OnReadOnlyClicked(bool)));
|
2013-08-21 18:16:26 +00:00
|
|
|
|
|
|
|
OnSocListChanged();
|
2014-04-07 09:28:04 +00:00
|
|
|
OnDataSelChanged(0);
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
2014-02-09 01:17:14 +00:00
|
|
|
RegTab::~RegTab()
|
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
ClearDevList();
|
|
|
|
#endif
|
2014-02-09 01:17:14 +00:00
|
|
|
delete m_io_backend;
|
|
|
|
}
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
bool RegTab::Quit()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-08-21 18:16:26 +00:00
|
|
|
void RegTab::SetDataSocName(const QString& socname)
|
|
|
|
{
|
|
|
|
if(socname.size() != 0)
|
|
|
|
{
|
|
|
|
m_data_soc_label->setText("<a href=\"" + socname + "\">" + socname + "</a>");
|
|
|
|
m_data_soc_label->setTextFormat(Qt::RichText);
|
|
|
|
m_data_soc_label->show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_data_soc_label->setText("");
|
|
|
|
m_data_soc_label->hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::OnDataSocActivated(const QString& str)
|
|
|
|
{
|
|
|
|
int index = m_soc_selector->findText(str);
|
|
|
|
if(index != -1)
|
|
|
|
m_soc_selector->setCurrentIndex(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::OnDataSelChanged(int index)
|
|
|
|
{
|
|
|
|
if(index == -1)
|
|
|
|
return;
|
|
|
|
QVariant var = m_data_selector->itemData(index);
|
|
|
|
if(var == DataSelFile)
|
|
|
|
{
|
2014-02-03 23:18:51 +00:00
|
|
|
m_data_sel_edit->show();
|
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
m_dev_selector->hide();
|
|
|
|
#endif
|
2014-04-07 09:28:04 +00:00
|
|
|
m_readonly_check->show();
|
2013-08-21 18:16:26 +00:00
|
|
|
QFileDialog *fd = new QFileDialog(m_data_selector);
|
|
|
|
fd->setFilter("Textual files (*.txt);;All files (*)");
|
2014-04-07 09:28:04 +00:00
|
|
|
fd->setDirectory(Settings::Get()->value("loaddatadir", QDir::currentPath()).toString());
|
2013-08-21 18:16:26 +00:00
|
|
|
if(fd->exec())
|
|
|
|
{
|
|
|
|
QStringList filenames = fd->selectedFiles();
|
|
|
|
delete m_io_backend;
|
|
|
|
m_io_backend = m_backend->CreateFileIoBackend(filenames[0]);
|
|
|
|
m_data_sel_edit->setText(filenames[0]);
|
|
|
|
SetDataSocName(m_io_backend->GetSocName());
|
|
|
|
OnDataSocActivated(m_io_backend->GetSocName());
|
|
|
|
}
|
2014-04-07 09:28:04 +00:00
|
|
|
Settings::Get()->setValue("loaddatadir", fd->directory().absolutePath());
|
2014-02-09 01:16:43 +00:00
|
|
|
SetReadOnlyIndicator();
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
2014-02-03 23:18:51 +00:00
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
else if(var == DataSelDevice)
|
|
|
|
{
|
|
|
|
m_data_sel_edit->hide();
|
2014-04-07 09:28:04 +00:00
|
|
|
m_readonly_check->show();
|
2014-02-03 23:18:51 +00:00
|
|
|
m_dev_selector->show();
|
|
|
|
OnDevListChanged();
|
|
|
|
}
|
|
|
|
#endif
|
2013-08-21 18:16:26 +00:00
|
|
|
else
|
|
|
|
{
|
2014-02-03 23:18:51 +00:00
|
|
|
m_data_sel_edit->show();
|
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
m_dev_selector->hide();
|
|
|
|
#endif
|
2014-04-07 09:28:04 +00:00
|
|
|
m_readonly_check->hide();
|
|
|
|
|
2013-08-21 18:16:26 +00:00
|
|
|
delete m_io_backend;
|
|
|
|
m_io_backend = m_backend->CreateDummyIoBackend();
|
2014-04-07 09:28:04 +00:00
|
|
|
m_readonly_check->setCheckState(Qt::Checked);
|
2013-08-21 18:16:26 +00:00
|
|
|
SetDataSocName("");
|
2014-04-07 09:28:04 +00:00
|
|
|
UpdateSocFilename();
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
OnDataChanged();
|
|
|
|
}
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
void RegTab::UpdateSocFilename()
|
|
|
|
{
|
|
|
|
int index = m_data_selector->currentIndex();
|
|
|
|
if(index == -1)
|
|
|
|
return;
|
|
|
|
if(m_data_selector->itemData(index) != DataSelNothing)
|
|
|
|
return;
|
|
|
|
index = m_soc_selector->currentIndex();
|
|
|
|
if(index == -1)
|
|
|
|
return;
|
|
|
|
SocRef ref = m_soc_selector->itemData(index).value< SocRef >();
|
|
|
|
m_data_sel_edit->setText(ref.GetSocFile()->GetFilename());
|
|
|
|
}
|
|
|
|
|
2014-02-09 01:16:43 +00:00
|
|
|
void RegTab::SetReadOnlyIndicator()
|
|
|
|
{
|
2014-02-10 22:10:55 +00:00
|
|
|
if(m_io_backend->IsReadOnly())
|
|
|
|
m_readonly_check->setCheckState(Qt::Checked);
|
2014-02-09 01:16:43 +00:00
|
|
|
}
|
|
|
|
|
2013-08-21 18:16:26 +00:00
|
|
|
void RegTab::OnDataChanged()
|
|
|
|
{
|
|
|
|
OnRegItemChanged(m_reg_tree->currentItem(), m_reg_tree->currentItem());
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::OnRegItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
Q_UNUSED(previous);
|
2013-08-21 18:16:26 +00:00
|
|
|
OnRegItemClicked(current, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::OnRegItemClicked(QTreeWidgetItem *current, int col)
|
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
Q_UNUSED(col);
|
|
|
|
if(current == 0)
|
2013-08-21 18:16:26 +00:00
|
|
|
return;
|
2014-04-07 09:28:04 +00:00
|
|
|
if(current->type() == RegTreeRegType)
|
|
|
|
{
|
|
|
|
RegTreeItem *item = dynamic_cast< RegTreeItem * >(current);
|
|
|
|
DisplayRegister(item->GetRef());
|
|
|
|
}
|
|
|
|
else if(current->type() == RegTreeDevType)
|
|
|
|
{
|
|
|
|
DevTreeItem *item = dynamic_cast< DevTreeItem * >(current);
|
|
|
|
DisplayDevice(item->GetRef());
|
|
|
|
}
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::OnAnalyserChanged(QListWidgetItem *current, QListWidgetItem *previous)
|
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
Q_UNUSED(previous);
|
2013-08-21 18:16:26 +00:00
|
|
|
OnAnalyserClicked(current);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::OnAnalyserClicked(QListWidgetItem *current)
|
|
|
|
{
|
|
|
|
if(current == 0)
|
|
|
|
return;
|
|
|
|
AnalyserFactory *ana = AnalyserFactory::GetAnalyserByName(current->text());
|
2014-04-07 09:28:04 +00:00
|
|
|
SetPanel(ana->Create(m_cur_soc, m_io_backend));
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
2014-02-09 01:13:53 +00:00
|
|
|
void RegTab::DisplayRegister(const SocRegRef& ref)
|
2014-04-07 09:28:04 +00:00
|
|
|
{
|
|
|
|
SetPanel(new RegDisplayPanel(this, m_io_backend, ref));
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::DisplayDevice(const SocDevRef& ref)
|
|
|
|
{
|
|
|
|
SetPanel(new DevDisplayPanel(this, ref));
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::SetPanel(RegTabPanel *panel)
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
|
|
|
delete m_right_content;
|
2014-02-10 22:10:55 +00:00
|
|
|
m_right_content = panel;
|
2014-04-07 09:28:04 +00:00
|
|
|
m_right_content->AllowWrite(m_readonly_check->checkState() == Qt::Unchecked);
|
|
|
|
m_right_panel->addWidget(m_right_content->GetWidget(), 1);
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::OnSocListChanged()
|
|
|
|
{
|
|
|
|
m_soc_selector->clear();
|
2014-04-07 09:28:04 +00:00
|
|
|
QList< SocRef > socs = m_backend->GetSocList();
|
2013-08-21 18:16:26 +00:00
|
|
|
for(int i = 0; i < socs.size(); i++)
|
2014-04-07 09:28:04 +00:00
|
|
|
{
|
|
|
|
QVariant v;
|
|
|
|
v.setValue(socs[i]);
|
|
|
|
m_soc_selector->addItem(QString::fromStdString(socs[i].GetSoc().name), v);
|
|
|
|
}
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
2014-02-03 23:18:51 +00:00
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
void RegTab::OnDevListChanged()
|
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
ClearDevList();
|
2014-02-03 23:18:51 +00:00
|
|
|
QList< HWStubDevice* > list = m_hwstub_helper.GetDevList();
|
|
|
|
foreach(HWStubDevice *dev, list)
|
|
|
|
{
|
|
|
|
QString name = QString("Bus %1 Device %2: %3").arg(dev->GetBusNumber())
|
|
|
|
.arg(dev->GetDevAddress()).arg(dev->GetTargetInfo().bName);
|
|
|
|
m_dev_selector->addItem(QIcon::fromTheme("multimedia-player"), name,
|
|
|
|
QVariant::fromValue((void *)dev));
|
|
|
|
}
|
|
|
|
if(list.size() > 0)
|
|
|
|
m_dev_selector->setCurrentIndex(0);
|
|
|
|
else
|
|
|
|
SetDataSocName("");
|
2014-02-10 22:10:55 +00:00
|
|
|
SetReadOnlyIndicator();
|
2014-02-03 23:18:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::OnDevChanged(int index)
|
|
|
|
{
|
|
|
|
if(index == -1)
|
|
|
|
return;
|
|
|
|
HWStubDevice *dev = reinterpret_cast< HWStubDevice* >(m_dev_selector->itemData(index).value< void* >());
|
|
|
|
delete m_io_backend;
|
|
|
|
m_io_backend = m_backend->CreateHWStubIoBackend(dev);
|
|
|
|
SetDataSocName(m_io_backend->GetSocName());
|
|
|
|
OnDataSocActivated(m_io_backend->GetSocName());
|
|
|
|
OnDataChanged();
|
|
|
|
}
|
2014-04-07 09:28:04 +00:00
|
|
|
|
|
|
|
void RegTab::ClearDevList()
|
|
|
|
{
|
|
|
|
while(m_dev_selector->count() > 0)
|
|
|
|
{
|
|
|
|
HWStubDevice *dev = reinterpret_cast< HWStubDevice* >(m_dev_selector->itemData(0).value< void* >());
|
|
|
|
delete dev;
|
|
|
|
m_dev_selector->removeItem(0);
|
|
|
|
}
|
|
|
|
}
|
2014-02-03 23:18:51 +00:00
|
|
|
#endif
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
void RegTab::FillDevSubTree(QTreeWidgetItem *_item)
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
DevTreeItem *item = dynamic_cast< DevTreeItem* >(_item);
|
2014-02-09 01:13:53 +00:00
|
|
|
const soc_dev_t& dev = item->GetRef().GetDev();
|
|
|
|
for(size_t i = 0; i < dev.reg.size(); i++)
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
2014-02-09 01:13:53 +00:00
|
|
|
const soc_reg_t& reg = dev.reg[i];
|
2013-08-21 18:16:26 +00:00
|
|
|
for(size_t j = 0; j < reg.addr.size(); j++)
|
|
|
|
{
|
2014-02-09 01:13:53 +00:00
|
|
|
RegTreeItem *reg_item = new RegTreeItem(reg.addr[j].name.c_str(),
|
|
|
|
SocRegRef(item->GetRef(), i, j));
|
2013-08-21 18:16:26 +00:00
|
|
|
item->addChild(reg_item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::FillRegTree()
|
|
|
|
{
|
2014-02-09 01:13:53 +00:00
|
|
|
for(size_t i = 0; i < m_cur_soc.GetSoc().dev.size(); i++)
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
2014-02-09 01:13:53 +00:00
|
|
|
const soc_dev_t& dev = m_cur_soc.GetSoc().dev[i];
|
|
|
|
for(size_t j = 0; j < dev.addr.size(); j++)
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
2014-02-09 01:13:53 +00:00
|
|
|
DevTreeItem *dev_item = new DevTreeItem(dev.addr[j].name.c_str(),
|
|
|
|
SocDevRef(m_cur_soc, i, j));
|
2013-08-21 18:16:26 +00:00
|
|
|
FillDevSubTree(dev_item);
|
|
|
|
m_reg_tree->addTopLevelItem(dev_item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::FillAnalyserList()
|
|
|
|
{
|
|
|
|
m_analysers_list->clear();
|
2014-02-09 01:13:53 +00:00
|
|
|
m_analysers_list->addItems(AnalyserFactory::GetAnalysersForSoc(m_cur_soc.GetSoc().name.c_str()));
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
void RegTab::OnSocChanged(int index)
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
2014-04-07 09:28:04 +00:00
|
|
|
if(index == -1)
|
2013-08-21 18:16:26 +00:00
|
|
|
return;
|
2014-04-07 09:28:04 +00:00
|
|
|
m_reg_tree->clear();
|
|
|
|
m_cur_soc = m_soc_selector->itemData(index).value< SocRef >();
|
2013-08-21 18:16:26 +00:00
|
|
|
FillRegTree();
|
|
|
|
FillAnalyserList();
|
2014-04-07 09:28:04 +00:00
|
|
|
UpdateSocFilename();
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
2014-02-09 01:16:43 +00:00
|
|
|
|
2014-02-10 22:10:55 +00:00
|
|
|
void RegTab::OnReadOnlyClicked(bool checked)
|
2014-02-09 01:16:43 +00:00
|
|
|
{
|
2014-02-10 22:10:55 +00:00
|
|
|
if(m_io_backend->IsReadOnly())
|
|
|
|
return SetReadOnlyIndicator();
|
2014-04-07 09:28:04 +00:00
|
|
|
m_right_content->AllowWrite(!checked);
|
|
|
|
UpdateSocFilename();
|
2014-02-09 01:16:43 +00:00
|
|
|
}
|