summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-10-22 17:56:13 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2014-12-15 22:54:13 +0100
commit88053b88325318a2769086438ce4740c5bb7a7aa (patch)
treef5a3754e23eb32211fd1bc01911aeda811e0d162
parent04e798eddf43c81685324e83a655e62434f6fcce (diff)
downloadrockbox-88053b88325318a2769086438ce4740c5bb7a7aa.tar.gz
rockbox-88053b88325318a2769086438ce4740c5bb7a7aa.zip
regtools/qeditor: fix field editor not updating the validator on change
Change-Id: Ib8df47c8b7cfe0beb486e45542e3fcc9187bcc54 Reviewed-on: http://gerrit.rockbox.org/1020 Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
-rw-r--r--utils/regtools/qeditor/qeditor.pro2
-rw-r--r--utils/regtools/qeditor/utils.cpp20
-rw-r--r--utils/regtools/qeditor/utils.h8
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 \
7LIBS += -L../lib/ -lsocdesc -lxml2 7LIBS += -L../lib/ -lsocdesc -lxml2
8INCLUDEPATH += ../lib/ ../../hwstub/lib 8INCLUDEPATH += ../lib/ ../../hwstub/lib
9 9
10VERSION = 2.0.2 10VERSION = 2.0.3
11 11
12DEFINES += APP_VERSION=\\\"$$VERSION\\\" 12DEFINES += 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
343void 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 */
355SocFieldCachedValue::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
134protected: 134protected:
135 SocFieldValidator *m_validator; 135 SocFieldValidator *m_validator;
@@ -154,14 +154,16 @@ class SocFieldCachedValue
154{ 154{
155public: 155public:
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; }
162protected: 163protected:
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
167Q_DECLARE_METATYPE(SocFieldCachedValue) 169Q_DECLARE_METATYPE(SocFieldCachedValue)