Display the sentry uid in preferences

This commit is contained in:
Marek Roszko 2022-09-27 19:31:32 -04:00
parent 21c1c97bf3
commit 1a43187fb7
6 changed files with 95 additions and 15 deletions

View File

@ -54,6 +54,8 @@ bool PANEL_DATA_COLLECTION::TransferDataToWindow()
Disable();
}
m_sentryUid->SetValue( Pgm().GetSentryId() );
return true;
}
@ -81,4 +83,5 @@ void PANEL_DATA_COLLECTION::applySettingsToPanel()
void PANEL_DATA_COLLECTION::OnResetIdClick( wxCommandEvent& aEvent )
{
Pgm().ResetSentryId();
m_sentryUid->SetValue( Pgm().GetSentryId() );
}

View File

@ -21,11 +21,16 @@ PANEL_DATA_COLLECTION_BASE::PANEL_DATA_COLLECTION_BASE( wxWindow* parent, wxWind
m_stExplanation->Wrap( 500 );
bSizer8->Add( m_stExplanation, 0, wxALL, 5 );
m_cbOptIn = new wxCheckBox( this, wxID_ANY, _("I agree to provide anonymous reports"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_cbOptIn, 0, wxALL, 5 );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
m_cbOptIn = new wxCheckBox( this, wxID_ANY, _("I agree to provide anonymous reports"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3->Add( m_cbOptIn, 0, wxALL, 5 );
m_sentryUid = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
m_sentryUid->SetMinSize( wxSize( 340,-1 ) );
bSizer3->Add( m_sentryUid, 0, wxALL, 5 );
m_buttonResetId = new wxButton( this, wxID_ANY, _("Reset Unique Id"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3->Add( m_buttonResetId, 0, wxALL, 5 );

View File

@ -127,6 +127,70 @@
<property name="wrap">500</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">I agree to provide anonymous reports</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbOptIn</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@ -140,7 +204,7 @@
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -154,7 +218,6 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@ -169,15 +232,15 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">I agree to provide anonymous reports</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size">340,-1</property>
<property name="moveable">1</property>
<property name="name">m_cbOptIn</property>
<property name="name">m_sentryUid</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -187,7 +250,7 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="style">wxTE_READONLY</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
@ -195,6 +258,7 @@
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>

View File

@ -18,6 +18,7 @@
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/checkbox.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/bitmap.h>
#include <wx/image.h>
@ -37,6 +38,7 @@ class PANEL_DATA_COLLECTION_BASE : public RESETTABLE_PANEL
protected:
wxStaticText* m_stExplanation;
wxCheckBox* m_cbOptIn;
wxTextCtrl* m_sentryUid;
wxButton* m_buttonResetId;
// Virtual event handlers, override them in your derived class

View File

@ -276,7 +276,13 @@ wxString PGM_BASE::sentryCreateUid()
void PGM_BASE::ResetSentryId()
{
sentryCreateUid();
m_sentryUid = sentryCreateUid();
}
const wxString& PGM_BASE::GetSentryId()
{
return m_sentryUid;
}
@ -287,15 +293,13 @@ void PGM_BASE::sentryInit()
if( IsSentryOptedIn() )
{
wxString userGuid;
wxFFile sentryInitFile( m_sentry_uid_fn.GetFullPath() );
sentryInitFile.ReadAll( &userGuid );
sentryInitFile.ReadAll( &m_sentryUid );
sentryInitFile.Close();
if( userGuid.IsEmpty() || userGuid.length() != 36 )
if( m_sentryUid.IsEmpty() || m_sentryUid.length() != 36 )
{
userGuid = sentryCreateUid();
m_sentryUid = sentryCreateUid();
}
sentry_options_t* options = sentry_options_new();
@ -321,7 +325,7 @@ void PGM_BASE::sentryInit()
sentry_init( options );
sentry_value_t user = sentry_value_new_object();
sentry_value_set_by_key( user, "id", sentry_value_new_string( userGuid.c_str() ) );
sentry_value_set_by_key( user, "id", sentry_value_new_string( m_sentryUid.c_str() ) );
sentry_set_user( user );
sentry_set_tag( "kicad.version", KICAD_VERSION_FULL );

View File

@ -289,6 +289,7 @@ public:
bool IsSentryOptedIn();
void SetSentryOptIn( bool aOptIn );
void ResetSentryId();
const wxString& GetSentryId();
#endif
/**
@ -339,6 +340,7 @@ protected:
#ifdef KICAD_USE_SENTRY
wxFileName m_sentry_optin_fn;
wxFileName m_sentry_uid_fn;
wxString m_sentryUid;
#endif
};