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>
|
2014-02-10 22:10:55 +00:00
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QToolButton>
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QCheckBox>
|
2013-08-21 18:16:26 +00:00
|
|
|
#include <soc_desc.hpp>
|
|
|
|
#include "backend.h"
|
|
|
|
#include "settings.h"
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
RegTreeDevType = QTreeWidgetItem::UserType,
|
|
|
|
RegTreeRegType
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2014-02-10 22:10:55 +00:00
|
|
|
class RegLineEdit : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum EditMode
|
|
|
|
{
|
|
|
|
Write, Set, Clear, Toggle
|
|
|
|
};
|
|
|
|
|
|
|
|
RegLineEdit(QWidget *parent = 0);
|
|
|
|
~RegLineEdit();
|
|
|
|
void SetReadOnly(bool ro);
|
|
|
|
void EnableSCT(bool en);
|
|
|
|
void SetMode(EditMode mode);
|
|
|
|
EditMode GetMode();
|
|
|
|
QLineEdit *GetLineEdit();
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void OnWriteAct();
|
|
|
|
void OnSetAct();
|
|
|
|
void OnClearAct();
|
|
|
|
void OnToggleAct();
|
|
|
|
protected:
|
|
|
|
void ShowMode(bool show);
|
|
|
|
|
|
|
|
QHBoxLayout *m_layout;
|
|
|
|
QToolButton *m_button;
|
|
|
|
QLineEdit *m_edit;
|
|
|
|
EditMode m_mode;
|
|
|
|
bool m_has_sct;
|
|
|
|
bool m_readonly;
|
|
|
|
QMenu *m_menu;
|
|
|
|
};
|
|
|
|
|
|
|
|
class RegDisplayPanel : public QGroupBox
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
RegDisplayPanel(QWidget *parent, IoBackend *io_backend, const SocRegRef& reg);
|
|
|
|
void AllowWrite(bool en);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
IoBackend::WriteMode EditModeToWriteMode(RegLineEdit::EditMode mode);
|
|
|
|
|
|
|
|
IoBackend *m_io_backend;
|
|
|
|
const SocRegRef& m_reg;
|
|
|
|
bool m_allow_write;
|
|
|
|
RegLineEdit *m_raw_val_edit;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void OnRawRegValueReturnPressed();
|
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-10 22:10:55 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
DataSelNothing,
|
|
|
|
DataSelFile,
|
|
|
|
#ifdef HAVE_HWSTUB
|
|
|
|
DataSelDevice,
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
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;
|
2014-02-10 22:10:55 +00:00
|
|
|
QCheckBox *m_readonly_check;
|
2013-08-21 18:16:26 +00:00
|
|
|
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-10 22:10:55 +00:00
|
|
|
void OnReadOnlyClicked(bool);
|
2013-08-21 18:16:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* REGTAB_H */
|