2013-08-21 18:16:26 +00:00
|
|
|
#ifndef REGTAB_H
|
|
|
|
#define REGTAB_H
|
|
|
|
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <QEvent>
|
|
|
|
#include <QTreeWidget>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QTabWidget>
|
|
|
|
#include <QSplitter>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QListWidget>
|
2014-02-09 01:16:43 +00:00
|
|
|
#include <QValidator>
|
2013-08-21 18:16:26 +00:00
|
|
|
#include <soc_desc.hpp>
|
|
|
|
#include "backend.h"
|
|
|
|
#include "settings.h"
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
RegTreeDevType = QTreeWidgetItem::UserType,
|
|
|
|
RegTreeRegType
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
DataSelNothing,
|
|
|
|
DataSelFile,
|
2014-02-03 23:18:51 +00:00
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
DataSelDevice,
|
|
|
|
#endif
|
2013-08-21 18:16:26 +00:00
|
|
|
};
|
|
|
|
|
2014-02-09 01:13:53 +00:00
|
|
|
class DevTreeItem : public QTreeWidgetItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DevTreeItem(const QString& string, const SocDevRef& ref)
|
|
|
|
:QTreeWidgetItem(QStringList(string), RegTreeDevType), m_ref(ref) {}
|
|
|
|
|
|
|
|
const SocDevRef& GetRef() { return m_ref; }
|
|
|
|
private:
|
|
|
|
SocDevRef m_ref;
|
|
|
|
};
|
|
|
|
|
2013-08-21 18:16:26 +00:00
|
|
|
class RegTreeItem : public QTreeWidgetItem
|
|
|
|
{
|
|
|
|
public:
|
2014-02-09 01:13:53 +00:00
|
|
|
RegTreeItem(const QString& string, const SocRegRef& ref)
|
|
|
|
:QTreeWidgetItem(QStringList(string), RegTreeRegType), m_ref(ref) {}
|
2013-08-21 18:16:26 +00:00
|
|
|
|
2014-02-09 01:13:53 +00:00
|
|
|
const SocRegRef& GetRef() { return m_ref; }
|
2013-08-21 18:16:26 +00:00
|
|
|
private:
|
2014-02-09 01:13:53 +00:00
|
|
|
SocRegRef m_ref;
|
|
|
|
};
|
|
|
|
|
2014-02-09 01:16:43 +00:00
|
|
|
class SocFieldValidator : public QValidator
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
SocFieldValidator(QObject *parent = 0);
|
|
|
|
SocFieldValidator(const soc_reg_field_t& field, QObject *parent = 0);
|
|
|
|
|
|
|
|
virtual void fixup(QString& input) const;
|
|
|
|
virtual State validate(QString& input, int& pos) const;
|
|
|
|
/* validate and return the interpreted value */
|
|
|
|
State parse(const QString& input, soc_word_t& val) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
soc_reg_field_t m_field;
|
|
|
|
};
|
|
|
|
|
2013-08-21 18:16:26 +00:00
|
|
|
};
|
|
|
|
|
2014-02-04 16:35:09 +00:00
|
|
|
class RegTab : public QSplitter
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-02-04 16:35:09 +00:00
|
|
|
RegTab(Backend *backend);
|
2014-02-09 01:17:14 +00:00
|
|
|
~RegTab();
|
2013-08-21 18:16:26 +00:00
|
|
|
|
|
|
|
protected:
|
2014-02-09 01:13:53 +00:00
|
|
|
void FillDevSubTree(DevTreeItem *item);
|
2013-08-21 18:16:26 +00:00
|
|
|
void FillRegTree();
|
|
|
|
void FillAnalyserList();
|
|
|
|
void UpdateSocList();
|
2014-02-09 01:13:53 +00:00
|
|
|
void DisplayRegister(const SocRegRef& ref);
|
2013-08-21 18:16:26 +00:00
|
|
|
void SetDataSocName(const QString& socname);
|
|
|
|
QComboBox *m_soc_selector;
|
2014-02-03 23:18:51 +00:00
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
QComboBox *m_dev_selector;
|
|
|
|
HWStubBackendHelper m_hwstub_helper;
|
|
|
|
#endif
|
2013-08-21 18:16:26 +00:00
|
|
|
Backend *m_backend;
|
|
|
|
QTreeWidget *m_reg_tree;
|
2014-02-09 01:13:53 +00:00
|
|
|
SocRef m_cur_soc;
|
2013-08-21 18:16:26 +00:00
|
|
|
QVBoxLayout *m_right_panel;
|
|
|
|
QWidget *m_right_content;
|
|
|
|
QLineEdit *m_data_sel_edit;
|
|
|
|
QLabel *m_data_soc_label;
|
|
|
|
QPushButton *m_data_sel_reload;
|
|
|
|
QComboBox *m_data_selector;
|
|
|
|
IoBackend *m_io_backend;
|
|
|
|
QTabWidget *m_type_selector;
|
|
|
|
QListWidget *m_analysers_list;
|
|
|
|
|
|
|
|
private slots:
|
2014-02-03 23:18:51 +00:00
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
void OnDevListChanged();
|
|
|
|
void OnDevChanged(int index);
|
|
|
|
#endif
|
2014-02-09 01:16:43 +00:00
|
|
|
void SetReadOnlyIndicator();
|
2013-08-21 18:16:26 +00:00
|
|
|
void OnSocChanged(const QString& text);
|
|
|
|
void OnSocListChanged();
|
|
|
|
void OnRegItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
|
|
|
void OnRegItemClicked(QTreeWidgetItem *clicked, int col);
|
|
|
|
void OnDataSelChanged(int index);
|
|
|
|
void OnDataChanged();
|
|
|
|
void OnDataSocActivated(const QString&);
|
|
|
|
void OnAnalyserChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
|
|
|
void OnAnalyserClicked(QListWidgetItem *clicked);
|
2014-02-09 01:16:43 +00:00
|
|
|
void OnRawRegValueReturnPressed();
|
2013-08-21 18:16:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* REGTAB_H */
|