-
Notifications
You must be signed in to change notification settings - Fork 35
feat: track stand assignment source with colour-coded tag items #610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
41871aa
feat: Add stand assignment source tracking with runtime-configurable …
MrAdder 355d479
refactor: Corrections from Personal Review
MrAdder c547eee
feat: Enhance StandEventHandler with source tracking and update relat…
MrAdder 4e80ae9
refactor: Update StandColourConfiguration and StandEventHandler for i…
MrAdder c1f98b7
feat: Add StandAssignmentSource and StandColourConfiguration files to…
MrAdder bc151ca
chore: consolidate code changes for improved maintainability
MrAdder 6ff5c17
feat: Add StandEventHandlerConfig to StandEventHandlerTest for enhanc…
MrAdder 2ace07d
refactor: Simplify StandEventHandlerTest by consolidating JSON object…
MrAdder 2d47b34
Test fixes for clang-format
MrAdder 1c2df0b
dev: Testing a potential fix
MrAdder 9ae9b0d
added the menu i forgot earlier needs rework a little
MrAdder 7a35e4d
Fix Test and Color chooser titles
MrAdder b4ed9af
Formatting
MrAdder 7ed5e63
Restrict color selector
MrAdder 14df754
Removal of UI and Save components leaving load for customisation
MrAdder b6870e2
remove code smells from sonarqube
MrAdder d3e0c79
formatting
MrAdder 18c8efe
formatting fix hopefully
MrAdder 4abd622
Format fix
MrAdder 7dbcca4
ok this is after running clang-format
MrAdder 57aadd3
would help if i removed dryrun
MrAdder df008d3
formatting
MrAdder 0888907
attempt at deduplication
MrAdder 0d784e2
attempt fix
MrAdder c0c6eff
Some fixes from review
MrAdder 25f50a3
further review fixes
MrAdder 70c7c32
Update StandEventHandler.cpp
MrAdder 8ac14b6
Sonarqube Fixes
MrAdder e585052
Build fix for test
MrAdder b1d430b
Woops Tag overlap
MrAdder d0cd447
Correct tests and rename Web Services to Technology
MrAdder b6b1b91
Formatting
MrAdder e10e3fb
revert web services change
MrAdder 8cdca49
Potential final push
MrAdder 5a0b9e5
Formatting
MrAdder a36605d
Fix for build and sonar
MrAdder b2593c6
Test fixes
MrAdder f8d08b7
Use 'using enum' for StandAssignment::Source
MrAdder 9933b2d
formatting
MrAdder 52a0c19
sonarqube fixes
MrAdder acbe4cc
Revert "sonarqube fixes"
MrAdder 238c94e
Refactor stand assignment source handling
MrAdder b4bd89a
Remove default arg from GetColourEntry call
MrAdder 26c5698
Handle unknown System mode with default case
MrAdder 3993f59
Return 'unknown' for default allocator case
MrAdder 47a78db
Pad source labels with trailing space
MrAdder 410e8aa
Revert AircraftFlowMeasureMapTest
MrAdder 2661e67
Remove trailing spaces from source shorthands
MrAdder f1ce398
Refactor stands: colours & event handler
MrAdder 49c8c1f
Removed extra brace
MrAdder 6cda582
Fix include path and array size
MrAdder 047ceec
Simplify sourceColourDefaults initialization
MrAdder 24134a5
Use using enum for StandAssignment::Source
MrAdder d9f8727
sonar
MrAdder f8df1d8
Use using enum for StandAssignment::Source
MrAdder 00d66cd
Use DEFAULT_COLOUR for Unknown stand source
MrAdder e0eb3da
Update src/plugin/stands/StandColourConfiguration.cpp
MrAdder 34abef7
Update src/plugin/stands/StandColourConfiguration.h
MrAdder e30e230
Fix initializer list and format comments
MrAdder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| #pragma once | ||
| #include <string> | ||
| #include <string_view> | ||
|
|
||
| namespace UKControllerPlugin::Stands { | ||
| /* | ||
| Represents a stand assignment with its source (how it was assigned). | ||
| */ | ||
| struct StandAssignment | ||
| { | ||
| enum class Source | ||
| { | ||
| Unknown, | ||
| User, | ||
| ReservationAllocator, | ||
| VaaAllocator, | ||
| SystemAuto, | ||
| }; | ||
|
|
||
| int standId; | ||
|
|
||
| // The source of the assignment (user, reservation_allocator, vaa_allocator, system_auto) | ||
| Source source; | ||
|
|
||
| [[nodiscard]] static constexpr auto ToString(Source source) -> std::string_view | ||
| { | ||
| using enum Source; | ||
|
|
||
| switch (source) { | ||
| case Unknown: | ||
| return "unknown"; | ||
| case User: | ||
| return "user"; | ||
| case ReservationAllocator: | ||
| return "reservation_allocator"; | ||
| case VaaAllocator: | ||
| return "vaa_allocator"; | ||
| case SystemAuto: | ||
| return "system_auto"; | ||
| default: | ||
| return "unknown"; | ||
| } | ||
| } | ||
|
|
||
| [[nodiscard]] static constexpr auto FromString(std::string_view source) -> Source | ||
| { | ||
| using enum Source; | ||
|
|
||
| if (source == "user") { | ||
| return User; | ||
| } | ||
| if (source == "reservation_allocator") { | ||
| return ReservationAllocator; | ||
| } | ||
| if (source == "vaa_allocator") { | ||
| return VaaAllocator; | ||
| } | ||
|
|
||
| if (source == "system_auto") { | ||
| return SystemAuto; | ||
| } | ||
|
|
||
| return Unknown; | ||
| } | ||
| }; | ||
| } // namespace UKControllerPlugin::Stands | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| #include "StandColourConfiguration.h" | ||
| #include "StandAssignmentSource.h" | ||
| #include "euroscope/UserSetting.h" | ||
| #include "helper/HelperFunctions.h" | ||
| #include "log/LoggerFunctions.h" | ||
| #include <array> | ||
|
|
||
| namespace UKControllerPlugin::Stands { | ||
|
|
||
| StandColourConfiguration::StandColourConfiguration(UKControllerPlugin::Euroscope::UserSetting& setting) | ||
| : StandColourConfiguration(&setting) | ||
| { | ||
| } | ||
|
|
||
| StandColourConfiguration::StandColourConfiguration() : StandColourConfiguration(nullptr) | ||
| { | ||
| } | ||
|
|
||
| StandColourConfiguration::StandColourConfiguration(UKControllerPlugin::Euroscope::UserSetting* userSetting) | ||
| : userSetting(userSetting), sourceColours( | ||
| {{StandAssignment::Source::User, DEFAULT_USER_COLOUR}, | ||
| {StandAssignment::Source::ReservationAllocator, DEFAULT_RESERVATION_COLOUR}, | ||
| {StandAssignment::Source::VaaAllocator, DEFAULT_VAA_COLOUR}, | ||
| {StandAssignment::Source::SystemAuto, DEFAULT_SYSTEM_COLOUR}}) | ||
| { | ||
| LoadFromUserSettings(); | ||
| } | ||
|
MrAdder marked this conversation as resolved.
|
||
|
|
||
| auto StandColourConfiguration::GetColourForSource(StandAssignment::Source source) const -> COLORREF | ||
| { | ||
| if (auto it = sourceColours.find(source); it != sourceColours.cend()) { | ||
| return it->second; | ||
| } | ||
|
|
||
| return DEFAULT_COLOUR; | ||
| } | ||
|
|
||
| void StandColourConfiguration::LoadFromUserSettings() | ||
| { | ||
| if (!this->userSetting) { | ||
| return; | ||
| } | ||
|
|
||
| using enum UKControllerPlugin::Stands::StandAssignment::Source; | ||
|
Check warning on line 44 in src/plugin/stands/StandColourConfiguration.cpp
|
||
|
|
||
| constexpr std::array<StandAssignment::Source, 5> sourceColourDefaults = { | ||
| {Unknown, User, ReservationAllocator, VaaAllocator, SystemAuto}}; | ||
|
|
||
| for (const auto source : sourceColourDefaults) { | ||
| const std::string key = std::string(SETTING_PREFIX) + std::string(StandAssignment::ToString(source)); | ||
| if (this->userSetting->HasEntry(key)) { | ||
| this->sourceColours[source] = this->userSetting->GetColourEntry(key); | ||
| } | ||
| } | ||
|
|
||
| LogInfo("Loaded stand assignment source colours from UserSettings"); | ||
| } | ||
|
|
||
| } // namespace UKControllerPlugin::Stands | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| #pragma once | ||
| #include "StandAssignmentSource.h" | ||
| #include <map> | ||
| #include <string> | ||
| #include <string_view> | ||
| #include <Windows.h> | ||
|
|
||
| namespace UKControllerPlugin::Euroscope { | ||
| class UserSetting; | ||
| } | ||
|
|
||
| namespace UKControllerPlugin::Stands { | ||
| /* | ||
| Manages colour configuration for stand assignments based on their source. | ||
| Colours are persisted to EuroScope UserSettings and can be customized without recompilation. | ||
| */ | ||
| class StandColourConfiguration | ||
| { | ||
| public: | ||
| explicit StandColourConfiguration(UKControllerPlugin::Euroscope::UserSetting& userSetting); | ||
| explicit StandColourConfiguration(); | ||
|
|
||
| /* | ||
| Get the colour for a given assignment source. | ||
| Returns a default grey if source is not found or not set. | ||
| */ | ||
| [[nodiscard]] auto GetColourForSource(StandAssignment::Source source) const -> COLORREF; | ||
|
|
||
| /* | ||
| Load colours from UserSettings, with fallback to defaults. | ||
| */ | ||
| void LoadFromUserSettings(); | ||
|
|
||
| private: | ||
| explicit StandColourConfiguration(UKControllerPlugin::Euroscope::UserSetting* userSetting); | ||
|
|
||
| // Reference to user settings for persistence (null if not available) | ||
| UKControllerPlugin::Euroscope::UserSetting* userSetting; | ||
|
MrAdder marked this conversation as resolved.
|
||
|
|
||
| // Map of source to RGB colour | ||
| std::map<StandAssignment::Source, COLORREF> sourceColours; | ||
|
|
||
| // Default colour (grey) for unknown sources | ||
| static constexpr COLORREF DEFAULT_COLOUR = RGB(204, 204, 204); | ||
|
|
||
| // Default colours if not configured | ||
| static constexpr COLORREF DEFAULT_USER_COLOUR = RGB(255, 149, 41); // orange | ||
| static constexpr COLORREF DEFAULT_RESERVATION_COLOUR = RGB(255, 216, 0); // yellow | ||
| static constexpr COLORREF DEFAULT_VAA_COLOUR = RGB(255, 216, 0); // yellow | ||
| static constexpr COLORREF DEFAULT_SYSTEM_COLOUR = RGB(255, 255, 255); // white | ||
|
|
||
| // UserSetting key prefix for colours | ||
| static constexpr std::string_view SETTING_PREFIX = "stand_colour_"; | ||
| }; | ||
| } // namespace UKControllerPlugin::Stands | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.