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 along
18 * with this program. If not, see <http://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
49#ifdef KICAD_USE_SENTRY
50 m_model->m_enableSentry = m_cbDataCollection->GetValue();
51#else
52 m_model->m_enableSentry = false;
53#endif
54
55 return true;
56 }
57
58 bool TransferDataToWindow() override
59 {
60 m_cbAutoUpdateKiCad->SetValue( m_model->m_autoUpdateKiCad );
61 m_cbAutoUpdatePCM->SetValue( m_model->m_autoUpdatePCM );
62
63#ifdef KICAD_USE_SENTRY
64 m_cbDataCollection->SetValue( m_model->m_enableSentry );
65#endif
66
67 return true;
68 }
69
70private:
71 std::shared_ptr<STARTWIZARD_PROVIDER_PRIVACY_MODEL> m_model;
72};
73
74
79
80
82{
83 COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings();
84
85 return !commonSettings->m_DoNotShowAgain.update_check_prompt
86 || !commonSettings->m_DoNotShowAgain.data_collection_prompt;
87}
88
89
90wxPanel* STARTWIZARD_PROVIDER_PRIVACY::GetWizardPanel( wxWindow* aParent, STARTWIZARD* aWizard )
91{
92 m_model = std::make_shared<STARTWIZARD_PROVIDER_PRIVACY_MODEL>();
93 return new PANEL_STARTWIZARD_PRIVACY( m_model, aParent );
94}
95
96
98{
99 COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings();
101
102 settings->m_KiCadUpdateCheck = m_model->m_autoUpdateKiCad;
103 settings->m_PcmUpdateCheck = m_model->m_autoUpdatePCM;
104 commonSettings->m_DoNotShowAgain.update_check_prompt = true;
105
107 commonSettings->m_DoNotShowAgain.data_collection_prompt = true;
108
110}
111
112
114{
115 COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings();
117
118 settings->m_KiCadUpdateCheck = true;
119 settings->m_PcmUpdateCheck = true;
121
122 commonSettings->m_DoNotShowAgain.update_check_prompt = true;
123 commonSettings->m_DoNotShowAgain.data_collection_prompt = true;
124
126}
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:537
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:128
void SaveCommonSettings()
Save the program (process) settings subset which are stored .kicad_common.
Definition pgm_base.cpp:528
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)
PGM_BASE & Pgm()
The global program "get" accessor.
Definition pgm_base.cpp:946
see class PGM_BASE