Add action for toggling VSRTL darkmode
MODIFY
external/VSRTL
external/VSRTL
-Subproject commit 744f4361767eca48b96d07a84b079aeef99e7499
+Subproject commit 414b9cc1e7d6acf76d98ec9408ad2af22fe03a79

MODIFY
resources/icons/icons.qrc
resources/icons/icons.qrc
<file>trace.svg</file>
<file>compass.svg</file>
<file>clear.svg</file>
+ <file>moon.svg</file>
</qresource>
</RCC>

ADD
resources/icons/moon.svg
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Capa_1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 312.812 312.812"
+ style="enable-background:new 0 0 312.812 312.812;"
+ xml:space="preserve"
+ sodipodi:docname="moon.svg"
+ inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"><metadata
+ id="metadata918"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs916" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1848"
+ inkscape:window-height="1016"
+ id="namedview914"
+ showgrid="false"
+ inkscape:zoom="2.6789253"
+ inkscape:cx="156.40601"
+ inkscape:cy="156.40601"
+ inkscape:window-x="72"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Capa_1" />
+<g
+ id="g881"
+ transform="matrix(0.85500348,0,0,0.85500348,26.319147,22.491643)"
+ style="fill:#333333">
+ <g
+ id="g879"
+ style="fill:#333333">
+ <path
+ d="m 305.2,178.159 c -3.2,-0.8 -6.4,0 -9.2,2 -10.4,8.8 -22.4,16 -35.6,20.8 -12.4,4.8 -26,7.2 -40.4,7.2 -32.4,0 -62,-13.2 -83.2,-34.4 -21.2,-21.2 -34.4,-50.8 -34.4,-83.2 0,-13.6 2.4,-26.8 6.4,-38.8 4.4,-12.8 10.8,-24.4 19.2,-34.4 3.6,-4.4 2.8,-10.8 -1.6,-14.4 -2.8,-2 -6,-2.8 -9.2,-2 -34,9.2 -63.6,29.6 -84.8,56.8 -20.4,26.8 -32.4,60 -32.4,96 0,43.6 17.6,83.2 46.4,112 28.8,28.8 68,46.4 112,46.4 36.8,0 70.8,-12.8 98,-34 27.6,-21.6 47.6,-52.4 56,-87.6 1.6,-5.6 -1.6,-11.2 -7.2,-12.4 z"
+ id="path877"
+ inkscape:connector-curvature="0"
+ style="fill:#333333" />
+ </g>
+</g>
+<g
+ id="g883"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g885"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g887"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g889"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g891"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g893"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g895"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g897"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g899"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g901"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g903"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g905"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g907"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g909"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+<g
+ id="g911"
+ transform="matrix(0.91971267,0,0,0.91971267,13.16974,7.8913469)">
+</g>
+</svg>
\ No newline at end of file

MODIFY
src/processortab.cpp
src/processortab.cpp
@@ -244,6 +244,16 @@ void ProcessorTab::setupSimulatorActions(QToolBar* controlToolbar) {
m_stageTableAction = new QAction(tableIcon, "Show stage table", this);
connect(m_stageTableAction, &QAction::triggered, this, &ProcessorTab::showStageTable);
m_toolbar->addAction(m_stageTableAction);
+
+ const QIcon moonIcon = QIcon(":/icons/moon.svg");
+ m_darkmodeAction = new QAction(moonIcon, "Toggle darkmode", this);
+ m_darkmodeAction->setCheckable(true);
+ connect(m_darkmodeAction, &QAction::toggled, m_vsrtlWidget, [=](bool checked) {
+ RipesSettings::setValue(RIPES_SETTING_DARKMODE, QVariant::fromValue(checked));
+ m_vsrtlWidget->setDarkmode(checked);
+ });
+ m_toolbar->addAction(m_darkmodeAction);
+ m_darkmodeAction->setChecked(RipesSettings::value(RIPES_SETTING_DARKMODE).toBool());
}
void ProcessorTab::updateStatistics() {
@@ -410,10 +420,10 @@ void ProcessorTab::updateInstructionLabels() {
QString instrString;
if (stageInfo.state != StageInfo::State::None) {
instrString = stageInfo.state == StageInfo::State::Flushed ? "nop (flush)" : "nop (stall)";
- instrLabel->setDefaultTextColor(Qt::red);
+ instrLabel->forceDefaultTextColor(Qt::red);
} else if (stageInfo.stage_valid) {
instrString = ProcessorHandler::get()->disassembleInstr(stageInfo.pc);
- instrLabel->setDefaultTextColor(QColor());
+ instrLabel->clearForcedDefaultTextColor();
}
instrLabel->setText(instrString);
}

MODIFY
src/processortab.h
src/processortab.h
@@ -86,6 +86,7 @@ private:
QAction* m_stageTableAction = nullptr;
QAction* m_reverseAction = nullptr;
QAction* m_resetAction = nullptr;
+ QAction* m_darkmodeAction = nullptr;
QSpinBox* m_autoClockInterval = nullptr;

MODIFY
src/ripessettings.h
src/ripessettings.h
@@ -23,6 +23,7 @@ namespace Ripes {
#define RIPES_SETTING_PROCESSOR_ID ("processor_id")
#define RIPES_SETTING_PROCESSOR_LAYOUT_ID ("processor_layout_id")
#define RIPES_SETTING_FOLLOW_EXEC ("follow_execution")
+#define RIPES_SETTING_DARKMODE ("darkmode")
// ============= Definitions of all default settings within Ripes ==============
const static std::map<QString, QVariant> s_defaultSettings = {
@@ -42,7 +43,8 @@ const static std::map<QString, QVariant> s_defaultSettings = {
{RIPES_SETTING_VIEW_ZOOM, 250},
{RIPES_SETTING_PROCESSOR_ID, QVariant() /* Let processorhandler define default */},
{RIPES_SETTING_PROCESSOR_LAYOUT_ID, 0},
- {RIPES_SETTING_FOLLOW_EXEC, "true"}};
+ {RIPES_SETTING_FOLLOW_EXEC, "true"},
+ {RIPES_SETTING_DARKMODE, false}};
/**
* @brief The SettingObserver class

Add action for toggling VSRTL darkmode