Skip to content

Commit

Permalink
Added diagnostics registry value
Browse files Browse the repository at this point in the history
  • Loading branch information
Aemony committed Nov 7, 2023
1 parent e166bdb commit afbdb03
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
5 changes: 5 additions & 0 deletions include/utility/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ struct SKIF_RegistrySettings {
SKIF_MakeRegKeyI ( LR"(SOFTWARE\Kaldaien\Special K\)",
LR"(UI Mode)" );

KeyValue <int> regKVDiagnostics =
SKIF_MakeRegKeyI ( LR"(SOFTWARE\Kaldaien\Special K\)",
LR"(Diagnostics)" );

// Wide Strings

KeyValue <std::wstring> regKVIgnoreUpdate =
Expand Down Expand Up @@ -383,6 +387,7 @@ struct SKIF_RegistrySettings {
int iHDRMode = 1; // 0 = Disabled, 1 = HDR10 (10 bpc), 2 = scRGB (16 bpc)
int iHDRBrightness = 203; // HDR reference white for BT.2408
int iUIMode = 1; // 0 = Safe Mode (BitBlt), 1 = Normal, 2 = VRR Compatibility
int iDiagnostics = 1; // 0 = None, 1 = Normal, 2 = Enhanced (not actually used yet)

// Default settings (booleans)
bool bRememberLastSelected = false;
Expand Down
42 changes: 39 additions & 3 deletions src/tabs/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1360,11 +1360,11 @@ SKIF_UI_Tab_DrawSettings (void)
"Verbose" };
static const char* LogSeverityCurrent = LogSeverity[_registry.iLogging];

if (ImGui::BeginCombo (" Log level###_registry.iLoggingCombo", LogSeverityCurrent)) // The second parameter is the label previewed before opening the combo.
if (ImGui::BeginCombo (" Log level###_registry.iLoggingCombo", LogSeverityCurrent))
{
for (int n = 0; n < IM_ARRAYSIZE (LogSeverity); n++)
{
bool is_selected = (LogSeverityCurrent == LogSeverity[n]); // You can store your selection however you want, outside or inside your objects
bool is_selected = (LogSeverityCurrent == LogSeverity[n]);
if (ImGui::Selectable (LogSeverity[n], is_selected))
{
_registry.iLogging = n;
Expand All @@ -1373,13 +1373,49 @@ SKIF_UI_Tab_DrawSettings (void)
plog::get()->setMaxSeverity((plog::Severity)_registry.iLogging);
}
if (is_selected)
ImGui::SetItemDefaultFocus ( ); // You may set the initial focus when opening the combo (scrolling + for keyboard navigation support)
ImGui::SetItemDefaultFocus ( );
}
ImGui::EndCombo ( );
}

SKIF_ImGui_Spacing ( );

const char* Diagnostics[] = { "None",
"Normal",
"Enhanced" };
static const char* DiagnosticsCurrent = Diagnostics[_registry.iDiagnostics];

if (ImGui::BeginCombo (" Diagnostics###_registry.iDiagnostics", DiagnosticsCurrent))
{
for (int n = 0; n < IM_ARRAYSIZE (Diagnostics); n++)
{
bool is_selected = (DiagnosticsCurrent == Diagnostics[n]);
if (ImGui::Selectable (Diagnostics[n], is_selected))
{
_registry.iDiagnostics = n;
_registry.regKVDiagnostics.putData (_registry.iDiagnostics);
DiagnosticsCurrent = Diagnostics[_registry.iDiagnostics];
}
if (is_selected)
ImGui::SetItemDefaultFocus ( );
}
ImGui::EndCombo ( );
}

ImGui::SameLine ( );
ImGui::TextColored (ImGui::GetStyleColorVec4 (ImGuiCol_SKIF_Info), ICON_FA_LIGHTBULB);
SKIF_ImGui_SetHoverTip ("Help improve Special K by allowing anonymized diagnostics to be sent.\n"
"The data is used to identify issues, highlight common use cases, and\n"
"facilitates the continued development of the application.");

SKIF_ImGui_SetMouseCursorHand ();
SKIF_ImGui_SetHoverText ("https://wiki.special-k.info/Privacy");

if (ImGui::IsItemClicked ())
SKIF_Util_OpenURI (L"https://wiki.special-k.info/Privacy");

SKIF_ImGui_Spacing ( );

ImGui::TextWrapped ("Nvidia users: Use the below button to prevent GeForce Experience from mistaking this app for a game.");

ImGui::Spacing ( );
Expand Down
3 changes: 3 additions & 0 deletions src/utility/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ SKIF_RegistrySettings::SKIF_RegistrySettings (void)

if (regKVUIMode.hasData())
iUIMode = regKVUIMode .getData ( );

if (regKVDiagnostics.hasData())
iDiagnostics = regKVDiagnostics .getData ( );

bDisableCFAWarning = regKVDisableCFAWarning .getData ( );
bOpenAtCursorPosition = regKVOpenAtCursorPosition .getData ( );
Expand Down

0 comments on commit afbdb03

Please sign in to comment.