diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2014-09-27 21:23:38 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2014-12-15 22:52:54 +0100 |
commit | 99ed6d2bea6b8bc76b9775aea4735b68c19f175f (patch) | |
tree | 06bb113b620181cba1dba7009201981a0fcf2ad3 /utils/regtools/qeditor | |
parent | b08620dd304f54943c057405da49d44102ebcc77 (diff) | |
download | rockbox-99ed6d2bea6b8bc76b9775aea4735b68c19f175f.tar.gz rockbox-99ed6d2bea6b8bc76b9775aea4735b68c19f175f.zip |
qeditor: backends can now report validity status
Change-Id: Iefedc9cee10a8c7457d972e5a60d151a6cb38aa8
Reviewed-on: http://gerrit.rockbox.org/995
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
Diffstat (limited to 'utils/regtools/qeditor')
-rw-r--r-- | utils/regtools/qeditor/backend.cpp | 3 | ||||
-rw-r--r-- | utils/regtools/qeditor/backend.h | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/utils/regtools/qeditor/backend.cpp b/utils/regtools/qeditor/backend.cpp index 9c94ac5642..e47df8e3a4 100644 --- a/utils/regtools/qeditor/backend.cpp +++ b/utils/regtools/qeditor/backend.cpp | |||
@@ -114,6 +114,7 @@ FileIoBackend::FileIoBackend(const QString& filename, const QString& soc_name) | |||
114 | { | 114 | { |
115 | m_filename = filename; | 115 | m_filename = filename; |
116 | m_soc = soc_name; | 116 | m_soc = soc_name; |
117 | m_valid = false; | ||
117 | Reload(); | 118 | Reload(); |
118 | } | 119 | } |
119 | 120 | ||
@@ -132,6 +133,7 @@ bool FileIoBackend::ReadRegister(const QString& name, soc_word_t& value) | |||
132 | 133 | ||
133 | bool FileIoBackend::Reload() | 134 | bool FileIoBackend::Reload() |
134 | { | 135 | { |
136 | m_valid = false; | ||
135 | QFile file(m_filename); | 137 | QFile file(m_filename); |
136 | if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) | 138 | if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) |
137 | return false; | 139 | return false; |
@@ -155,6 +157,7 @@ bool FileIoBackend::Reload() | |||
155 | 157 | ||
156 | m_readonly = !QFileInfo(file).isWritable(); | 158 | m_readonly = !QFileInfo(file).isWritable(); |
157 | m_dirty = false; | 159 | m_dirty = false; |
160 | m_valid = true; | ||
158 | return true; | 161 | return true; |
159 | } | 162 | } |
160 | 163 | ||
diff --git a/utils/regtools/qeditor/backend.h b/utils/regtools/qeditor/backend.h index 64ba4c4922..2dba4e2b08 100644 --- a/utils/regtools/qeditor/backend.h +++ b/utils/regtools/qeditor/backend.h | |||
@@ -53,6 +53,8 @@ public: | |||
53 | * HW.dev.reg | 53 | * HW.dev.reg |
54 | * where <dev> is the device name (including index like APPUART1) | 54 | * where <dev> is the device name (including index like APPUART1) |
55 | * and <reg> is the register name (including index like PRIORITY29) */ | 55 | * and <reg> is the register name (including index like PRIORITY29) */ |
56 | /* report whether backend is valid */ | ||
57 | virtual bool IsValid() = 0; | ||
56 | /* report whether backend supports register access type */ | 58 | /* report whether backend supports register access type */ |
57 | virtual bool SupportAccess(AccessType type) = 0; | 59 | virtual bool SupportAccess(AccessType type) = 0; |
58 | /* get SoC name */ | 60 | /* get SoC name */ |
@@ -83,6 +85,7 @@ class DummyIoBackend : public IoBackend | |||
83 | public: | 85 | public: |
84 | DummyIoBackend() {} | 86 | DummyIoBackend() {} |
85 | 87 | ||
88 | virtual bool IsValid() { return false; } | ||
86 | virtual bool SupportAccess(AccessType type) { Q_UNUSED(type); return false; } | 89 | virtual bool SupportAccess(AccessType type) { Q_UNUSED(type); return false; } |
87 | virtual QString GetSocName() { return ""; } | 90 | virtual QString GetSocName() { return ""; } |
88 | virtual bool ReadRegister(const QString& name, soc_word_t& value) | 91 | virtual bool ReadRegister(const QString& name, soc_word_t& value) |
@@ -107,6 +110,7 @@ class FileIoBackend : public IoBackend | |||
107 | public: | 110 | public: |
108 | FileIoBackend(const QString& filename, const QString& soc_name = ""); | 111 | FileIoBackend(const QString& filename, const QString& soc_name = ""); |
109 | 112 | ||
113 | virtual bool IsValid() { return m_valid; } | ||
110 | virtual bool SupportAccess(AccessType type) { return type == ByName; } | 114 | virtual bool SupportAccess(AccessType type) { return type == ByName; } |
111 | virtual QString GetSocName(); | 115 | virtual QString GetSocName(); |
112 | virtual bool ReadRegister(const QString& name, soc_word_t& value); | 116 | virtual bool ReadRegister(const QString& name, soc_word_t& value); |
@@ -126,6 +130,7 @@ protected: | |||
126 | QString m_soc; | 130 | QString m_soc; |
127 | bool m_readonly; | 131 | bool m_readonly; |
128 | bool m_dirty; | 132 | bool m_dirty; |
133 | bool m_valid; | ||
129 | QMap< QString, soc_word_t > m_map; | 134 | QMap< QString, soc_word_t > m_map; |
130 | }; | 135 | }; |
131 | 136 | ||
@@ -173,6 +178,7 @@ public: | |||
173 | HWStubIoBackend(HWStubDevice *dev); | 178 | HWStubIoBackend(HWStubDevice *dev); |
174 | virtual ~HWStubIoBackend(); | 179 | virtual ~HWStubIoBackend(); |
175 | 180 | ||
181 | virtual bool IsValid() { return m_dev->IsValid(); } | ||
176 | virtual bool SupportAccess(AccessType type) { return type == ByAddress; } | 182 | virtual bool SupportAccess(AccessType type) { return type == ByAddress; } |
177 | virtual QString GetSocName(); | 183 | virtual QString GetSocName(); |
178 | virtual bool ReadRegister(const QString& name, soc_word_t& value) | 184 | virtual bool ReadRegister(const QString& name, soc_word_t& value) |