kicad/common/dialogs/panel_data_collection.cpp

87 lines
2.3 KiB
C++
Raw Normal View History

/*
* 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>
#include <kiplatform/ui.h>
#include <pgm_base.h>
2022-04-12 04:11:16 +00:00
#include <policy_keys.h>
#include <id.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
2023-05-10 17:13:52 +00:00
PANEL_DATA_COLLECTION::PANEL_DATA_COLLECTION( wxWindow* aParent ) :
PANEL_DATA_COLLECTION_BASE( aParent )
{
}
bool PANEL_DATA_COLLECTION::TransferDataToWindow()
{
applySettingsToPanel();
KIPLATFORM::POLICY::STATE policyState =
2022-04-12 04:11:16 +00:00
KIPLATFORM::POLICY::GetPolicyState( POLICY_KEY_DATACOLLECTION );
if( policyState != KIPLATFORM::POLICY::STATE::NOT_CONFIGURED )
{
Disable();
}
2022-09-27 23:31:32 +00:00
m_sentryUid->SetValue( Pgm().GetSentryId() );
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() );
}