From f42a46e53f5e4ebbf7f299687edc4f7a504f7787 Mon Sep 17 00:00:00 2001 From: Vincent Maas Date: Sun, 1 Sep 2024 16:24:05 +0200 Subject: [PATCH] fix issues with new UI, add color profiles, add sdr brightness for AMD --- ColorControl.UI/Blazor.cs | 5 +- ColorControl.UI/ColorControl.UI.csproj | 16 + ColorControl.UI/Components/App.razor | 26 +- .../Components/Layout/NavMenu.razor | 25 +- .../Components/Layout/TopMenu.razor | 2 +- .../Components/Pages/AMD/AmdPresetPage.razor | 6 +- .../Components/Pages/AMD/AmdSettings.razor | 4 +- .../Components/Pages/AMD/AmdSummary.razor | 20 +- .../Pages/ColorProfile/ColorProfilePage.razor | 452 +++ .../ColorProfile/ColorProfileSummary.razor | 301 ++ .../Pages/Game/GamePresetPage.razor | 4 +- .../Components/Pages/Game/GameSettings.razor | 4 +- .../Components/Pages/Game/GameSummary.razor | 18 +- .../Pages/Generic/ConfirmModal.razor | 7 +- .../Components/Pages/Generic/FieldDefs.razor | 2 +- .../Pages/Generic/FieldsModal.razor | 4 +- .../Components/Pages/Generic/FlagsInput.razor | 2 +- .../Generic/NotificationsComponent.razor | 96 + .../Pages/Generic/ShortcutInput.razor | 2 +- .../Components/Pages/Generic/StepsInput.razor | 2 +- .../Pages/Generic/TriggerInput.razor | 2 +- ColorControl.UI/Components/Pages/Home.razor | 39 +- ColorControl.UI/Components/Pages/Info.razor | 73 +- .../Components/Pages/LG/LgDevicePage.razor | 4 +- .../Pages/LG/LgExecuteActionModal.razor | 2 +- .../Components/Pages/LG/LgPresetPage.razor | 4 +- .../Components/Pages/LG/LgSettings.razor | 2 +- .../Components/Pages/LG/LgSummary.razor | 20 +- .../Components/Pages/Logging.razor | 9 +- .../Pages/Nvidia/NvidiaDithering.razor | 2 +- .../Pages/Nvidia/NvidiaDriverSettings.razor | 19 +- .../Pages/Nvidia/NvidiaPreset.razor | 57 +- .../Pages/Nvidia/NvidiaSettings.razor | 4 +- .../Pages/Nvidia/NvidiaSummary.razor | 101 +- .../Components/Pages/Options.razor | 10 +- .../Pages/Samsung/SamsungDevicePage.razor | 4 +- .../Pages/Samsung/SamsungPresetPage.razor | 4 +- .../Pages/Samsung/SamsungServiceMenu.razor | 2 +- .../Pages/Samsung/SamsungSettings.razor | 2 +- .../Pages/Samsung/SamsungSummary.razor | 18 +- ColorControl.UI/Constants.cs | 11 + .../Extensions/GeneralExtensions.cs | 23 + .../Extensions/PresetExtensions.cs | 50 +- ColorControl.UI/NotificationDto.cs | 26 + ColorControl.UI/Services/JSHelper.cs | 47 + .../Services/NotificationService.cs | 26 + .../Services/RpcUiClientService.cs | 89 + ColorControl.UI/wwwroot/app.css | 6 +- .../wwwroot/bootstrap/bootstrap.min.css | 7 - .../wwwroot/bootstrap/bootstrap.min.css.map | 1 - ColorControl.UI/wwwroot/helper.js | 17 + ColorControl/ColorControl.csproj | 4 +- ColorControl/MainForm.cs | 669 ++-- ColorControl/MainWorker.cs | 7 +- ColorControl/Program.cs | 7 + ColorControl/Services/AMD/AmdPanel.cs | 1350 +++---- ColorControl/Services/AMD/AmdService.cs | 1072 +++--- .../Services/Common/ColorProfileService.cs | 343 ++ .../Services/Common/OptionsService.cs | 36 +- ColorControl/Services/Common/ServiceBase.cs | 687 ++-- .../Services/Common/ServiceManager.cs | 6 +- ColorControl/Services/Common/UpdateManager.cs | 185 +- .../Services/GameLauncher/GameService.cs | 9 +- ColorControl/Services/LG/LgService.cs | 2416 ++++++------ ColorControl/Services/NVIDIA/NvPanel.cs | 36 +- ColorControl/Services/NVIDIA/NvService.cs | 3403 +++++++++-------- .../Services/Samsung/SamsungService.cs | 1816 ++++----- ColorControl/XForms/BrowserWindow.xaml | 2 +- ColorControl/XForms/BrowserWindow.xaml.cs | 20 +- ColorControl/XForms/ColorProfileViewModel.cs | 453 +-- .../XForms/ColorProfileWindow.xaml.cs | 364 +- MHC2Gen/DisplayEnums.cs | 41 + MHC2Gen/GenerateProfileCommand.cs | 43 +- MHC2Gen/IccContext.cs | 2342 ++++++------ MHC2Gen/MHC2Wrapper.cs | 3 + MHC2Gen/Primaries.cs | 86 +- MHC2Gen/ST2084.cs | 58 +- Nspector/Common/DrsSettingsService.cs | 1366 +++---- .../Structures/PathAdvancedTargetInfo.cs | 23 +- README.md | 50 +- Shared/Common/GlobalContext.cs | 90 +- Shared/Common/InfoDto.cs | 2 +- Shared/Common/PipeUtils.cs | 213 +- Shared/Common/UpdateInfoDto.cs | 9 + Shared/Common/Utils.cs | 1446 ++++--- Shared/Contracts/AMD/AmdPreset.cs | 4 +- .../Contracts/DisplayInfo/ColorProfileDto.cs | 48 + .../Contracts/DisplayInfo/DisplayInfoDto.cs | 81 + Shared/Contracts/LG/LgPreset.cs | 183 +- Shared/Contracts/ModuleDto.cs | 30 +- Shared/Contracts/NVIDIA/NvPreset.cs | 1047 ++--- Shared/Forms/MessageForms.cs | 33 +- Shared/Native/CCD.cs | 15 +- Shared/Services/RpcServerService.cs | 300 +- Shared/Services/RpcUiClientService.cs | 57 - 95 files changed, 12129 insertions(+), 10005 deletions(-) create mode 100644 ColorControl.UI/Components/Pages/ColorProfile/ColorProfilePage.razor create mode 100644 ColorControl.UI/Components/Pages/ColorProfile/ColorProfileSummary.razor create mode 100644 ColorControl.UI/Components/Pages/Generic/NotificationsComponent.razor create mode 100644 ColorControl.UI/Constants.cs create mode 100644 ColorControl.UI/Extensions/GeneralExtensions.cs create mode 100644 ColorControl.UI/NotificationDto.cs create mode 100644 ColorControl.UI/Services/JSHelper.cs create mode 100644 ColorControl.UI/Services/NotificationService.cs create mode 100644 ColorControl.UI/Services/RpcUiClientService.cs delete mode 100644 ColorControl.UI/wwwroot/bootstrap/bootstrap.min.css delete mode 100644 ColorControl.UI/wwwroot/bootstrap/bootstrap.min.css.map create mode 100644 ColorControl.UI/wwwroot/helper.js create mode 100644 ColorControl/Services/Common/ColorProfileService.cs create mode 100644 MHC2Gen/DisplayEnums.cs create mode 100644 Shared/Common/UpdateInfoDto.cs create mode 100644 Shared/Contracts/DisplayInfo/ColorProfileDto.cs create mode 100644 Shared/Contracts/DisplayInfo/DisplayInfoDto.cs delete mode 100644 Shared/Services/RpcUiClientService.cs diff --git a/ColorControl.UI/Blazor.cs b/ColorControl.UI/Blazor.cs index 582849a..537736c 100644 --- a/ColorControl.UI/Blazor.cs +++ b/ColorControl.UI/Blazor.cs @@ -1,5 +1,5 @@ using ColorControl.Shared.Contracts; -using ColorControl.Shared.Services; +using ColorControl.UI.Services; namespace ColorControl.UI; @@ -15,6 +15,9 @@ public static class Blazor builder.Services.AddSingleton(new AppState { SelectedTheme = (config?.UseDarkMode ?? true) ? "dark" : "light" }); builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddHttpContextAccessor(); + builder.Services.AddSingleton(); builder.WebHost.ConfigureKestrel(o => o.ListenAnyIP(config?.UiPort > 0 ? config.UiPort : 5000)); var app = builder.Build(); diff --git a/ColorControl.UI/ColorControl.UI.csproj b/ColorControl.UI/ColorControl.UI.csproj index d9c99b4..33cdc83 100644 --- a/ColorControl.UI/ColorControl.UI.csproj +++ b/ColorControl.UI/ColorControl.UI.csproj @@ -13,9 +13,13 @@ + + + true + true @@ -25,6 +29,9 @@ true + + true + true @@ -52,6 +59,15 @@ true + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + diff --git a/ColorControl.UI/Components/App.razor b/ColorControl.UI/Components/App.razor index 86bbe4f..a0ff549 100644 --- a/ColorControl.UI/Components/App.razor +++ b/ColorControl.UI/Components/App.razor @@ -1,8 +1,15 @@ -@using ColorControl.Shared.Contracts -@using ColorControl.Shared.Services +@using ColorControl.Shared.Common +@using ColorControl.Shared.Contracts +@using ColorControl.UI.Services +@using ColorControl.UI.Components.Pages.Generic +@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage + @inject AppState AppState -@inject RpcUiClientService ClientService; -@inject NavigationManager _navigationManager; +@inject RpcUiClientService _rpcClientService +@inject NavigationManager _navigationManager +@inject NotificationService _notificationService +@inject ProtectedSessionStorage _sessionStorage + @implements IDisposable @attribute [StreamRendering] @@ -15,28 +22,33 @@ + + + @code { + private Config? Config; + protected override async Task OnInitializedAsync() { - var config = await ClientService.CallAsync("OptionsService", "GetConfig"); + Config ??= await _rpcClientService.CallAsync("OptionsService", "GetConfig"); - var newTheme = config.UseDarkMode ? "dark" : "light"; + var newTheme = Config?.UseDarkMode == true ? "dark" : "light"; if (newTheme != AppState.SelectedTheme) { - AppState.SelectedTheme = config.UseDarkMode ? "dark" : "light"; + AppState.SelectedTheme = Config?.UseDarkMode == true ? "dark" : "light"; _navigationManager.Refresh(); } diff --git a/ColorControl.UI/Components/Layout/NavMenu.razor b/ColorControl.UI/Components/Layout/NavMenu.razor index 514ac68..dbcb094 100644 --- a/ColorControl.UI/Components/Layout/NavMenu.razor +++ b/ColorControl.UI/Components/Layout/NavMenu.razor @@ -1,5 +1,6 @@ @using ColorControl.Shared.Contracts -@using ColorControl.Shared.Services; +@using ColorControl.UI.Services; +@using ColorControl.UI.Services @rendermode InteractiveServer @@ -28,28 +29,34 @@ @foreach (var module in modules.Where(m => m.IsActive)) { } } + + diff --git a/ColorControl.UI/Components/Layout/TopMenu.razor b/ColorControl.UI/Components/Layout/TopMenu.razor index 32eaf88..193e9af 100644 --- a/ColorControl.UI/Components/Layout/TopMenu.razor +++ b/ColorControl.UI/Components/Layout/TopMenu.razor @@ -1,5 +1,5 @@ @using ColorControl.Shared.Contracts -@using ColorControl.Shared.Services +@using ColorControl.UI.Services @inherits LayoutComponentBase @inject AppState AppState diff --git a/ColorControl.UI/Components/Pages/AMD/AmdPresetPage.razor b/ColorControl.UI/Components/Pages/AMD/AmdPresetPage.razor index 770c4dd..f4b1e14 100644 --- a/ColorControl.UI/Components/Pages/AMD/AmdPresetPage.razor +++ b/ColorControl.UI/Components/Pages/AMD/AmdPresetPage.razor @@ -1,15 +1,15 @@ @using ColorControl.Shared.Contracts @using ColorControl.Shared.Contracts.AMD -@using ColorControl.Shared.Services; @using ColorControl.UI.Components.Pages.Generic @using ColorControl.Shared.Common; +@using ColorControl.UI.Services @rendermode InteractiveServer @inject RpcUiClientService _rpcClientService