mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 14:41:21 +08:00
Add telemetry event for PowerRename settings (#1279)
* moved MAX_INPUT_STRING_LEN constant * added settings changed event log
This commit is contained in:
parent
49fa1b6762
commit
59d218d623
@ -257,6 +257,8 @@ public:
|
||||
CSettings::SetMaxMRUSize(values.get_int_value(L"int_max_mru_size").value());
|
||||
CSettings::SetShowIconOnMenu(values.get_bool_value(L"bool_show_icon_on_menu").value());
|
||||
CSettings::SetExtendedContextMenuOnly(values.get_bool_value(L"bool_show_extended_menu").value());
|
||||
|
||||
Trace::SettingsChanged();
|
||||
}
|
||||
catch (std::exception)
|
||||
{
|
||||
|
@ -3,6 +3,8 @@
|
||||
class CSettings
|
||||
{
|
||||
public:
|
||||
static const int MAX_INPUT_STRING_LEN = 1024;
|
||||
|
||||
static bool GetEnabled();
|
||||
static bool SetEnabled(_In_ bool enabled);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "trace.h"
|
||||
#include "Settings.h"
|
||||
|
||||
TRACELOGGING_DEFINE_PROVIDER(
|
||||
g_hProvider,
|
||||
@ -71,3 +72,18 @@ void Trace::RenameOperation(_In_ UINT totalItemCount, _In_ UINT selectedItemCoun
|
||||
TraceLoggingWideString(extensionList, "ExtensionList"));
|
||||
}
|
||||
|
||||
void Trace::SettingsChanged() noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
g_hProvider,
|
||||
"PowerRename_SettingsChanged",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingBoolean(CSettings::GetEnabled(), "IsEnabled"),
|
||||
TraceLoggingBoolean(CSettings::GetShowIconOnMenu(), "ShowIconOnMenu"),
|
||||
TraceLoggingBoolean(CSettings::GetExtendedContextMenuOnly(), "ExtendedContextMenuOnly"),
|
||||
TraceLoggingBoolean(CSettings::GetPersistState(), "PersistState"),
|
||||
TraceLoggingBoolean(CSettings::GetMRUEnabled(), "IsMRUEnabled"),
|
||||
TraceLoggingUInt64(CSettings::GetMaxMRUSize(), "MaxMRUSize"),
|
||||
TraceLoggingUInt64(CSettings::GetFlags(), "Flags"));
|
||||
}
|
||||
|
@ -14,4 +14,5 @@ public:
|
||||
_In_ UINT renameItemCount,
|
||||
_In_ DWORD flags,
|
||||
_In_ PCWSTR extensionList) noexcept;
|
||||
static void SettingsChanged() noexcept;
|
||||
};
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <helpers.h>
|
||||
#include <settings.h>
|
||||
#include <windowsx.h>
|
||||
#include <trace.h>
|
||||
|
||||
extern HINSTANCE g_hInst;
|
||||
|
||||
@ -77,8 +78,6 @@ inline int RECT_HEIGHT(RECT& r)
|
||||
return r.bottom - r.top;
|
||||
}
|
||||
|
||||
#define MAX_INPUT_STRING_LEN 1024
|
||||
|
||||
// IUnknown
|
||||
IFACEMETHODIMP CPowerRenameUI::QueryInterface(__in REFIID riid, __deref_out void** ppv)
|
||||
{
|
||||
@ -391,7 +390,7 @@ HRESULT CPowerRenameUI::_ReadSettings()
|
||||
flags = CSettings::GetFlags();
|
||||
m_spsrm->put_flags(flags);
|
||||
|
||||
wchar_t buffer[MAX_INPUT_STRING_LEN];
|
||||
wchar_t buffer[CSettings::MAX_INPUT_STRING_LEN];
|
||||
buffer[0] = L'\0';
|
||||
CSettings::GetSearchText(buffer, ARRAYSIZE(buffer));
|
||||
SetDlgItemText(m_hwnd, IDC_EDIT_SEARCHFOR, buffer);
|
||||
@ -419,7 +418,7 @@ HRESULT CPowerRenameUI::_WriteSettings()
|
||||
m_spsrm->get_flags(&flags);
|
||||
CSettings::SetFlags(flags);
|
||||
|
||||
wchar_t buffer[MAX_INPUT_STRING_LEN];
|
||||
wchar_t buffer[CSettings::MAX_INPUT_STRING_LEN];
|
||||
buffer[0] = L'\0';
|
||||
GetDlgItemText(m_hwnd, IDC_EDIT_SEARCHFOR, buffer, ARRAYSIZE(buffer));
|
||||
CSettings::SetSearchText(buffer);
|
||||
@ -445,6 +444,8 @@ HRESULT CPowerRenameUI::_WriteSettings()
|
||||
spReplaceMRU->AddMRUString(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
Trace::SettingsChanged();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
@ -825,7 +826,7 @@ void CPowerRenameUI::_OnSearchReplaceChanged()
|
||||
CComPtr<IPowerRenameRegEx> spRegEx;
|
||||
if (m_spsrm && SUCCEEDED(m_spsrm->get_renameRegEx(&spRegEx)))
|
||||
{
|
||||
wchar_t buffer[MAX_INPUT_STRING_LEN];
|
||||
wchar_t buffer[CSettings::MAX_INPUT_STRING_LEN];
|
||||
buffer[0] = L'\0';
|
||||
GetDlgItemText(m_hwnd, IDC_EDIT_SEARCHFOR, buffer, ARRAYSIZE(buffer));
|
||||
spRegEx->put_searchTerm(buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user