Skip to content

Commit 5c62273

Browse files
committed
fix color profile issues, add lock/unlock power off/on, add GPU OC settings to new UI
1 parent 6f4b1e9 commit 5c62273

File tree

100 files changed

+11536
-10823
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+11536
-10823
lines changed

ColorControl.UI/Blazor.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,39 @@ namespace ColorControl.UI;
55

66
public static class Blazor
77
{
8-
public static void Start(Config? config = null)
9-
{
10-
var builder = WebApplication.CreateBuilder();
8+
public static void Start(Config? config = null)
9+
{
10+
var builder = WebApplication.CreateBuilder();
1111

12-
// Add services to the container.
13-
builder.Services.AddRazorComponents()
14-
.AddInteractiveServerComponents();
12+
// Add services to the container.
13+
builder.Services.AddRazorComponents()
14+
.AddInteractiveServerComponents();
1515

16-
builder.Services.AddSingleton<AppState>(new AppState { SelectedTheme = (config?.UseDarkMode ?? true) ? "dark" : "light" });
17-
builder.Services.AddTransient<RpcUiClientService>();
18-
builder.Services.AddTransient<JSHelper>();
19-
builder.Services.AddHttpContextAccessor();
20-
builder.Services.AddSingleton<NotificationService>();
21-
builder.WebHost.ConfigureKestrel(o => o.ListenAnyIP(config?.UiPort > 0 ? config.UiPort : 5000));
16+
builder.Services.AddSingleton<AppState>(new AppState { SelectedTheme = (config?.UseDarkMode ?? true) ? "dark" : "light" });
17+
builder.Services.AddTransient<RpcUiClientService>();
18+
builder.Services.AddTransient<JSHelper>();
19+
builder.Services.AddHttpContextAccessor();
20+
builder.Services.AddSingleton<NotificationService>();
21+
builder.WebHost.ConfigureKestrel(o => o.ListenAnyIP(config?.UiPort > 0 ? config.UiPort : 5000));
2222

23-
var app = builder.Build();
23+
var app = builder.Build();
2424

25-
// Configure the HTTP request pipeline.
26-
if (!app.Environment.IsDevelopment())
27-
{
28-
app.UseExceptionHandler("/Error", createScopeForErrors: true);
29-
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
30-
app.UseHsts();
31-
}
25+
// Configure the HTTP request pipeline.
26+
if (!app.Environment.IsDevelopment())
27+
{
28+
app.UseExceptionHandler("/Error", createScopeForErrors: true);
29+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
30+
app.UseHsts();
31+
}
3232

33-
app.UseHttpsRedirection();
33+
app.UseHttpsRedirection();
3434

35-
app.UseStaticFiles();
36-
app.UseAntiforgery();
35+
app.UseStaticFiles();
36+
app.UseAntiforgery();
3737

38-
app.MapRazorComponents<Components.App>()
39-
.AddInteractiveServerRenderMode();
38+
app.MapRazorComponents<Components.App>()
39+
.AddInteractiveServerRenderMode();
4040

41-
app.Run();
42-
}
41+
app.Run();
42+
}
4343
}

ColorControl.UI/ColorControl.UI.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
<Content Update="Components\Pages\LG\LgExecuteActionModal.razor">
4242
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
4343
</Content>
44+
<Content Update="Components\Pages\Nvidia\NvidiaGpuSettings.razor">
45+
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
46+
</Content>
4447
<Content Update="Components\Pages\Samsung\SamsungSummary.razor">
4548
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
4649
</Content>

ColorControl.UI/Components/Layout/NavMenu.razor

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
@using ColorControl.Shared.Contracts
22
@using ColorControl.UI.Services;
3-
@using ColorControl.UI.Services
43

5-
@rendermode InteractiveServer
4+
@rendermode Constants.RenderMode
65

76
@inject RpcUiClientService _rpcClientService
87
@inject AppState AppState

ColorControl.UI/Components/Layout/TopMenu.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
@inject AppState AppState
66
@inject NavigationManager _navigationManager;
7-
@rendermode InteractiveServer
7+
@rendermode Constants.RenderMode
88

99
<div class="top-row px-4 pt-3 text-end">
1010
@* <button type="button" class="btn btn-primary me-2" @onclick="ChangeTheme">@ThemeTransitionName</button> *@
@@ -15,7 +15,7 @@
1515

1616
private string ThemeTransitionName = "Dark";
1717

18-
protected override async Task OnInitializedAsync()
18+
protected override void OnInitialized()
1919
{
2020
ThemeTransitionName = AppState.SelectedTheme == "light" ? "Dark theme" : "Light theme";
2121
}

ColorControl.UI/Components/Pages/AMD/AmdPresetPage.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@using ColorControl.Shared.Common;
55
@using ColorControl.UI.Services
66

7-
@rendermode InteractiveServer
7+
@rendermode Constants.RenderMode
88

99
@inject RpcUiClientService _rpcClientService
1010

ColorControl.UI/Components/Pages/AMD/AmdSettings.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@using ColorControl.Shared.Common;
55
@using ColorControl.UI.Components.Pages.Generic
66

7-
@rendermode InteractiveServer
7+
@rendermode Constants.RenderMode
88
@inject RpcUiClientService _rpcClientService
99

1010
<div class="modal" id="settingsModal" tabindex="-1" @onfocus="OnFocus">

ColorControl.UI/Components/Pages/AMD/AmdSummary.razor

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@using ColorControl.UI.Generics
99
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
1010

11-
@rendermode InteractiveServer
11+
@rendermode Constants.RenderMode
1212

1313
@inject RpcUiClientService _rpcClientService
1414
@inject ProtectedLocalStorage _localStorage
@@ -99,7 +99,7 @@ else
9999
<div class="list-group">
100100
@foreach (var preset in Presets)
101101
{
102-
<a class="list-group-item list-group-item-action" @onclick="() => PresetOnClick(preset)" @onclick:preventDefault @onclick:stopPropagation>
102+
<span class="list-group-item list-group-item-action" @onclick="() => PresetOnClick(preset)" @onclick:preventDefault @onclick:stopPropagation>
103103
<div class="d-flex align-items-start justify-content-between">
104104
<div>
105105
<h5 class="mb-1">
@@ -128,7 +128,7 @@ else
128128
</div>
129129
<p class="mb-1">@preset.DisplayConfig.Resolution.ToString() @@ @preset.DisplayConfig.RefreshRate.ToString()Hz @(preset.applyColorData ? preset.colorDepth : "")</p>
130130
<small class="text-muted">@preset.shortcut</small>
131-
</a>
131+
</span>
132132
}
133133
</div>
134134
</div>
@@ -165,19 +165,19 @@ else
165165
await _rpcClientService.CallAsync<bool>("AmdService", "ApplyPresetWithId", preset.id);
166166
}
167167

168-
private async Task PresetOnEditClick(AmdPreset preset)
168+
private void PresetOnEditClick(AmdPreset preset)
169169
{
170170
CurrentPreset = preset;
171171
}
172172

173-
private async Task PresetOnCloneClick(AmdPreset preset)
173+
private void PresetOnCloneClick(AmdPreset preset)
174174
{
175175
CurrentPreset = new AmdPreset(preset);
176176
CurrentPreset.name = preset.name;
177177
CurrentPreset.SetCloneValues();
178178
}
179179

180-
private async Task PresetOnDeleteClick(AmdPreset preset)
180+
private void PresetOnDeleteClick(AmdPreset preset)
181181
{
182182
CurrentPreset = preset;
183183
}
@@ -194,12 +194,12 @@ else
194194
StateHasChanged();
195195
}
196196

197-
private async Task DisplayPresetOnClick(AmdPreset preset)
197+
private void DisplayPresetOnClick(AmdPreset preset)
198198
{
199199
CurrentPreset = preset;
200200
}
201201

202-
private async Task AddPresetOnClick()
202+
private void AddPresetOnClick()
203203
{
204204
CurrentPreset = new AmdPreset();
205205
}

ColorControl.UI/Components/Pages/ColorProfile/ColorProfilePage.razor

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@using MHC2Gen
88
@using Microsoft.JSInterop;
99

10-
@rendermode InteractiveServer
10+
@rendermode Constants.RenderMode
1111

1212
@inject RpcUiClientService _rpcClientService
1313
@inject JSHelper jsHelper;
@@ -260,6 +260,13 @@
260260
</form>
261261
</div>
262262
<div class="modal-footer">
263+
@if (DisplayInfo?.IsAdvancedColorSupported == true && ColorProfile != null)
264+
{
265+
<input class="form-check-input" type="checkbox" @bind="ColorProfile.IsHDRProfile" id="associateAsHdrProfile">
266+
<label class="form-check-label" for="associateAsHdrProfile">
267+
Associate as HDR profile
268+
</label>
269+
}
263270
<button type="submit" class="btn btn-primary" @onclick="InstallOnClick" disabled="@(ColorProfile == null)">Install and set as default</button>
264271
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" @onclick="CloseOnClick">Close</button>
265272
<button type="submit" class="btn btn-primary" @onclick="ApplyClick" disabled="@(ColorProfile == null)">Save</button>
@@ -290,11 +297,10 @@
290297
private string WasValidated = "";
291298
private bool IsVisible;
292299
private DisplayPrimariesSource DisplayPrimariesSource;
293-
private bool IsInstalled;
294300

295301
protected override async Task OnParametersSetAsync()
296302
{
297-
if (ColorProfileName == null)
303+
if (ColorProfileName == null || !IsVisible)
298304
{
299305
return;
300306
}
@@ -305,7 +311,7 @@
305311
}
306312
else
307313
{
308-
ColorProfile = await _rpcClientService.CallAsync<ColorProfileDto>("ColorProfileService", "GetColorProfile", ColorProfileName, DisplayInfo?.IsHdrSupportedAndEnabled ?? false);
314+
ColorProfile = await _rpcClientService.CallAsync<ColorProfileDto>("ColorProfileService", "GetColorProfile", ColorProfileName, DisplayInfo?.DeviceName);
309315
}
310316

311317
if (ColorProfile != null)
@@ -386,8 +392,6 @@
386392
ColorProfile.UpdatePrimariesAndLuminance(CurrentColorInfo);
387393

388394
var result = await _rpcClientService.CallAsync<bool>("ColorProfileService", "InstallAndActivateColorProfile", ColorProfile, DisplayInfo.DeviceName);
389-
390-
IsInstalled = true;
391395
}
392396

393397
private async Task CloseOnClick()

0 commit comments

Comments
 (0)