aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/coreview
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-10-10 07:39:50 +0200
committerGitHub <noreply@github.com>2019-10-10 07:39:50 +0200
commit9aa03382ea46f87f336dd8f55bcd17423d1632b5 (patch)
treec1665ae87bc5a1208aa353ad9df2a44185b8e84c /qtmips_gui/coreview
parent7ec180881848027fbad6c7dd84b883c26643103f (diff)
parent2bfe22d935cb7d7c4f6c75f79ecfb568e75dc5d0 (diff)
downloadqtmips-9aa03382ea46f87f336dd8f55bcd17423d1632b5.tar.gz
qtmips-9aa03382ea46f87f336dd8f55bcd17423d1632b5.tar.bz2
qtmips-9aa03382ea46f87f336dd8f55bcd17423d1632b5.zip
Merge pull request #3 from MadCatX/dark_themes_compat
Improve UI compatbility with dark color schemes
Diffstat (limited to 'qtmips_gui/coreview')
-rw-r--r--qtmips_gui/coreview/adder.cpp6
-rw-r--r--qtmips_gui/coreview/alu.cpp6
-rw-r--r--qtmips_gui/coreview/and.cpp5
-rw-r--r--qtmips_gui/coreview/coreview_colors.h43
-rw-r--r--qtmips_gui/coreview/latch.cpp5
-rw-r--r--qtmips_gui/coreview/logicblock.cpp5
-rw-r--r--qtmips_gui/coreview/memory.cpp5
-rw-r--r--qtmips_gui/coreview/programcounter.cpp5
-rw-r--r--qtmips_gui/coreview/registers.cpp5
-rw-r--r--qtmips_gui/coreview/value.cpp3
10 files changed, 88 insertions, 0 deletions
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 <cmath>
@@ -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 <cmath>
@@ -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 <cmath>
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<cynerd@email.cz>
+ * Copyright (c) 2019 Pavel Pisa <pisa@cmp.felk.cvut.cz>
+ *
+ * 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 <QColor>
+
+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 <cmath>
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 <cmath>
@@ -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 <cmath>
@@ -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 <cmath>
@@ -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 <cmath>
@@ -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);