From 18a89d8f76bc08777e24909399925b4a1843919b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mal=C3=BD?= Date: Tue, 8 Oct 2019 15:47:57 +0200 Subject: Force white background in CoreView --- qtmips_gui/coreview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qtmips_gui/coreview.cpp b/qtmips_gui/coreview.cpp index b45f7ca..a130f0d 100644 --- a/qtmips_gui/coreview.cpp +++ b/qtmips_gui/coreview.cpp @@ -234,6 +234,8 @@ CoreViewScene::CoreViewScene(machine::QtMipsMachine *machine) : QGraphicsScene() new_label("Stalls", 570, SC_HEIGHT - 14); NEW_V(630, SC_HEIGHT - 9, stall_c_value, false, 10, 0, 10, ' ', false); + setBackgroundBrush(QBrush(Qt::white)); + connect(regs, SIGNAL(open_registers()), this, SIGNAL(request_registers())); connect(mem_program, SIGNAL(open_mem()), this, SIGNAL(request_program_memory())); connect(mem_data, SIGNAL(open_mem()), this, SIGNAL(request_data_memory())); -- cgit v1.2.3 From 5e185ed50df75ff647490cae43094fa54886c13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mal=C3=BD?= Date: Tue, 8 Oct 2019 15:56:50 +0200 Subject: Force white background in SrcEditor --- qtmips_gui/srceditor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qtmips_gui/srceditor.cpp b/qtmips_gui/srceditor.cpp index 2d4a5ec..aaed0f2 100644 --- a/qtmips_gui/srceditor.cpp +++ b/qtmips_gui/srceditor.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -52,6 +53,12 @@ void SrcEditor::setup_common() { setFont(font); tname = "Unknown"; highlighter = new HighlighterAsm(document()); + + QPalette p = palette(); + p.setColor(QPalette::Active, QPalette::Base, Qt::white); + p.setColor(QPalette::Inactive, QPalette::Base, Qt::white); + p.setColor(QPalette::Disabled, QPalette::Base, Qt::white); + setPalette(p); } SrcEditor::SrcEditor(QWidget *parent) : Super(parent) { -- cgit v1.2.3 From ef2279d14d7ef20a3bc32020215ddb6b3f99a9d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mal=C3=BD?= Date: Tue, 8 Oct 2019 16:00:01 +0200 Subject: Force black text in SrcEditor --- qtmips_gui/srceditor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qtmips_gui/srceditor.cpp b/qtmips_gui/srceditor.cpp index aaed0f2..43e9075 100644 --- a/qtmips_gui/srceditor.cpp +++ b/qtmips_gui/srceditor.cpp @@ -59,6 +59,8 @@ void SrcEditor::setup_common() { p.setColor(QPalette::Inactive, QPalette::Base, Qt::white); p.setColor(QPalette::Disabled, QPalette::Base, Qt::white); setPalette(p); + + setTextColor(Qt::black); } SrcEditor::SrcEditor(QWidget *parent) : Super(parent) { -- cgit v1.2.3 From e2e9df52ea548ca5fe2e2d7a06841eac380c27b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mal=C3=BD?= Date: Tue, 8 Oct 2019 16:48:16 +0200 Subject: Force black text in RegistersDock --- qtmips_gui/registersdock.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/qtmips_gui/registersdock.cpp b/qtmips_gui/registersdock.cpp index b72696d..fa89c94 100644 --- a/qtmips_gui/registersdock.cpp +++ b/qtmips_gui/registersdock.cpp @@ -71,6 +71,8 @@ static const QString labels[] = { }; RegistersDock::RegistersDock(QWidget *parent) : QDockWidget(parent) { + static const QColor defaultTextColor(0, 0, 0); + scrollarea = new QScrollArea(this); scrollarea->setWidgetResizable(true); widg = new StaticTable(scrollarea); @@ -78,12 +80,18 @@ RegistersDock::RegistersDock(QWidget *parent) : QDockWidget(parent) { hi_highlighted = false; lo_highlighted = false; + pal_normal = palette(); + pal_normal.setColor(QPalette::WindowText, defaultTextColor); + #define INIT(X, LABEL) do{ \ X = new QLabel("0x00000000", widg); \ X->setFixedSize(X->sizeHint()); \ X->setText(""); \ + X->setPalette(pal_normal); \ X->setTextInteractionFlags(Qt::TextSelectableByMouse); \ - widg->addRow({new QLabel(LABEL, widg), X}); \ + QLabel *l = new QLabel(LABEL, widg); \ + l->setPalette(pal_normal); \ + widg->addRow({l, X}); \ } while(false) for (int i = 0; i < 32; i++) @@ -98,10 +106,8 @@ RegistersDock::RegistersDock(QWidget *parent) : QDockWidget(parent) { setObjectName("Registers"); setWindowTitle("Registers"); - pal_normal = QPalette(gp[0]->palette()); - pal_updated = QPalette(gp[0]->palette()); - pal_read = QPalette(gp[0]->palette()); - pal_normal.setColor(QPalette::WindowText, QColor(0, 0, 0)); + pal_updated = pal_normal; + pal_read = pal_normal; pal_updated.setColor(QPalette::WindowText, QColor(240, 0, 0)); pal_read.setColor(QPalette::WindowText, QColor(0, 0, 240)); } -- cgit v1.2.3 From 2bfe22d935cb7d7c4f6c75f79ecfb568e75dc5d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mal=C3=BD?= Date: Tue, 8 Oct 2019 17:23:00 +0200 Subject: Force dark grey outline color for individual blocks in CoreView --- qtmips_gui/coreview/adder.cpp | 6 +++++ qtmips_gui/coreview/alu.cpp | 6 +++++ qtmips_gui/coreview/and.cpp | 5 ++++ qtmips_gui/coreview/coreview_colors.h | 43 ++++++++++++++++++++++++++++++++++ qtmips_gui/coreview/latch.cpp | 5 ++++ qtmips_gui/coreview/logicblock.cpp | 5 ++++ qtmips_gui/coreview/memory.cpp | 5 ++++ qtmips_gui/coreview/programcounter.cpp | 5 ++++ qtmips_gui/coreview/registers.cpp | 5 ++++ qtmips_gui/coreview/value.cpp | 3 +++ 10 files changed, 88 insertions(+) create mode 100644 qtmips_gui/coreview/coreview_colors.h diff --git a/qtmips_gui/coreview/adder.cpp b/qtmips_gui/coreview/adder.cpp index 49d67d4..0fe812f 100644 --- a/qtmips_gui/coreview/adder.cpp +++ b/qtmips_gui/coreview/adder.cpp @@ -34,6 +34,7 @@ ******************************************************************************/ #include "adder.h" +#include "coreview_colors.h" #include "fontsize.h" #include @@ -80,6 +81,11 @@ void Adder::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __at QPointF(DENT, HEIGHT / 2), QPointF(0, (HEIGHT / 2) - DENT) }; + + QPen pen = painter->pen(); + pen.setColor(BLOCK_OUTLINE_COLOR); + painter->setPen(pen); + painter->drawPolygon(poly, sizeof(poly) / sizeof(QPointF)); } diff --git a/qtmips_gui/coreview/alu.cpp b/qtmips_gui/coreview/alu.cpp index 5494b3f..33b1fa8 100644 --- a/qtmips_gui/coreview/alu.cpp +++ b/qtmips_gui/coreview/alu.cpp @@ -34,6 +34,7 @@ ******************************************************************************/ #include "alu.h" +#include "coreview_colors.h" #include "fontsize.h" #include @@ -79,6 +80,11 @@ void coreview::Alu::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt QPointF(DENT, HEIGHT / 2), QPointF(0, (HEIGHT / 2) - DENT) }; + + QPen pen = painter->pen(); + pen.setColor(BLOCK_OUTLINE_COLOR); + painter->setPen(pen); + painter->drawPolygon(poly, sizeof(poly) / sizeof(QPointF)); } diff --git a/qtmips_gui/coreview/and.cpp b/qtmips_gui/coreview/and.cpp index 94128fb..6ac7a62 100644 --- a/qtmips_gui/coreview/and.cpp +++ b/qtmips_gui/coreview/and.cpp @@ -34,6 +34,7 @@ ******************************************************************************/ #include "and.h" +#include "coreview_colors.h" #include using namespace coreview; @@ -63,6 +64,10 @@ QRectF And::boundingRect() const { } void And::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { + QPen pen = painter->pen(); + pen.setColor(BLOCK_OUTLINE_COLOR); + painter->setPen(pen); + qreal size = GAP * connectors.size(); painter->drawLine(0, 0, 0, size); painter->drawLine(0, 0, size/2, 0); diff --git a/qtmips_gui/coreview/coreview_colors.h b/qtmips_gui/coreview/coreview_colors.h new file mode 100644 index 0000000..da8d2ae --- /dev/null +++ b/qtmips_gui/coreview/coreview_colors.h @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: GPL-2.0+ +/******************************************************************************* + * QtMips - MIPS 32-bit Architecture Subset Simulator + * + * Implemented to support following courses: + * + * B35APO - Computer Architectures + * https://cw.fel.cvut.cz/wiki/courses/b35apo + * + * B4M35PAP - Advanced Computer Architectures + * https://cw.fel.cvut.cz/wiki/courses/b4m35pap/start + * + * Copyright (c) 2017-2019 Karel Koci + * Copyright (c) 2019 Pavel Pisa + * + * Faculty of Electrical Engineering (http://www.fel.cvut.cz) + * Czech Technical University (http://www.cvut.cz/) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + ******************************************************************************/ + +#ifndef COREVIEW_COLORS_H +#define COREVIEW_COLORS_H + +#include + +static const QColor BLOCK_OUTLINE_COLOR(85, 85, 85); + +#endif // COREVIEW_COLORS_H diff --git a/qtmips_gui/coreview/latch.cpp b/qtmips_gui/coreview/latch.cpp index e458f9b..fbfa6f0 100644 --- a/qtmips_gui/coreview/latch.cpp +++ b/qtmips_gui/coreview/latch.cpp @@ -34,6 +34,7 @@ ******************************************************************************/ #include "latch.h" +#include "coreview_colors.h" #include using namespace coreview; @@ -76,6 +77,10 @@ QRectF Latch::boundingRect() const { } void Latch::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { + QPen pen = painter->pen(); + pen.setColor(BLOCK_OUTLINE_COLOR); + painter->setPen(pen); + painter->drawRect(0, 0, WIDTH, height); // Now tick rectangle const QPointF tickPolygon[] = { diff --git a/qtmips_gui/coreview/logicblock.cpp b/qtmips_gui/coreview/logicblock.cpp index b1ab37c..dd77ee2 100644 --- a/qtmips_gui/coreview/logicblock.cpp +++ b/qtmips_gui/coreview/logicblock.cpp @@ -34,6 +34,7 @@ ******************************************************************************/ #include "logicblock.h" +#include "coreview_colors.h" #include "fontsize.h" #include @@ -79,6 +80,10 @@ QRectF LogicBlock::boundingRect() const { } void LogicBlock::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { + QPen pen = painter->pen(); + pen.setColor(BLOCK_OUTLINE_COLOR); + painter->setPen(pen); + painter->drawRoundedRect(box, RADIUS, RADIUS); } diff --git a/qtmips_gui/coreview/memory.cpp b/qtmips_gui/coreview/memory.cpp index 286e6da..b2b1ffe 100644 --- a/qtmips_gui/coreview/memory.cpp +++ b/qtmips_gui/coreview/memory.cpp @@ -34,6 +34,7 @@ ******************************************************************************/ #include "memory.h" +#include "coreview_colors.h" #include "fontsize.h" #include @@ -81,6 +82,10 @@ QRectF Memory::boundingRect() const { } void Memory::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { + QPen pen = painter->pen(); + pen.setColor(BLOCK_OUTLINE_COLOR); + painter->setPen(pen); + painter->drawRect(0, 0, WIDTH, HEIGHT); if (cache) painter->drawLine(0, CACHE_HEIGHT, WIDTH, CACHE_HEIGHT); diff --git a/qtmips_gui/coreview/programcounter.cpp b/qtmips_gui/coreview/programcounter.cpp index 2fb6980..ba8e1c6 100644 --- a/qtmips_gui/coreview/programcounter.cpp +++ b/qtmips_gui/coreview/programcounter.cpp @@ -34,6 +34,7 @@ ******************************************************************************/ #include "programcounter.h" +#include "coreview_colors.h" #include "fontsize.h" #include @@ -75,6 +76,10 @@ QRectF ProgramCounter::boundingRect() const { } void ProgramCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { + QPen pen = painter->pen(); + pen.setColor(BLOCK_OUTLINE_COLOR); + painter->setPen(pen); + painter->drawRect(0, 0, WIDTH, HEIGHT); } diff --git a/qtmips_gui/coreview/registers.cpp b/qtmips_gui/coreview/registers.cpp index ed3b508..982ba07 100644 --- a/qtmips_gui/coreview/registers.cpp +++ b/qtmips_gui/coreview/registers.cpp @@ -34,6 +34,7 @@ ******************************************************************************/ #include "registers.h" +#include "coreview_colors.h" #include "fontsize.h" #include @@ -81,6 +82,10 @@ QRectF Registers::boundingRect() const { } void Registers::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute((unused)), QWidget *widget __attribute((unused))) { + QPen pen = painter->pen(); + pen.setColor(BLOCK_OUTLINE_COLOR); + painter->setPen(pen); + painter->drawRect(0, 0, WIDTH, HEIGHT); } diff --git a/qtmips_gui/coreview/value.cpp b/qtmips_gui/coreview/value.cpp index 7dd1e6a..c7f87f7 100644 --- a/qtmips_gui/coreview/value.cpp +++ b/qtmips_gui/coreview/value.cpp @@ -34,6 +34,7 @@ ******************************************************************************/ #include "value.h" +#include "coreview_colors.h" #include "../fontsize.h" using namespace coreview; @@ -73,6 +74,8 @@ void Value::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __at painter->setBackgroundMode(Qt::OpaqueMode); if (!frame) painter->setPen(QColor(Qt::white)); + else + painter->setPen(QColor(BLOCK_OUTLINE_COLOR)); painter->drawRect(rect); painter->setPen(QColor(Qt::black)); painter->setBackgroundMode(Qt::TransparentMode); -- cgit v1.2.3