From aa06dc912e20c982e44c92cb0e281ddcf9b665ad Mon Sep 17 00:00:00 2001 From: Reinder Feenstra Date: Mon, 20 Oct 2025 10:47:15 +0200 Subject: [PATCH] [board] Added grid color to color scheme --- client/src/board/boardareawidget.cpp | 5 +- client/src/board/boardcolorscheme.cpp | 84 ++++++++++++++------------- client/src/board/boardcolorscheme.hpp | 3 +- 3 files changed, 47 insertions(+), 45 deletions(-) diff --git a/client/src/board/boardareawidget.cpp b/client/src/board/boardareawidget.cpp index 8a930515..10b0d2c9 100644 --- a/client/src/board/boardareawidget.cpp +++ b/client/src/board/boardareawidget.cpp @@ -605,7 +605,6 @@ void BoardAreaWidget::paintEvent(QPaintEvent* event) const QColor backgroundColor50{0x10, 0x10, 0x10, 0x80}; const QColor backgroundColorError50{0xff, 0x00, 0x00, 0x80}; - const QColor gridColor{0x40, 0x40, 0x40}; const QColor gridColorHighlight{Qt::white}; const QColor gridColorError{Qt::red}; const int tileSize = getTileSize(); @@ -624,7 +623,7 @@ void BoardAreaWidget::paintEvent(QPaintEvent* event) break; case BoardAreaGrid::Line: - painter.setPen(gridColor); + painter.setPen(m_colorScheme->grid); for(int y = viewport.top(); y <= viewport.bottom(); y += gridSize) painter.drawLine(viewport.left(), y, viewport.right(), y); for(int x = viewport.left(); x <= viewport.right(); x += gridSize) @@ -632,7 +631,7 @@ void BoardAreaWidget::paintEvent(QPaintEvent* event) break; case BoardAreaGrid::Dot: - painter.setPen(gridColor); + painter.setPen(m_colorScheme->grid); for(int y = viewport.top(); y <= viewport.bottom(); y += gridSize) for(int x = viewport.left(); x <= viewport.right(); x += gridSize) painter.drawPoint(x, y); diff --git a/client/src/board/boardcolorscheme.cpp b/client/src/board/boardcolorscheme.cpp index cfb5fedc..53a79d9a 100644 --- a/client/src/board/boardcolorscheme.cpp +++ b/client/src/board/boardcolorscheme.cpp @@ -3,7 +3,7 @@ * * This file is part of the traintastic source code. * - * Copyright (C) 2021,2023-2024 Reinder Feenstra + * Copyright (C) 2021-2025 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -23,47 +23,49 @@ #include "boardcolorscheme.hpp" const BoardColorScheme BoardColorScheme::dark = { - /*.background =*/ {0x10, 0x10, 0x10}, - /*.foreground =*/ {0xFF, 0xFF, 0xFF}, - /*.track =*/ {0xC0, 0xC0, 0xC0}, - /*.trackDisabled =*/ {0x40, 0x40, 0x40}, - /*.trackReserved =*/ {Qt::yellow}, - /*.trackReservedDisabled =*/ {0x99, 0x99, 0x00}, - /*.blockFree =*/ {0x66, 0xC6, 0x66}, - /*.blockReserved =*/ {Qt::yellow}, - /*.blockOccupied =*/ {0xC6, 0x66, 0x66}, - /*.blockUnknown =*/ {0x66, 0x66, 0x66}, - /*.blockText =*/ {Qt::black}, - /*.sensorFree =*/ {0x66, 0xC6, 0x66}, - /*.sensorOccupied =*/ {0xC6, 0x66, 0x66}, - /*.sensorIdle =*/ {0x40, 0x40, 0x40}, - /*.sensorTriggered =*/ {0x00, 0xBF, 0xFF}, - /*.sensorUnknown =*/ {0x10, 0x10, 0x10}, - /*.turnoutState =*/ {Qt::blue}, - /*.decouplerDeactivated =*/ {0x10, 0x10, 0x10}, - /*.decouplerActivated =*/ {0x00, 0xBF, 0xFF}, - /*.blockHighlightAlpha =*/ 0.2, + .background = {0x10, 0x10, 0x10}, + .foreground = {0xFF, 0xFF, 0xFF}, + .grid = {0x40, 0x40, 0x40}, + .track = {0xC0, 0xC0, 0xC0}, + .trackDisabled = {0x40, 0x40, 0x40}, + .trackReserved = {Qt::yellow}, + .trackReservedDisabled = {0x99, 0x99, 0x00}, + .blockFree = {0x66, 0xC6, 0x66}, + .blockReserved = {Qt::yellow}, + .blockOccupied = {0xC6, 0x66, 0x66}, + .blockUnknown = {0x66, 0x66, 0x66}, + .blockText = {Qt::black}, + .sensorFree = {0x66, 0xC6, 0x66}, + .sensorOccupied = {0xC6, 0x66, 0x66}, + .sensorIdle = {0x40, 0x40, 0x40}, + .sensorTriggered = {0x00, 0xBF, 0xFF}, + .sensorUnknown = {0x10, 0x10, 0x10}, + .turnoutState = {Qt::blue}, + .decouplerDeactivated = {0x10, 0x10, 0x10}, + .decouplerActivated = {0x00, 0xBF, 0xFF}, + .blockHighlightAlpha = 0.2, }; const BoardColorScheme BoardColorScheme::light = { - /*.background =*/ {0xF5, 0xF5, 0xF5}, - /*.foreground =*/ {0x00, 0x00, 0x00}, - /*.track =*/ {0x00, 0x00, 0x00}, - /*.trackDisabled =*/ {0xA0, 0xA0, 0xA0}, - /*.trackReserved =*/ {Qt::yellow}, - /*.trackReservedDisabled =*/ {0x99, 0x99, 0x00}, - /*.blockFree =*/ {0x44, 0xC6, 0x44}, - /*.blockReserved =*/ {Qt::yellow}, - /*.blockOccupied =*/ {0xC6, 0x44, 0x44}, - /*.blockUnknown =*/ {0x88, 0x88, 0x88}, - /*.blockText =*/ {Qt::white}, - /*.sensorFree =*/ {0x44, 0xC6, 0x44}, - /*.sensorOccupied =*/ {0xC6, 0x44, 0x44}, - /*.sensorIdle =*/ {0x40, 0x40, 0x40}, - /*.sensorTriggered =*/ {0x00, 0xBF, 0xFF}, - /*.sensorUnknown =*/ {0x10, 0x10, 0x10}, - /*.turnoutState =*/ {Qt::cyan}, - /*.decouplerDeactivated =*/ {0xF5, 0xF5, 0xF5}, - /*.decouplerActivated =*/ {0x00, 0xBF, 0xFF}, - /*.blockHighlightAlpha =*/ 0.3, + .background = {0xF5, 0xF5, 0xF5}, + .foreground = {0x00, 0x00, 0x00}, + .grid = {0x40, 0x40, 0x40}, + .track = {0x00, 0x00, 0x00}, + .trackDisabled = {0xA0, 0xA0, 0xA0}, + .trackReserved = {Qt::yellow}, + .trackReservedDisabled = {0x99, 0x99, 0x00}, + .blockFree = {0x44, 0xC6, 0x44}, + .blockReserved = {Qt::yellow}, + .blockOccupied = {0xC6, 0x44, 0x44}, + .blockUnknown = {0x88, 0x88, 0x88}, + .blockText = {Qt::white}, + .sensorFree = {0x44, 0xC6, 0x44}, + .sensorOccupied = {0xC6, 0x44, 0x44}, + .sensorIdle = {0x40, 0x40, 0x40}, + .sensorTriggered = {0x00, 0xBF, 0xFF}, + .sensorUnknown = {0x10, 0x10, 0x10}, + .turnoutState = {Qt::cyan}, + .decouplerDeactivated = {0xF5, 0xF5, 0xF5}, + .decouplerActivated = {0x00, 0xBF, 0xFF}, + .blockHighlightAlpha = 0.3, }; diff --git a/client/src/board/boardcolorscheme.hpp b/client/src/board/boardcolorscheme.hpp index 3e8549cf..3fa32a06 100644 --- a/client/src/board/boardcolorscheme.hpp +++ b/client/src/board/boardcolorscheme.hpp @@ -3,7 +3,7 @@ * * This file is part of the traintastic source code. * - * Copyright (C) 2021,2023-2024 Reinder Feenstra + * Copyright (C) 2021-2025 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -32,6 +32,7 @@ struct BoardColorScheme const QColor background; const QColor foreground; + const QColor grid; const QColor track; const QColor trackDisabled; const QColor trackReserved;