diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2016-02-06 15:08:43 +0000 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2016-02-06 15:20:48 +0000 |
commit | 6b9610fb908b27d1e0383c8d9bde3a88f35ed30c (patch) | |
tree | 1b0f5e2821b44d20f3704c584e309f5911357040 /utils/regtools/qeditor/regdisplaypanel.h | |
parent | 0f701a64bee43e79f95970ae9c0ec43ea7fcdf17 (diff) | |
download | rockbox-6b9610fb908b27d1e0383c8d9bde3a88f35ed30c.tar.gz rockbox-6b9610fb908b27d1e0383c8d9bde3a88f35ed30c.zip |
regtoosl/qeditor: port to the new description format
This big commit port qeditor from v1 to v2 register file format. Although
the display code was much simplified, the edit code had to be rewritten.
The new code also brings many improvement to the register display widget.
The new code also compiles with both Qt4 and Qt5, although it is recommended
to use Qt5 to get some improvements, especially in the layout of editor.
Change-Id: I24633ac37a144f25d9e705b565654269ec9cfbd3
Diffstat (limited to 'utils/regtools/qeditor/regdisplaypanel.h')
-rw-r--r-- | utils/regtools/qeditor/regdisplaypanel.h | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/utils/regtools/qeditor/regdisplaypanel.h b/utils/regtools/qeditor/regdisplaypanel.h index 9a692778fe..a34b9319d5 100644 --- a/utils/regtools/qeditor/regdisplaypanel.h +++ b/utils/regtools/qeditor/regdisplaypanel.h | |||
@@ -35,19 +35,12 @@ | |||
35 | #include "utils.h" | 35 | #include "utils.h" |
36 | #include "regtab.h" | 36 | #include "regtab.h" |
37 | 37 | ||
38 | class RegItemEditorCreator : public QItemEditorCreatorBase | ||
39 | { | ||
40 | public: | ||
41 | RegItemEditorCreator() {} | ||
42 | virtual QWidget *createWidget(QWidget * parent) const; | ||
43 | virtual QByteArray valuePropertyName () const; | ||
44 | }; | ||
45 | |||
46 | class SocDisplayPanel : public QGroupBox, public RegTabPanel | 38 | class SocDisplayPanel : public QGroupBox, public RegTabPanel |
47 | { | 39 | { |
48 | Q_OBJECT | 40 | Q_OBJECT |
49 | public: | 41 | public: |
50 | SocDisplayPanel(QWidget *parent, const SocRef& reg); | 42 | SocDisplayPanel(QWidget *parent, IoBackend *io_backend, |
43 | const soc_desc::soc_ref_t& reg); | ||
51 | void Reload(); | 44 | void Reload(); |
52 | void AllowWrite(bool en); | 45 | void AllowWrite(bool en); |
53 | QWidget *GetWidget(); | 46 | QWidget *GetWidget(); |
@@ -55,16 +48,17 @@ public: | |||
55 | 48 | ||
56 | protected: | 49 | protected: |
57 | 50 | ||
58 | const SocRef& m_soc; | 51 | soc_desc::soc_ref_t m_soc; |
59 | QLabel *m_name; | 52 | QLabel *m_name; |
60 | QLabel *m_desc; | 53 | QLabel *m_desc; |
61 | }; | 54 | }; |
62 | 55 | ||
63 | class DevDisplayPanel : public QGroupBox, public RegTabPanel | 56 | class NodeDisplayPanel : public QGroupBox, public RegTabPanel |
64 | { | 57 | { |
65 | Q_OBJECT | 58 | Q_OBJECT |
66 | public: | 59 | public: |
67 | DevDisplayPanel(QWidget *parent, const SocDevRef& reg); | 60 | NodeDisplayPanel(QWidget *parent, IoBackend *io_backend, |
61 | const soc_desc::node_inst_t& reg); | ||
68 | void Reload(); | 62 | void Reload(); |
69 | void AllowWrite(bool en); | 63 | void AllowWrite(bool en); |
70 | QWidget *GetWidget(); | 64 | QWidget *GetWidget(); |
@@ -72,17 +66,18 @@ public: | |||
72 | 66 | ||
73 | protected: | 67 | protected: |
74 | 68 | ||
75 | const SocDevRef& m_dev; | 69 | soc_desc::node_inst_t m_node; |
76 | QFont m_reg_font; | ||
77 | QLabel *m_name; | 70 | QLabel *m_name; |
78 | QLabel *m_desc; | 71 | QLabel *m_node_desc; |
72 | QLabel *m_inst_desc; | ||
79 | }; | 73 | }; |
80 | 74 | ||
81 | class RegDisplayPanel : public QGroupBox, public RegTabPanel | 75 | class RegDisplayPanel : public QGroupBox, public RegTabPanel |
82 | { | 76 | { |
83 | Q_OBJECT | 77 | Q_OBJECT |
84 | public: | 78 | public: |
85 | RegDisplayPanel(QWidget *parent, IoBackend *io_backend, const SocRegRef& reg); | 79 | RegDisplayPanel(QWidget *parent, IoBackend *io_backend, |
80 | const soc_desc::node_inst_t& reg); | ||
86 | ~RegDisplayPanel(); | 81 | ~RegDisplayPanel(); |
87 | void AllowWrite(bool en); | 82 | void AllowWrite(bool en); |
88 | void Reload(); | 83 | void Reload(); |
@@ -102,17 +97,19 @@ protected: | |||
102 | }; | 97 | }; |
103 | 98 | ||
104 | IoBackend *m_io_backend; | 99 | IoBackend *m_io_backend; |
105 | const SocRegRef& m_reg; | 100 | soc_desc::node_inst_t m_node; |
106 | bool m_allow_write; | 101 | bool m_allow_write; |
107 | RegLineEdit *m_raw_val_edit; | 102 | RegLineEdit *m_raw_val_edit; |
108 | Unscroll< RegSexyDisplay2 > *m_sexy_display2; | 103 | Unscroll< YRegDisplay > *m_sexy_display2; |
109 | GrowingTableView *m_value_table; | 104 | GrowingTableView *m_value_table; |
110 | RegFieldTableModel *m_value_model; | 105 | RegFieldTableModel *m_value_model; |
111 | QStyledItemDelegate *m_table_delegate; | 106 | QStyledItemDelegate *m_table_delegate; |
112 | QItemEditorFactory *m_table_edit_factory; | 107 | QItemEditorFactory *m_table_edit_factory; |
113 | RegItemEditorCreator *m_regedit_creator; | ||
114 | QLabel *m_raw_val_name; | 108 | QLabel *m_raw_val_name; |
115 | QFont m_reg_font; | 109 | QFont m_reg_font; |
110 | QLabel *m_name; | ||
111 | QLabel *m_node_desc; | ||
112 | QLabel *m_inst_desc; | ||
116 | QLabel *m_desc; | 113 | QLabel *m_desc; |
117 | QWidget *m_viewport; | 114 | QWidget *m_viewport; |
118 | QScrollArea *m_scroll; | 115 | QScrollArea *m_scroll; |
@@ -120,6 +117,7 @@ protected: | |||
120 | private slots: | 117 | private slots: |
121 | void OnRawRegValueReturnPressed(); | 118 | void OnRawRegValueReturnPressed(); |
122 | void OnRegValueChanged(int index); | 119 | void OnRegValueChanged(int index); |
120 | void OnRegFieldActivated(const QModelIndex& index); | ||
123 | }; | 121 | }; |
124 | 122 | ||
125 | #endif /* REGDISPLAYPANEL_H */ | 123 | #endif /* REGDISPLAYPANEL_H */ |