mirror of https://github.com/mgba-emu/mgba.git
Qt: Add string view to memory viewer
This commit is contained in:
parent
9972ff5019
commit
605d5ddcfd
|
@ -32,6 +32,9 @@ public:
|
|||
void setAlignment(int);
|
||||
int alignment() const { return m_align; }
|
||||
|
||||
QByteArray serialize();
|
||||
void deserialize(const QByteArray&);
|
||||
|
||||
public slots:
|
||||
void jumpToAddress(const QString& hex);
|
||||
void jumpToAddress(uint32_t);
|
||||
|
@ -61,9 +64,6 @@ private:
|
|||
|
||||
void adjustCursor(int adjust, bool shift);
|
||||
|
||||
QByteArray serialize();
|
||||
void deserialize(const QByteArray&);
|
||||
|
||||
mCore* m_core;
|
||||
QFont m_font;
|
||||
int m_cellHeight;
|
||||
|
|
|
@ -167,15 +167,25 @@ void MemoryView::updateSelection(uint32_t start, uint32_t end) {
|
|||
|
||||
void MemoryView::updateStatus() {
|
||||
int align = m_ui.hexfield->alignment();
|
||||
if (!m_controller->isLoaded()) {
|
||||
return;
|
||||
}
|
||||
mCore* core = m_controller->thread()->core;
|
||||
QByteArray selection(m_ui.hexfield->serialize());
|
||||
QString text;
|
||||
for (QChar c : selection) {
|
||||
if (!c.isPrint() || c >= 127) {
|
||||
continue;
|
||||
}
|
||||
text.append(c);
|
||||
}
|
||||
m_ui.stringVal->setText(text);
|
||||
|
||||
if (m_selection.first & (align - 1) || m_selection.second - m_selection.first != align) {
|
||||
m_ui.sintVal->clear();
|
||||
m_ui.uintVal->clear();
|
||||
return;
|
||||
}
|
||||
if (!m_controller->isLoaded()) {
|
||||
return;
|
||||
}
|
||||
mCore* core = m_controller->thread()->core;
|
||||
union {
|
||||
uint32_t u32;
|
||||
int32_t i32;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>640</height>
|
||||
<width>565</width>
|
||||
<height>658</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -168,20 +168,39 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<zorder></zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Unsigned Integer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="uintVal">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Signed Integer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="sintVal">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
|
@ -190,17 +209,17 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Unsigned Integer:</string>
|
||||
<string>String:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="uintVal">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="stringVal">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
|
Loading…
Reference in New Issue