diff options
Diffstat (limited to 'utils/regtools/qeditor')
-rw-r--r-- | utils/regtools/qeditor/qeditor.pro | 2 | ||||
-rw-r--r-- | utils/regtools/qeditor/utils.cpp | 20 | ||||
-rw-r--r-- | utils/regtools/qeditor/utils.h | 8 |
3 files changed, 26 insertions, 4 deletions
diff --git a/utils/regtools/qeditor/qeditor.pro b/utils/regtools/qeditor/qeditor.pro index 78a984bbce..771b60b61c 100644 --- a/utils/regtools/qeditor/qeditor.pro +++ b/utils/regtools/qeditor/qeditor.pro | |||
@@ -7,7 +7,7 @@ SOURCES += main.cpp mainwindow.cpp regtab.cpp backend.cpp analyser.cpp \ | |||
7 | LIBS += -L../lib/ -lsocdesc -lxml2 | 7 | LIBS += -L../lib/ -lsocdesc -lxml2 |
8 | INCLUDEPATH += ../lib/ ../../hwstub/lib | 8 | INCLUDEPATH += ../lib/ ../../hwstub/lib |
9 | 9 | ||
10 | VERSION = 2.0.2 | 10 | VERSION = 2.0.3 |
11 | 11 | ||
12 | DEFINES += APP_VERSION=\\\"$$VERSION\\\" | 12 | DEFINES += APP_VERSION=\\\"$$VERSION\\\" |
13 | 13 | ||
diff --git a/utils/regtools/qeditor/utils.cpp b/utils/regtools/qeditor/utils.cpp index effd79e0f6..1e39903a2c 100644 --- a/utils/regtools/qeditor/utils.cpp +++ b/utils/regtools/qeditor/utils.cpp | |||
@@ -340,6 +340,26 @@ void SocFieldEditor::setField(uint field) | |||
340 | setText(QString("0x%1").arg(field, digits, 16, QChar('0'))); | 340 | setText(QString("0x%1").arg(field, digits, 16, QChar('0'))); |
341 | } | 341 | } |
342 | 342 | ||
343 | void SocFieldEditor::SetRegField(const soc_reg_field_t& field) | ||
344 | { | ||
345 | setValidator(0); | ||
346 | delete m_validator; | ||
347 | m_validator = new SocFieldValidator(field); | ||
348 | setValidator(m_validator); | ||
349 | m_reg_field = field; | ||
350 | } | ||
351 | |||
352 | /** | ||
353 | * SocFieldCachedValue | ||
354 | */ | ||
355 | SocFieldCachedValue::SocFieldCachedValue(const soc_reg_field_t& field, uint value) | ||
356 | :m_field(field), m_value(value) | ||
357 | { | ||
358 | int idx = field.find_value(value); | ||
359 | if(idx != -1) | ||
360 | m_name = QString::fromStdString(field.value[idx].name); | ||
361 | } | ||
362 | |||
343 | /** | 363 | /** |
344 | * SocFieldCachedItemDelegate | 364 | * SocFieldCachedItemDelegate |
345 | */ | 365 | */ |
diff --git a/utils/regtools/qeditor/utils.h b/utils/regtools/qeditor/utils.h index 529e40bde1..13b9e896e9 100644 --- a/utils/regtools/qeditor/utils.h +++ b/utils/regtools/qeditor/utils.h | |||
@@ -129,7 +129,7 @@ public: | |||
129 | 129 | ||
130 | uint field() const; | 130 | uint field() const; |
131 | void setField(uint field); | 131 | void setField(uint field); |
132 | void SetRegField(const soc_reg_field_t& field) { m_reg_field = field; } | 132 | void SetRegField(const soc_reg_field_t& field); |
133 | 133 | ||
134 | protected: | 134 | protected: |
135 | SocFieldValidator *m_validator; | 135 | SocFieldValidator *m_validator; |
@@ -154,14 +154,16 @@ class SocFieldCachedValue | |||
154 | { | 154 | { |
155 | public: | 155 | public: |
156 | SocFieldCachedValue():m_value(0) {} | 156 | SocFieldCachedValue():m_value(0) {} |
157 | SocFieldCachedValue(const soc_reg_field_t& field, uint value) | 157 | SocFieldCachedValue(const soc_reg_field_t& field, uint value); |
158 | :m_field(field), m_value(value) {} | ||
159 | virtual ~SocFieldCachedValue() {} | 158 | virtual ~SocFieldCachedValue() {} |
160 | const soc_reg_field_t& field() const { return m_field; } | 159 | const soc_reg_field_t& field() const { return m_field; } |
161 | uint value() const { return m_value; } | 160 | uint value() const { return m_value; } |
161 | /* return empty string if there no match */ | ||
162 | QString value_name() const { return m_name; } | ||
162 | protected: | 163 | protected: |
163 | soc_reg_field_t m_field; | 164 | soc_reg_field_t m_field; |
164 | uint m_value; | 165 | uint m_value; |
166 | QString m_name; | ||
165 | }; | 167 | }; |
166 | 168 | ||
167 | Q_DECLARE_METATYPE(SocFieldCachedValue) | 169 | Q_DECLARE_METATYPE(SocFieldCachedValue) |