2014-09-26 08:46:48 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 by Amaury Pouly
|
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
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>
|
2014-05-11 17:51:55 +00:00
|
|
|
#include <QMessageBox>
|
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
|
|
|
{
|
2016-02-06 15:08:43 +00:00
|
|
|
NodeInstRole = Qt::UserRole,
|
2014-04-07 09:28:04 +00:00
|
|
|
};
|
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);
|
|
|
|
|
2016-02-07 21:48:40 +00:00
|
|
|
QGroupBox *top_group = new QGroupBox("");
|
|
|
|
QHBoxLayout *top_group_layout = new QHBoxLayout;
|
2013-08-21 18:16:26 +00:00
|
|
|
m_soc_selector = new QComboBox;
|
2016-02-07 21:48:40 +00:00
|
|
|
top_group_layout->addWidget(new QLabel("SOC:"));
|
|
|
|
top_group_layout->addWidget(m_soc_selector, 1);
|
2013-08-21 18:16:26 +00:00
|
|
|
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;
|
2016-02-07 21:48:40 +00:00
|
|
|
QGroupBox *data_sel_group = new QGroupBox("");
|
2013-08-21 18:16:26 +00:00
|
|
|
QHBoxLayout *data_sel_layout = new QHBoxLayout;
|
2014-09-18 17:02:54 +00:00
|
|
|
m_backend_selector = new BackendSelector(m_backend, this);
|
2014-09-27 19:24:18 +00:00
|
|
|
m_backend_selector->SetNothingMessage("<i>Select a data source to analyse its content.</i>");
|
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;
|
2014-05-11 17:51:55 +00:00
|
|
|
m_dump = new QPushButton("Dump", this);
|
|
|
|
m_dump->setIcon(QIcon::fromTheme("system-run"));
|
|
|
|
m_data_sel_reload = new QPushButton(this);
|
|
|
|
m_data_sel_reload->setIcon(QIcon::fromTheme("view-refresh"));
|
|
|
|
m_data_sel_reload->setToolTip("Reload data");
|
2016-02-07 21:48:40 +00:00
|
|
|
data_sel_layout->addWidget(new QLabel("Data:"));
|
2014-09-18 17:02:54 +00:00
|
|
|
data_sel_layout->addWidget(m_backend_selector);
|
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);
|
2014-05-11 17:51:55 +00:00
|
|
|
data_sel_layout->addWidget(m_dump);
|
|
|
|
data_sel_layout->addWidget(m_data_sel_reload);
|
2013-08-21 18:16:26 +00:00
|
|
|
data_sel_group->setLayout(data_sel_layout);
|
|
|
|
m_data_soc_label->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
|
2014-09-27 11:29:44 +00:00
|
|
|
m_msg = new MessageWidget(this);
|
2013-08-21 18:16:26 +00:00
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
m_right_panel->addWidget(data_sel_group, 0);
|
2014-09-27 11:29:44 +00:00
|
|
|
m_right_panel->addWidget(m_msg, 0);
|
2014-04-07 09:28:04 +00:00
|
|
|
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
|
|
|
|
2014-09-18 17:03:08 +00:00
|
|
|
m_io_backend = m_backend_selector->GetBackend();
|
2013-08-21 18:16:26 +00:00
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
connect(m_soc_selector, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(OnSocChanged(int)));
|
2016-02-06 15:08:43 +00:00
|
|
|
connect(m_backend, SIGNAL(OnSocAdded(const SocFileRef&)), this,
|
|
|
|
SLOT(OnSocAdded(const SocFileRef&)));
|
2014-09-18 11:01:35 +00:00
|
|
|
connect(m_reg_tree, SIGNAL(itemClicked(QTreeWidgetItem*, int)),
|
|
|
|
this, SLOT(OnRegItemClicked(QTreeWidgetItem*, int)));
|
2013-08-21 18:16:26 +00:00
|
|
|
connect(m_data_soc_label, SIGNAL(linkActivated(const QString&)), this,
|
|
|
|
SLOT(OnDataSocActivated(const QString&)));
|
2014-09-18 11:01:35 +00:00
|
|
|
connect(m_analysers_list, SIGNAL(itemClicked(QListWidgetItem *)),
|
|
|
|
this, SLOT(OnAnalyserClicked(QListWidgetItem *)));
|
2014-09-18 17:02:54 +00:00
|
|
|
connect(m_backend_selector, SIGNAL(OnSelect(IoBackend *)),
|
|
|
|
this, SLOT(OnBackendSelect(IoBackend *)));
|
2014-02-10 22:10:55 +00:00
|
|
|
connect(m_readonly_check, SIGNAL(clicked(bool)), this, SLOT(OnReadOnlyClicked(bool)));
|
2014-05-11 17:51:55 +00:00
|
|
|
connect(m_dump, SIGNAL(clicked(bool)), this, SLOT(OnDumpRegs(bool)));
|
2014-09-18 17:02:54 +00:00
|
|
|
connect(m_data_sel_reload, SIGNAL(clicked(bool)), this, SLOT(OnBackendReload(bool)));
|
|
|
|
connect(m_type_selector, SIGNAL(currentChanged(int)), this, SLOT(OnTypeChanged(int)));
|
2013-08-21 18:16:26 +00:00
|
|
|
|
2014-10-07 12:30:24 +00:00
|
|
|
m_msg_select_id = SetMessage(MessageWidget::Information,
|
2016-02-07 21:48:40 +00:00
|
|
|
"You can browse the registers using the left panel. "
|
|
|
|
"Select a data source at the top to analyse the values. "
|
|
|
|
"You can also use the analyzers available in the left panel, if any.");
|
2014-10-07 12:30:24 +00:00
|
|
|
m_msg_error_id = 0;
|
2014-09-27 11:29:44 +00:00
|
|
|
|
2016-02-06 15:08:43 +00:00
|
|
|
QList< SocFileRef > socs = m_backend->GetSocFileList();
|
|
|
|
for(int i = 0; i < socs.size(); i++)
|
|
|
|
OnSocAdded(socs[i]);
|
2014-09-18 17:02:54 +00:00
|
|
|
SetDataSocName("");
|
2014-09-27 11:28:44 +00:00
|
|
|
UpdateTabName();
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
2014-09-18 19:36:17 +00:00
|
|
|
QWidget *RegTab::GetWidget()
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2014-02-09 01:17:14 +00:00
|
|
|
RegTab::~RegTab()
|
|
|
|
{
|
2014-09-18 17:02:54 +00:00
|
|
|
/* backend will be deleted by backend selector */
|
2014-02-09 01:17:14 +00:00
|
|
|
}
|
|
|
|
|
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);
|
2014-10-07 12:30:24 +00:00
|
|
|
else if(str.size() > 0)
|
|
|
|
{
|
|
|
|
m_msg_error_id = SetMessage(MessageWidget::Error,
|
|
|
|
"Description file for this SoC is not available.");
|
|
|
|
SetPanel(new EmptyRegTabPanel);
|
|
|
|
}
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
2014-09-18 19:36:17 +00:00
|
|
|
void RegTab::UpdateTabName()
|
|
|
|
{
|
|
|
|
/* do it the ugly way: try to cast to the different possible backends */
|
|
|
|
FileIoBackend *file = dynamic_cast< FileIoBackend* >(m_io_backend);
|
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
HWStubIoBackend *hwstub = dynamic_cast< HWStubIoBackend* >(m_io_backend);
|
|
|
|
#endif
|
|
|
|
if(file)
|
|
|
|
{
|
|
|
|
QFileInfo info(file->GetFileName());
|
|
|
|
SetTabName(info.fileName());
|
|
|
|
}
|
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
else if(hwstub)
|
|
|
|
{
|
|
|
|
HWStubDevice *dev = hwstub->GetDevice();
|
2016-02-07 21:48:40 +00:00
|
|
|
SetTabName(dev->GetFriendlyName());
|
2014-09-18 19:36:17 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetTabName("Register Tab");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-18 17:02:54 +00:00
|
|
|
void RegTab::OnBackendSelect(IoBackend *backend)
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
2014-10-07 12:30:24 +00:00
|
|
|
/* Hide "Please select two SoC" and errors message */
|
|
|
|
HideMessage(m_msg_select_id);
|
|
|
|
HideMessage(m_msg_error_id);
|
2014-09-18 17:02:54 +00:00
|
|
|
m_io_backend = backend;
|
2016-02-07 21:48:40 +00:00
|
|
|
/* Check if the backend is valid, otherwise it might confuse the user */
|
|
|
|
if(m_io_backend->IsValid())
|
|
|
|
{
|
|
|
|
SetReadOnlyIndicator();
|
|
|
|
SetDataSocName(m_io_backend->GetSocName());
|
|
|
|
OnDataSocActivated(m_io_backend->GetSocName());
|
|
|
|
OnDataChanged();
|
|
|
|
UpdateTabName();
|
|
|
|
}
|
|
|
|
/* But don't display it for the dummy backend either */
|
|
|
|
else if(dynamic_cast< DummyIoBackend * >(m_io_backend) == 0)
|
|
|
|
{
|
|
|
|
m_msg_error_id = SetMessage(MessageWidget::Error,
|
|
|
|
"Data source is not available.");
|
|
|
|
}
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
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()
|
|
|
|
{
|
2014-09-18 11:01:35 +00:00
|
|
|
OnRegItemClicked(m_reg_tree->currentItem(), 0);
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2016-02-06 15:08:43 +00:00
|
|
|
DisplayNode(NodeInst(current));
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2016-02-06 15:08:43 +00:00
|
|
|
void RegTab::DisplayNode(const soc_desc::node_inst_t& ref)
|
2014-04-07 09:28:04 +00:00
|
|
|
{
|
2016-02-07 21:48:40 +00:00
|
|
|
HideMessage(m_msg_select_id);
|
2016-02-06 15:08:43 +00:00
|
|
|
if(ref.node().is_root())
|
|
|
|
SetPanel(new SocDisplayPanel(this, m_io_backend, ref.soc()));
|
|
|
|
else if(ref.node().reg().valid())
|
|
|
|
SetPanel(new RegDisplayPanel(this, m_io_backend, ref));
|
|
|
|
else
|
|
|
|
SetPanel(new NodeDisplayPanel(this, m_io_backend, ref));
|
2014-08-09 16:39:45 +00:00
|
|
|
}
|
|
|
|
|
2014-10-07 12:30:24 +00:00
|
|
|
int RegTab::SetMessage(MessageWidget::MessageType type, const QString& msg)
|
|
|
|
{
|
|
|
|
return m_msg->SetMessage(type, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::HideMessage(int id)
|
2014-09-27 11:29:44 +00:00
|
|
|
{
|
2014-10-07 12:30:24 +00:00
|
|
|
m_msg->HideMessage(id);
|
2014-09-27 11:29:44 +00:00
|
|
|
}
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2016-02-06 15:08:43 +00:00
|
|
|
void RegTab::OnSocAdded(const SocFileRef& ref)
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
2016-02-06 15:08:43 +00:00
|
|
|
soc_desc::soc_ref_t soc = ref.GetSocFile()->GetSocRef();
|
|
|
|
QVariant v;
|
|
|
|
v.setValue(soc);
|
|
|
|
m_soc_selector->addItem(QString::fromStdString(soc.get()->name), v);
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
2016-02-06 15:08:43 +00:00
|
|
|
QTreeWidgetItem *RegTab::MakeNode(const soc_desc::node_inst_t& inst, const QString& s)
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
2016-02-06 15:08:43 +00:00
|
|
|
QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(s));
|
|
|
|
item->setData(0, NodeInstRole, QVariant::fromValue(inst));
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
soc_desc::node_inst_t RegTab::NodeInst(QTreeWidgetItem *item)
|
|
|
|
{
|
|
|
|
return item->data(0, NodeInstRole).value< soc_desc::node_inst_t >();
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
|
2016-02-06 15:08:43 +00:00
|
|
|
void RegTab::FillSubTree(QTreeWidgetItem *item)
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
2016-02-06 15:08:43 +00:00
|
|
|
std::vector< soc_desc::node_inst_t > list = NodeInst(item).children();
|
|
|
|
for(size_t i = 0; i < list.size(); i++)
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
2016-02-06 15:08:43 +00:00
|
|
|
QString name = QString::fromStdString(list[i].name());
|
|
|
|
if(list[i].is_indexed())
|
|
|
|
name = QString("%1[%2]").arg(name).arg(list[i].index());
|
|
|
|
QTreeWidgetItem *child = MakeNode(list[i], name);
|
|
|
|
FillSubTree(child);
|
|
|
|
item->addChild(child);
|
2013-08-21 18:16:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-09 16:39:45 +00:00
|
|
|
void RegTab::FillRegTree()
|
|
|
|
{
|
2016-02-06 15:08:43 +00:00
|
|
|
QTreeWidgetItem *soc_item = MakeNode(m_cur_soc.root_inst(),
|
|
|
|
QString::fromStdString(m_cur_soc.get()->name));
|
|
|
|
FillSubTree(soc_item);
|
2014-08-09 16:39:45 +00:00
|
|
|
m_reg_tree->addTopLevelItem(soc_item);
|
|
|
|
m_reg_tree->expandItem(soc_item);
|
|
|
|
}
|
|
|
|
|
2013-08-21 18:16:26 +00:00
|
|
|
void RegTab::FillAnalyserList()
|
|
|
|
{
|
|
|
|
m_analysers_list->clear();
|
2016-02-06 15:08:43 +00:00
|
|
|
m_analysers_list->addItems(AnalyserFactory::GetAnalysersForSoc(
|
|
|
|
QString::fromStdString(m_cur_soc.get()->name)));
|
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();
|
2016-02-06 15:08:43 +00:00
|
|
|
m_cur_soc = m_soc_selector->itemData(index).value< soc_desc::soc_ref_t >();
|
2013-08-21 18:16:26 +00:00
|
|
|
FillRegTree();
|
|
|
|
FillAnalyserList();
|
|
|
|
}
|
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);
|
2014-02-09 01:16:43 +00:00
|
|
|
}
|
2014-05-11 17:51:55 +00:00
|
|
|
|
|
|
|
void RegTab::OnDumpRegs(bool c)
|
|
|
|
{
|
|
|
|
Q_UNUSED(c);
|
|
|
|
QFileDialog *fd = new QFileDialog(this);
|
|
|
|
fd->setAcceptMode(QFileDialog::AcceptSave);
|
2016-02-06 15:08:43 +00:00
|
|
|
QStringList filters;
|
|
|
|
filters << "Textual files (*.txt)";
|
|
|
|
filters << "All files (*)";
|
|
|
|
fd->setNameFilters(filters);
|
2014-10-02 14:12:14 +00:00
|
|
|
fd->setDirectory(Settings::Get()->value("regtab/loaddatadir", QDir::currentPath()).toString());
|
2014-05-11 17:51:55 +00:00
|
|
|
if(!fd->exec())
|
|
|
|
return;
|
|
|
|
QStringList filenames = fd->selectedFiles();
|
2014-10-02 14:12:14 +00:00
|
|
|
Settings::Get()->setValue("regtab/loaddatadir", fd->directory().absolutePath());
|
2014-05-11 17:51:55 +00:00
|
|
|
BackendHelper bh(m_io_backend, m_cur_soc);
|
|
|
|
if(!bh.DumpAllRegisters(filenames[0]))
|
|
|
|
{
|
|
|
|
QMessageBox::warning(this, "The register dump was not saved",
|
|
|
|
"There was an error when dumping the registers");
|
|
|
|
}
|
|
|
|
}
|
2014-09-18 17:03:25 +00:00
|
|
|
|
|
|
|
void RegTab::OnBackendReload(bool c)
|
|
|
|
{
|
|
|
|
Q_UNUSED(c);
|
|
|
|
m_io_backend->Reload();
|
|
|
|
OnDataChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegTab::OnTypeChanged(int index)
|
|
|
|
{
|
|
|
|
if(index == -1)
|
|
|
|
return;
|
|
|
|
if(index == 0) /* registers */
|
|
|
|
OnRegItemClicked(m_reg_tree->currentItem(), 0);
|
|
|
|
else if(index == 1) /* analysers */
|
|
|
|
OnAnalyserClicked(m_analysers_list->currentItem());
|
|
|
|
}
|