summaryrefslogtreecommitdiff
path: root/utils/regtools/qeditor/aux.cpp
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-05-11 19:51:55 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2014-05-11 19:56:56 +0200
commit7b590a953639714cf8ea4b550dd7f6558698e23f (patch)
tree4d37890770d45b29237fb671aa66ac446dff7684 /utils/regtools/qeditor/aux.cpp
parent4c1eafc208426d4457660313314289a570287cb8 (diff)
downloadrockbox-7b590a953639714cf8ea4b550dd7f6558698e23f.tar.gz
rockbox-7b590a953639714cf8ea4b550dd7f6558698e23f.zip
qeditor: many enhancement
Qeditor has been improved in many ways: - it can now dump all registers, just like the lua DUMPER.dump_all() command - several crash were fixed - when connected to a hwstub command, one can correctly edit individual fields - the code was simplified in several places Change-Id: I092b99ce3a12ff6417552de61d62c65f706bcff0
Diffstat (limited to 'utils/regtools/qeditor/aux.cpp')
-rw-r--r--utils/regtools/qeditor/aux.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/utils/regtools/qeditor/aux.cpp b/utils/regtools/qeditor/aux.cpp
index 0614bb57f6..de45f6c438 100644
--- a/utils/regtools/qeditor/aux.cpp
+++ b/utils/regtools/qeditor/aux.cpp
@@ -321,6 +321,47 @@ void SocFieldEditor::setField(uint field)
321} 321}
322 322
323/** 323/**
324 * SocFieldCachedItemDelegate
325 */
326
327QString SocFieldCachedItemDelegate::displayText(const QVariant& value, const QLocale& locale) const
328{
329 // FIXME see QTBUG-30392
330 if(value.type() == QVariant::UserType && value.userType() == qMetaTypeId< SocFieldCachedValue >())
331 {
332 const SocFieldCachedValue& v = value.value< SocFieldCachedValue >();
333 int bitcount = v.field().last_bit - v.field().first_bit;
334 return QString("0x%1").arg(v.value(), (bitcount + 3) / 4, 16, QChar('0'));
335 }
336 else
337 return QStyledItemDelegate::displayText(value, locale);
338}
339
340/**
341 * SocFieldCachedEditor
342 */
343SocFieldCachedEditor::SocFieldCachedEditor(QWidget *parent)
344 :SocFieldEditor(soc_reg_field_t(), parent)
345{
346}
347
348SocFieldCachedEditor::~SocFieldCachedEditor()
349{
350}
351
352SocFieldCachedValue SocFieldCachedEditor::value() const
353{
354 return SocFieldCachedValue(m_value.field(), field());
355}
356
357void SocFieldCachedEditor::setValue(SocFieldCachedValue val)
358{
359 m_value = val;
360 SetRegField(m_value.field());
361 setField(m_value.value());
362}
363
364/**
324 * SocFieldEditorCreator 365 * SocFieldEditorCreator
325 */ 366 */
326QWidget *SocFieldEditorCreator::createWidget(QWidget *parent) const 367QWidget *SocFieldEditorCreator::createWidget(QWidget *parent) const
@@ -334,6 +375,19 @@ QByteArray SocFieldEditorCreator::valuePropertyName() const
334} 375}
335 376
336/** 377/**
378 * SocFieldCachedEditorCreator
379 */
380QWidget *SocFieldCachedEditorCreator::createWidget(QWidget *parent) const
381{
382 return new SocFieldCachedEditor(parent);
383}
384
385QByteArray SocFieldCachedEditorCreator::valuePropertyName() const
386{
387 return QByteArray("value");
388}
389
390/**
337 * RegSexyDisplay 391 * RegSexyDisplay
338 */ 392 */
339RegSexyDisplay::RegSexyDisplay(const SocRegRef& reg, QWidget *parent) 393RegSexyDisplay::RegSexyDisplay(const SocRegRef& reg, QWidget *parent)