KiCad PCB EDA Suite
Loading...
Searching...
No Matches
startwizard_provider_privacy.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2023 Mark Roszko <[email protected]>
5 * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <app_monitor.h>
22#include <pgm_base.h>
25
29
30
32{
33public:
34 PANEL_STARTWIZARD_PRIVACY( std::shared_ptr<STARTWIZARD_PROVIDER_PRIVACY_MODEL> aModel,
35 wxWindow* aParent ) :
37 m_model( aModel )
38 {
39#ifndef KICAD_USE_SENTRY
40 m_sizerDataCollection->Show( false );
41#endif
42 };
43
44 bool TransferDataFromWindow() override
45 {
46 m_model->m_autoUpdateKiCad = m_cbAutoUpdateKiCad->GetValue();
47 m_model->m_autoUpdatePCM = m_cbAutoUpdatePCM->GetValue();
48 m_model->m_enableApi = m_cbApi->GetValue();
49
50#ifdef KICAD_USE_SENTRY
51 m_model->m_enableSentry = m_cbDataCollection->GetValue();
52#else
53 m_model->m_enableSentry = false;
54#endif
55
56 return true;
57 }
58
59 bool TransferDataToWindow() override
60 {
61 m_cbAutoUpdateKiCad->SetValue( m_model->m_autoUpdateKiCad );
62 m_cbAutoUpdatePCM->SetValue( m_model->m_autoUpdatePCM );
63 m_cbApi->SetValue( m_model->m_enableApi );
64
65#ifdef KICAD_USE_SENTRY
66 m_cbDataCollection->SetValue( m_model->m_enableSentry );
67#endif
68
69 return true;
70 }
71
72private:
73 std::shared_ptr<STARTWIZARD_PROVIDER_PRIVACY_MODEL> m_model;
74};
75
76
81
82
84{
85 COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings();
86
87 return !commonSettings->m_DoNotShowAgain.update_check_prompt
88 || !commonSettings->m_DoNotShowAgain.data_collection_prompt;
89}
90
91
92wxPanel* STARTWIZARD_PROVIDER_PRIVACY::GetWizardPanel( wxWindow* aParent, STARTWIZARD* aWizard )
93{
94 m_model = std::make_shared<STARTWIZARD_PROVIDER_PRIVACY_MODEL>();
95 return new PANEL_STARTWIZARD_PRIVACY( m_model, aParent );
96}
97
98
100{
101 COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings();
103
104 settings->m_KiCadUpdateCheck = m_model->m_autoUpdateKiCad;
105 settings->m_PcmUpdateCheck = m_model->m_autoUpdatePCM;
106 commonSettings->m_DoNotShowAgain.update_check_prompt = true;
107 commonSettings->m_Api.enable_server = m_model->m_enableApi;
108
110 commonSettings->m_DoNotShowAgain.data_collection_prompt = true;
111
113}
114
115
117{
118 COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings();
120
121 settings->m_KiCadUpdateCheck = true;
122 settings->m_PcmUpdateCheck = true;
124
125 commonSettings->m_DoNotShowAgain.update_check_prompt = true;
126 commonSettings->m_DoNotShowAgain.data_collection_prompt = true;
127 commonSettings->m_Api.enable_server = true;
128
130}
void SetSentryOptIn(bool aOptIn)
static SENTRY * Instance()
DO_NOT_SHOW_AGAIN m_DoNotShowAgain
PANEL_STARTWIZARD_PRIVACY_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
PANEL_STARTWIZARD_PRIVACY(std::shared_ptr< STARTWIZARD_PROVIDER_PRIVACY_MODEL > aModel, wxWindow *aParent)
std::shared_ptr< STARTWIZARD_PROVIDER_PRIVACY_MODEL > m_model
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition pgm_base.cpp:546
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:123
void SaveCommonSettings()
Save the program (process) settings subset which are stored .kicad_common.
Definition pgm_base.cpp:537
T * GetAppSettings(const char *aFilename)
Return a handle to the a given settings by type.
std::shared_ptr< STARTWIZARD_PROVIDER_PRIVACY_MODEL > m_model
wxPanel * GetWizardPanel(wxWindow *aParent, STARTWIZARD *aWizard) override
void ApplyDefaults() override
Apply whatever actions and settings should happen if the user cancels the startup wizard.
STARTWIZARD_PROVIDER(const wxString &aPageName)
#define _(s)
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE