b8bad8412f
Free the backend when closing a tab to release some memory. Implement about dialogs. Change-Id: Ic8c500a23d38e6c3dd4de6a4ba862012925968be
124 lines
No EOL
2.9 KiB
C++
124 lines
No EOL
2.9 KiB
C++
#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>
|
|
#include <QValidator>
|
|
#include <soc_desc.hpp>
|
|
#include "backend.h"
|
|
#include "settings.h"
|
|
|
|
enum
|
|
{
|
|
RegTreeDevType = QTreeWidgetItem::UserType,
|
|
RegTreeRegType
|
|
};
|
|
|
|
enum
|
|
{
|
|
DataSelNothing,
|
|
DataSelFile,
|
|
#ifdef HAVE_HWSTUB
|
|
DataSelDevice,
|
|
#endif
|
|
};
|
|
|
|
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;
|
|
};
|
|
|
|
class RegTreeItem : public QTreeWidgetItem
|
|
{
|
|
public:
|
|
RegTreeItem(const QString& string, const SocRegRef& ref)
|
|
:QTreeWidgetItem(QStringList(string), RegTreeRegType), m_ref(ref) {}
|
|
|
|
const SocRegRef& GetRef() { return m_ref; }
|
|
private:
|
|
SocRegRef m_ref;
|
|
};
|
|
|
|
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;
|
|
};
|
|
|
|
};
|
|
|
|
class RegTab : public QSplitter
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
RegTab(Backend *backend);
|
|
~RegTab();
|
|
|
|
protected:
|
|
void FillDevSubTree(DevTreeItem *item);
|
|
void FillRegTree();
|
|
void FillAnalyserList();
|
|
void UpdateSocList();
|
|
void DisplayRegister(const SocRegRef& ref);
|
|
void SetDataSocName(const QString& socname);
|
|
QComboBox *m_soc_selector;
|
|
#ifdef HAVE_HWSTUB
|
|
QComboBox *m_dev_selector;
|
|
HWStubBackendHelper m_hwstub_helper;
|
|
#endif
|
|
Backend *m_backend;
|
|
QTreeWidget *m_reg_tree;
|
|
SocRef m_cur_soc;
|
|
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:
|
|
#ifdef HAVE_HWSTUB
|
|
void OnDevListChanged();
|
|
void OnDevChanged(int index);
|
|
#endif
|
|
void SetReadOnlyIndicator();
|
|
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);
|
|
void OnRawRegValueReturnPressed();
|
|
};
|
|
|
|
#endif /* REGTAB_H */ |