diff --git a/external/VSRTL b/external/VSRTL index 9d808febc..1b8be3b85 160000 --- a/external/VSRTL +++ b/external/VSRTL @@ -1 +1 @@ -Subproject commit 9d808febca3805e277cf380cf5d0326ac785f7e2 +Subproject commit 1b8be3b8549c21e95eecace1290dba3cc4e3a40d diff --git a/src/cachesim/cacheplotwidget.cpp b/src/cachesim/cacheplotwidget.cpp index 95503932a..b98b14eea 100644 --- a/src/cachesim/cacheplotwidget.cpp +++ b/src/cachesim/cacheplotwidget.cpp @@ -120,13 +120,13 @@ void CachePlotWidget::setCache(std::shared_ptr cache) { m_plot = new QChart(); m_series = new QLineSeries(m_plot); auto defaultPen = m_series->pen(); // Inherit default pen state - defaultPen.setColor(QColor(FoundersRock)); + defaultPen.setColor(Colors::FoundersRock); m_series->setName("Total"); m_series->setPen(defaultPen); m_plot->addSeries(m_series); m_mavgSeries = new QLineSeries(m_plot); m_mavgSeries->setName("Moving avg."); - defaultPen.setColor(QColor(Medalist)); + defaultPen.setColor(Colors::Medalist); m_mavgSeries->setPen(defaultPen); m_plot->addSeries(m_mavgSeries); m_plot->createDefaultAxes(); diff --git a/src/cachesim/callout.cpp b/src/cachesim/callout.cpp index 76d0e1942..ebd972b9e 100644 --- a/src/cachesim/callout.cpp +++ b/src/cachesim/callout.cpp @@ -95,7 +95,7 @@ void Callout::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, Q path.lineTo(point2); path = path.simplified(); } - painter->setBrush(QColor(255, 255, 255)); + painter->setBrush(QColorConstants::White); painter->drawPath(path); painter->drawText(m_textRect, m_text); painter->restore(); diff --git a/src/defines.h b/src/defines.h index 1943bfad5..eef0de3d4 100644 --- a/src/defines.h +++ b/src/defines.h @@ -1,9 +1,11 @@ #pragma once +#include #include #include #include #include + #include #include #include @@ -46,14 +48,13 @@ class StagePCS { PC WB; }; -enum Colors { - // Berkeley primary color palette - BerkeleyBlue = 0x003262, - FoundersRock = 0x3B7EA1, - CaliforniaGold = 0xFDB515, - Medalist = 0xC4820E, - FlatGreen = 0x4cde75 -}; +namespace Colors { +constexpr QColor BerkeleyBlue = {0x00, 0x32, 0x62}; +constexpr QColor FoundersRock = {0x3B, 0x7E, 0xA1}; +constexpr QColor CaliforniaGold = {0xFD, 0xB5, 0x15}; +constexpr QColor Medalist = {0xC4, 0x82, 0x0E}; +constexpr QColor FlatGreen = {0x4c, 0xde, 0x75}; +}; // namespace Colors namespace { static QMap initDisplayTypes() { diff --git a/src/editor/codeeditor.cpp b/src/editor/codeeditor.cpp index 5832f3474..4983bb1c7 100644 --- a/src/editor/codeeditor.cpp +++ b/src/editor/codeeditor.cpp @@ -233,7 +233,7 @@ void CodeEditor::highlightCurrentLine() { if (!isReadOnly()) { QTextEdit::ExtraSelection selection; - QColor lineColor = QColor(Colors::Medalist).lighter(160); + QColor lineColor = Colors::Medalist.lighter(160); selection.format.setBackground(lineColor); selection.format.setProperty(QTextFormat::FullWidthSelection, true); @@ -247,7 +247,7 @@ void CodeEditor::highlightCurrentLine() { void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent* event) { QPainter painter(m_lineNumberArea); - painter.fillRect(event->rect(), QColor(Qt::lightGray).lighter(120)); + painter.fillRect(event->rect(), QColorConstants::LightGray.lighter(120)); QTextBlock block = firstVisibleBlock(); int blockNumber = block.blockNumber(); @@ -257,7 +257,7 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent* event) { while (block.isValid() && top <= event->rect().bottom()) { if (block.isVisible() && bottom >= event->rect().top()) { QString number = QString::number(blockNumber + 1); - painter.setPen(QColor(Qt::gray).darker(130)); + painter.setPen(QColorConstants::Gray.darker(130)); painter.drawText(0, top, m_lineNumberArea->width() - 3, fontMetrics().height(), Qt::AlignRight, number); } diff --git a/src/editor/csyntaxhighlighter.cpp b/src/editor/csyntaxhighlighter.cpp index 19c266646..6982fbd4e 100644 --- a/src/editor/csyntaxhighlighter.cpp +++ b/src/editor/csyntaxhighlighter.cpp @@ -43,24 +43,24 @@ CSyntaxHighlighter::CSyntaxHighlighter(QTextDocument* parent, std::shared_ptrpalette(); if (!valid) { - palette.setColor(QPalette::Base, QColor(0xEB8383)); + palette.setColor(QPalette::Base, QColor{0xEB, 0x83, 0x83}); } w->setPalette(palette); } diff --git a/src/programviewer.cpp b/src/programviewer.cpp index 28b11c22f..8f5046156 100644 --- a/src/programviewer.cpp +++ b/src/programviewer.cpp @@ -94,7 +94,7 @@ void ProgramViewer::setFollowEnabled(bool enabled) { void ProgramViewer::updateHighlightedAddresses() { const unsigned stages = ProcessorHandler::getProcessor()->stageCount(); - QColor bg = QColor(Qt::red).lighter(120); + QColor bg = QColorConstants::Red.lighter(120); const int decRatio = 100 + 80 / stages; QList highlights; std::set highlightedPCs; @@ -162,8 +162,8 @@ void ProgramViewer::breakpointAreaPaintEvent(QPaintEvent* event) { // redrawing the visible breakpoint area auto area = m_breakpointArea->rect(); QLinearGradient gradient = QLinearGradient(area.topLeft(), area.bottomRight()); - gradient.setColorAt(0, QColor(Colors::FoundersRock).lighter(120)); - gradient.setColorAt(1, QColor(Colors::FoundersRock)); + gradient.setColorAt(0, Colors::FoundersRock.lighter(120)); + gradient.setColorAt(1, Colors::FoundersRock); painter.fillRect(area, gradient); diff --git a/src/registermodel.cpp b/src/registermodel.cpp index ef9c3fcce..075a30db7 100644 --- a/src/registermodel.cpp +++ b/src/registermodel.cpp @@ -82,7 +82,7 @@ QVariant RegisterModel::data(const QModelIndex& index, int role) const { if (role == Qt::ToolTipRole) { return tooltipData(idx); } else if (role == Qt::BackgroundRole && index.row() == m_mostRecentlyModifiedReg) { - return QBrush(QColor(0xFDB515)); + return QBrush(QColor{0xFD, 0xB5, 0x15}); } switch (index.column()) { diff --git a/src/ripessettings.cpp b/src/ripessettings.cpp index d5bdbf1b6..3bc9c9843 100644 --- a/src/ripessettings.cpp +++ b/src/ripessettings.cpp @@ -15,10 +15,10 @@ const std::map s_defaultSettings = { {RIPES_SETTING_CCARGS, "-O0"}, {RIPES_SETTING_LDARGS, "-static-libgcc -lm"}, // Ensure statically linked executable + link with math library {RIPES_SETTING_CONSOLEECHO, "true"}, - {RIPES_SETTING_CONSOLEBG, QColor(Qt::white)}, - {RIPES_SETTING_CONSOLEFONTCOLOR, QColor(Qt::black)}, + {RIPES_SETTING_CONSOLEBG, QColorConstants::White}, + {RIPES_SETTING_CONSOLEFONTCOLOR, QColorConstants::Black}, {RIPES_SETTING_CONSOLEFONT, QVariant() /* Let Console define its own default font */}, - {RIPES_SETTING_CONSOLEFONT, QColor(Qt::black)}, + {RIPES_SETTING_CONSOLEFONT, QColorConstants::Black}, {RIPES_SETTING_INDENTAMT, 4}, {RIPES_SETTING_ASSEMBLER_TEXTSTART, 0x0}, diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index f3d6161d1..fc1189f65 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -241,10 +241,10 @@ QWidget* SettingsDialog::createCompilerPage() { void SettingsDialog::CCPathChanged(CCManager::CCRes res) { QPalette palette = this->palette(); if (res.success) { - palette.setColor(QPalette::Base, QColor(Qt::green).lighter()); + palette.setColor(QPalette::Base, QColorConstants::Green.lighter()); m_compileInfoHeader->setText("Compile command:"); } else { - palette.setColor(QPalette::Base, QColor(Qt::red).lighter()); + palette.setColor(QPalette::Base, QColorConstants::Red.lighter()); m_compileInfoHeader->setText("Error:"); } m_ccpath->setPalette(palette);