2022-04-02 01:21:55 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <dialogs/panel_data_collection.h>
|
|
|
|
|
|
|
|
#include <advanced_config.h>
|
|
|
|
#include <bitmaps.h>
|
|
|
|
#include <dialog_shim.h>
|
|
|
|
#include <gal/dpi_scaling.h>
|
|
|
|
#include <kiface_base.h>
|
2022-04-12 04:11:16 +00:00
|
|
|
#include <kiplatform/policy.h>
|
2022-04-02 01:21:55 +00:00
|
|
|
#include <kiplatform/ui.h>
|
|
|
|
#include <pgm_base.h>
|
2022-04-12 04:11:16 +00:00
|
|
|
#include <policy_keys.h>
|
2022-04-02 01:21:55 +00:00
|
|
|
#include <id.h>
|
|
|
|
#include <settings/common_settings.h>
|
|
|
|
#include <settings/settings_manager.h>
|
|
|
|
|
2022-04-09 18:01:07 +00:00
|
|
|
|
2022-04-02 01:21:55 +00:00
|
|
|
PANEL_DATA_COLLECTION::PANEL_DATA_COLLECTION( PAGED_DIALOG* aDialog, wxWindow* aParent ) :
|
|
|
|
PANEL_DATA_COLLECTION_BASE( aParent ), m_dialog( aDialog )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PANEL_DATA_COLLECTION::TransferDataToWindow()
|
|
|
|
{
|
|
|
|
applySettingsToPanel();
|
|
|
|
|
2022-04-09 18:01:07 +00:00
|
|
|
KIPLATFORM::POLICY::STATE policyState =
|
2022-04-12 04:11:16 +00:00
|
|
|
KIPLATFORM::POLICY::GetPolicyState( POLICY_KEY_DATACOLLECTION );
|
2022-04-09 18:01:07 +00:00
|
|
|
if( policyState != KIPLATFORM::POLICY::STATE::NOT_CONFIGURED )
|
|
|
|
{
|
|
|
|
Disable();
|
|
|
|
}
|
|
|
|
|
2022-09-27 23:31:32 +00:00
|
|
|
m_sentryUid->SetValue( Pgm().GetSentryId() );
|
|
|
|
|
2022-04-02 01:21:55 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PANEL_DATA_COLLECTION::TransferDataFromWindow()
|
|
|
|
{
|
|
|
|
Pgm().SetSentryOptIn( m_cbOptIn->GetValue() );
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PANEL_DATA_COLLECTION::ResetPanel()
|
|
|
|
{
|
|
|
|
applySettingsToPanel();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PANEL_DATA_COLLECTION::applySettingsToPanel()
|
|
|
|
{
|
|
|
|
m_cbOptIn->SetValue( Pgm().IsSentryOptedIn() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PANEL_DATA_COLLECTION::OnResetIdClick( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
Pgm().ResetSentryId();
|
2022-09-27 23:31:32 +00:00
|
|
|
m_sentryUid->SetValue( Pgm().GetSentryId() );
|
2022-04-02 01:21:55 +00:00
|
|
|
}
|