aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-01-27 15:18:52 +0100
committerKarel Kočí <cynerd@email.cz>2018-01-27 15:18:52 +0100
commitb7f2cec55f9a90032fc225fed0c1427faeadc879 (patch)
treebcb192542a0bb8ce4a3b76600c1e2a671c6af382
parent063da67766585bd1db5e8afd83e2f9eda88119c0 (diff)
downloadqtmips-b7f2cec55f9a90032fc225fed0c1427faeadc879.tar.gz
qtmips-b7f2cec55f9a90032fc225fed0c1427faeadc879.tar.bz2
qtmips-b7f2cec55f9a90032fc225fed0c1427faeadc879.zip
Various graphics tweaks
-rw-r--r--TODO.md5
-rw-r--r--qtmips_gui/NewDialogCache.ui2
-rw-r--r--qtmips_gui/memorydock.cpp14
-rw-r--r--qtmips_gui/memoryview.cpp2
-rw-r--r--qtmips_gui/programdock.cpp11
-rw-r--r--qtmips_machine/instruction.cpp4
6 files changed, 23 insertions, 15 deletions
diff --git a/TODO.md b/TODO.md
index 01bc74a..5f6cfda 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,8 +1,9 @@
* Firm endianity support
* Full unprivileged instructions support
* Windows support
-* Implement some layout/algorithm to reorder registers and memory so that it can
- be viewed horizontally.
* On cache also allow calculate what time it would take with stalls.
* Add at least one memory mapped periphery (leds or console?)
* Unit tests for hazard unit
+* When we are scrolling or content is updated in MemoryView the layout
+ recalculation is very annoying. It reorders view and that way blinks.
+* Optimize MemoryView (it calls layout size and do_layout a lot)
diff --git a/qtmips_gui/NewDialogCache.ui b/qtmips_gui/NewDialogCache.ui
index c995bac..072251c 100644
--- a/qtmips_gui/NewDialogCache.ui
+++ b/qtmips_gui/NewDialogCache.ui
@@ -17,7 +17,7 @@
<item>
<widget class="QGroupBox" name="enabled">
<property name="title">
- <string/>
+ <string>Enable cache</string>
</property>
<property name="checkable">
<bool>true</bool>
diff --git a/qtmips_gui/memorydock.cpp b/qtmips_gui/memorydock.cpp
index d0bad9c..92dcb20 100644
--- a/qtmips_gui/memorydock.cpp
+++ b/qtmips_gui/memorydock.cpp
@@ -6,17 +6,19 @@ QList<QWidget*> DataView::row_widget(std::uint32_t address, QWidget *parent) {
QList<QWidget*> widgs;
QLabel *l;
- l = new QLabel(QString("0x%1").arg(address, 8, 16, QChar('0')), parent);
+ QFont f;
+ f.setStyleHint(QFont::Monospace);
+
+ l = new QLabel(QString("0x") + QString("%1").arg(address, 8, 16, QChar('0')).toUpper(), parent);
l->setTextInteractionFlags(Qt::TextSelectableByMouse);
+ l->setFont(f);
widgs.append(l);
l = new QLabel(parent);
l->setTextInteractionFlags(Qt::TextSelectableByMouse);
- if (memory != nullptr) {
- l->setText(QString("0x%1").arg(memory->read_word(address), 8, 16, QChar('0')));
- }
- else
- l->setText(" "); // Just fill it in with some plain text so we don't have just addresses there
+ l->setFont(f);
+ if (memory != nullptr)
+ l->setText(QString("0x") + QString("%1").arg(memory->read_word(address), 8, 16, QChar('0')).toUpper());
widgs.append(l);
return widgs;
diff --git a/qtmips_gui/memoryview.cpp b/qtmips_gui/memoryview.cpp
index 48882db..31c8827 100644
--- a/qtmips_gui/memoryview.cpp
+++ b/qtmips_gui/memoryview.cpp
@@ -155,7 +155,7 @@ void MemoryView::Frame::check_update() {
int hpart = qMax(height()/10, MIN_OFF);
int req_height = height() + 2*hpart;
- while (!((content_y <= -hpart) && (content_y >= -2*hpart)) || (widg->height() < req_height)) {
+ while (!((content_y <= -hpart) && (content_y >= -2*hpart)) || (widg->height() <= req_height)) {
int row_h = widg->row_size();
// Calculate how many we need and how much we need to move and update content accordingly
int count = (req_height / row_h) + 1;
diff --git a/qtmips_gui/programdock.cpp b/qtmips_gui/programdock.cpp
index 70d6a83..974e5ad 100644
--- a/qtmips_gui/programdock.cpp
+++ b/qtmips_gui/programdock.cpp
@@ -53,19 +53,24 @@ QList<QWidget*> ProgramView::row_widget(std::uint32_t address, QWidget *parent)
QList<QWidget*> widgs;
QLabel *l;
+ QFont f;
+ f.setStyleHint(QFont::Monospace);
+
l = new QLabel(" ", parent);
+ l->setFont(f);
widgs.append(l);
- l = new QLabel(QString("0x%1").arg(address, 8, 16, QChar('0')), parent);
+ l = new QLabel(QString("0x") + QString("%1").arg(address, 8, 16, QChar('0')).toUpper(), parent);
l->setTextInteractionFlags(Qt::TextSelectableByMouse);
+ l->setFont(f);
widgs.append(l);
l = new QLabel(parent);
l->setTextInteractionFlags(Qt::TextSelectableByMouse);
+ l->setFont(f);
+ l->setMinimumWidth(60);
if (memory != nullptr)
l->setText(machine::Instruction(memory->read_word(address)).to_str());
- else
- l->setText(" "); // Just fill it in with some plain text so we don't have just addresses there
widgs.append(l);
return widgs;
diff --git a/qtmips_machine/instruction.cpp b/qtmips_machine/instruction.cpp
index c34ff3a..43d8eac 100644
--- a/qtmips_machine/instruction.cpp
+++ b/qtmips_machine/instruction.cpp
@@ -239,12 +239,12 @@ QString Instruction::to_str() const {
switch (im.type) {
case IT_I:
res += im.name;
- res += " $" + QString::number(rs()) + ", $" + QString::number(rt()) + ", 0x" + QString::number(immediate(), 16);
+ res += " $" + QString::number(rs()) + ", $" + QString::number(rt()) + ", 0x" + QString::number(immediate(), 16).toUpper();
break;
case IT_J:
res += im.name;
// TODO we need to know instruction address to expand address section by it
- res += " " + QString::number(address(), 16);
+ res += " " + QString::number(address(), 16).toUpper();
break;
case IT_R:
{