You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.3 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. #include <dialogs/panel_data_collection.h>
  24. #include <advanced_config.h>
  25. #include <bitmaps.h>
  26. #include <dialog_shim.h>
  27. #include <gal/dpi_scaling.h>
  28. #include <kiface_base.h>
  29. #include <kiplatform/policy.h>
  30. #include <kiplatform/ui.h>
  31. #include <pgm_base.h>
  32. #include <policy_keys.h>
  33. #include <id.h>
  34. #include <settings/common_settings.h>
  35. #include <settings/settings_manager.h>
  36. PANEL_DATA_COLLECTION::PANEL_DATA_COLLECTION( PAGED_DIALOG* aDialog, wxWindow* aParent ) :
  37. PANEL_DATA_COLLECTION_BASE( aParent ), m_dialog( aDialog )
  38. {
  39. }
  40. bool PANEL_DATA_COLLECTION::TransferDataToWindow()
  41. {
  42. applySettingsToPanel();
  43. KIPLATFORM::POLICY::STATE policyState =
  44. KIPLATFORM::POLICY::GetPolicyState( POLICY_KEY_DATACOLLECTION );
  45. if( policyState != KIPLATFORM::POLICY::STATE::NOT_CONFIGURED )
  46. {
  47. Disable();
  48. }
  49. return true;
  50. }
  51. bool PANEL_DATA_COLLECTION::TransferDataFromWindow()
  52. {
  53. Pgm().SetSentryOptIn( m_cbOptIn->GetValue() );
  54. return true;
  55. }
  56. void PANEL_DATA_COLLECTION::ResetPanel()
  57. {
  58. applySettingsToPanel();
  59. }
  60. void PANEL_DATA_COLLECTION::applySettingsToPanel()
  61. {
  62. m_cbOptIn->SetValue( Pgm().IsSentryOptedIn() );
  63. }
  64. void PANEL_DATA_COLLECTION::OnResetIdClick( wxCommandEvent& aEvent )
  65. {
  66. Pgm().ResetSentryId();
  67. }