From 266c8c875428760da88900166b7a4477f84fd494 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sat, 5 Jul 2025 12:50:50 -0400 Subject: [PATCH] Refactor and consolidate startup wizard - Add welcome page - Add settings migration - Add library table configuration - Combine sentry and updates into a privacy step - Support in single-top mode --- common/CMakeLists.txt | 14 +- common/dialogs/dialog_migrate_settings.cpp | 171 ------ .../panel_startwizard_libraries_base.cpp | 60 ++ .../panel_startwizard_libraries_base.fbp | 520 ++++++++++++++++++ .../panel_startwizard_libraries_base.h | 48 ++ .../panel_startwizard_privacy_base.cpp | 59 ++ .../panel_startwizard_privacy_base.fbp | 424 ++++++++++++++ .../dialogs/panel_startwizard_privacy_base.h | 17 +- ...pp => panel_startwizard_settings_base.cpp} | 62 +-- ...bp => panel_startwizard_settings_base.fbp} | 177 +----- ...se.h => panel_startwizard_settings_base.h} | 17 +- common/libraries/library_manager.cpp | 59 ++ common/libraries/library_table.cpp | 2 - common/pgm_base.cpp | 2 +- common/settings/settings_manager.cpp | 86 +-- common/single_top.cpp | 13 +- common/startwizard/startwizard.cpp | 228 ++++++++ .../startwizard_provider_libraries.cpp | 155 ++++++ .../startwizard_provider_libraries.h | 64 +++ .../startwizard_provider_privacy.cpp | 132 +++++ .../startwizard_provider_privacy.h | 26 +- .../startwizard_provider_settings.cpp | 226 ++++++++ .../startwizard_provider_settings.h | 67 +++ .../startwizard_provider_datacollection.cpp | 47 -- eeschema/CMakeLists.txt | 1 - eeschema/eeschema.cpp | 13 - eeschema/eeschema_helpers.cpp | 2 +- eeschema/startwizard_provider_schlib.h | 2 +- include/dialogs/dialog_migrate_settings.h | 53 -- include/kiway.h | 5 - include/libraries/library_manager.h | 10 + include/settings/settings_manager.h | 37 +- {kicad => include/startwizard}/startwizard.h | 14 +- .../{ => startwizard}/startwizard_provider.h | 8 +- include/startwizard_provider_datacollection.h | 43 -- kicad/CMakeLists.txt | 3 - kicad/dialogs/panel_pcm_startwizard_base.cpp | 38 -- kicad/dialogs/panel_startwizard_pcm_base.fbp | 199 ------- kicad/kicad.cpp | 4 +- kicad/startwizard.cpp | 145 ----- kicad/startwizard_provider_pcm.cpp | 90 --- pcbnew/CMakeLists.txt | 2 - pcbnew/pcbnew.cpp | 9 - .../scripting/pcbnew_scripting_helpers.cpp | 2 +- pcbnew/startwizard_provider_fplib.cpp | 156 ------ pcbnew/startwizard_provider_fplib.h | 43 -- qa/data/config/9.99/kicad_common.json | 2 +- qa/schematic_utils/eeschema_test_utils.cpp | 3 +- qa/tests/api/test_api_proto.cpp | 3 +- qa/tests/eeschema/erc/test_erc_four_way.cpp | 3 +- .../eeschema/erc/test_erc_global_labels.cpp | 3 +- .../eeschema/erc/test_erc_ground_pins.cpp | 2 +- .../erc/test_erc_hierarchical_schematics.cpp | 2 +- .../erc/test_erc_label_multiple_wires.cpp | 3 +- .../eeschema/erc/test_erc_label_names.cpp | 2 +- .../erc/test_erc_label_not_connected.cpp | 3 +- .../erc/test_erc_multiple_pin_to_pin.cpp | 2 +- qa/tests/eeschema/erc/test_erc_no_connect.cpp | 3 +- .../eeschema/erc/test_erc_stacking_pins.cpp | 3 +- .../test_erc_unconnected_wire_endpoints.cpp | 2 +- .../eeschema/erc/test_erc_wire_bus_entry.cpp | 2 +- .../eeschema/test_bus_entry_concurrency.cpp | 2 +- qa/tests/eeschema/test_connectivity_algo.cpp | 5 +- qa/tests/eeschema/test_flat_hierarchy.cpp | 2 +- .../eeschema/test_incremental_netlister.cpp | 5 +- qa/tests/eeschema/test_legacy_load.cpp | 2 +- .../eeschema/test_legacy_power_symbols.cpp | 3 +- .../test_netlist_exporter_xml_stacked.cpp | 2 +- .../eeschema/test_save_load_schematic.cpp | 2 +- .../eeschema/test_stacked_pin_conversion.cpp | 2 +- .../test_stacked_pin_nomenclature.cpp | 2 +- .../drc/test_custom_rule_severities.cpp | 3 +- .../pcbnew/drc/test_drc_component_classes.cpp | 3 +- qa/tests/pcbnew/drc/test_drc_copper_conn.cpp | 3 +- .../pcbnew/drc/test_drc_copper_graphics.cpp | 3 +- .../pcbnew/drc/test_drc_copper_sliver.cpp | 3 +- .../drc/test_drc_incorrect_text_mirror.cpp | 2 +- qa/tests/pcbnew/drc/test_drc_lengths.cpp | 2 +- .../pcbnew/drc/test_drc_multi_netclasses.cpp | 3 +- qa/tests/pcbnew/drc/test_drc_orientation.cpp | 3 +- qa/tests/pcbnew/drc/test_drc_regressions.cpp | 3 +- qa/tests/pcbnew/drc/test_drc_skew.cpp | 3 +- .../pcbnew/drc/test_drc_starved_thermal.cpp | 2 +- .../pcbnew/drc/test_drc_tuning_profiles.cpp | 2 +- ...t_drc_unconnected_items_exclusion_loss.cpp | 3 +- qa/tests/pcbnew/drc/test_drc_via_dangling.cpp | 3 +- .../pcbnew/drc/test_solder_mask_bridging.cpp | 3 +- qa/tests/pcbnew/test_barcode_load_save.cpp | 6 +- qa/tests/pcbnew/test_component_classes.cpp | 3 +- qa/tests/pcbnew/test_multichannel.cpp | 2 +- qa/tests/pcbnew/test_pns_basics.cpp | 3 +- qa/tests/pcbnew/test_prettifier.cpp | 3 +- qa/tests/pcbnew/test_save_load.cpp | 3 +- qa/tests/pcbnew/test_tracks_cleaner.cpp | 3 +- qa/tests/pcbnew/test_triangulation.cpp | 3 +- qa/tests/pcbnew/test_zone_filler.cpp | 5 +- qa/tests/spice/test_ngspice_helpers.cpp | 1 - qa/tools/pns/pns_log_file.cpp | 2 +- 98 files changed, 2247 insertions(+), 1451 deletions(-) delete mode 100644 common/dialogs/dialog_migrate_settings.cpp create mode 100644 common/dialogs/panel_startwizard_libraries_base.cpp create mode 100644 common/dialogs/panel_startwizard_libraries_base.fbp create mode 100644 common/dialogs/panel_startwizard_libraries_base.h create mode 100644 common/dialogs/panel_startwizard_privacy_base.cpp create mode 100644 common/dialogs/panel_startwizard_privacy_base.fbp rename kicad/dialogs/panel_pcm_startwizard_base.h => common/dialogs/panel_startwizard_privacy_base.h (56%) rename common/dialogs/{dialog_migrate_settings_base.cpp => panel_startwizard_settings_base.cpp} (51%) rename common/dialogs/{dialog_migrate_settings_base.fbp => panel_startwizard_settings_base.fbp} (74%) rename common/dialogs/{dialog_migrate_settings_base.h => panel_startwizard_settings_base.h} (72%) create mode 100644 common/startwizard/startwizard.cpp create mode 100644 common/startwizard/startwizard_provider_libraries.cpp create mode 100644 common/startwizard/startwizard_provider_libraries.h create mode 100644 common/startwizard/startwizard_provider_privacy.cpp rename kicad/startwizard_provider_pcm.h => common/startwizard/startwizard_provider_privacy.h (60%) create mode 100644 common/startwizard/startwizard_provider_settings.cpp create mode 100644 common/startwizard/startwizard_provider_settings.h delete mode 100644 common/startwizard_provider_datacollection.cpp delete mode 100644 include/dialogs/dialog_migrate_settings.h rename {kicad => include/startwizard}/startwizard.h (79%) rename include/{ => startwizard}/startwizard_provider.h (82%) delete mode 100644 include/startwizard_provider_datacollection.h delete mode 100644 kicad/dialogs/panel_pcm_startwizard_base.cpp delete mode 100644 kicad/dialogs/panel_startwizard_pcm_base.fbp delete mode 100644 kicad/startwizard.cpp delete mode 100644 kicad/startwizard_provider_pcm.cpp delete mode 100644 pcbnew/startwizard_provider_fplib.cpp delete mode 100644 pcbnew/startwizard_provider_fplib.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index b10c626c1f..44f92cda03 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -165,10 +165,11 @@ set( KICOMMON_SRCS # This is basically a settings object, but for the toolbar tool/ui/toolbar_configuration.cpp - dialogs/dialog_migrate_settings.cpp - dialogs/dialog_migrate_settings_base.cpp dialogs/dialog_rc_job.cpp dialogs/dialog_rc_job_base.cpp + dialogs/panel_startwizard_libraries_base.cpp + dialogs/panel_startwizard_privacy_base.cpp + dialogs/panel_startwizard_settings_base.cpp widgets/bitmap_button.cpp widgets/aui_json_serializer.cpp @@ -257,6 +258,11 @@ set( KICOMMON_SRCS api/serializable.cpp api/api_utils.cpp + + startwizard/startwizard.cpp + startwizard/startwizard_provider_libraries.cpp + startwizard/startwizard_provider_privacy.cpp + startwizard/startwizard_provider_settings.cpp ) if( UNIX AND NOT APPLE ) @@ -501,10 +507,6 @@ if( KICAD_USE_SENTRY ) dialogs/panel_data_collection.cpp dialogs/panel_data_collection_base.cpp ) - - list( APPEND COMMON_SRCS - startwizard_provider_datacollection.cpp - ) endif() set( COMMON_WIDGET_SRCS diff --git a/common/dialogs/dialog_migrate_settings.cpp b/common/dialogs/dialog_migrate_settings.cpp deleted file mode 100644 index 31cbcad23a..0000000000 --- a/common/dialogs/dialog_migrate_settings.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2020 Jon Evans - * Copyright The 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 3 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, see . - */ - -#include -#include -#include -#include - -#include - - -DIALOG_MIGRATE_SETTINGS::DIALOG_MIGRATE_SETTINGS( SETTINGS_MANAGER* aManager ) : - DIALOG_MIGRATE_SETTINGS_BASE( nullptr ), - m_manager( aManager ) -{ - SetMinSize( FromDIP( GetMinSize() ) ); - m_standardButtonsCancel->SetLabel( _( "Quit KiCad" ) ); - - m_btnCustomPath->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) ); - - // Disabled for now. See https://gitlab.com/kicad/code/kicad/-/issues/9826 - m_cbCopyLibraryTables->Hide(); - - SetupStandardButtons(); - - Layout(); - m_sizer->Fit( this ); - Centre(); -} - - -bool DIALOG_MIGRATE_SETTINGS::TransferDataToWindow() -{ - if( !wxDialog::TransferDataToWindow() ) - return false; - - wxString str; - str.Printf( _( "Welcome to KiCad %s!" ), SETTINGS_MANAGER::GetSettingsVersion() ); - m_lblWelcome->SetLabelText( str ); - - std::vector paths; - - m_btnUseDefaults->SetValue( true ); - - if( !m_manager->GetPreviousVersionPaths( &paths ) ) - { - m_btnPrevVer->SetLabelText( _( "Import settings from a previous version (none found)" ) ); - } - else - { - m_cbPath->Clear(); - - for( const auto& path : paths ) - m_cbPath->Append( path ); - - m_cbPath->SetSelection( 0 ); - } - - // SetValue does not fire the "OnRadioButton" event, so have to fabricate this - wxCommandEvent dummy; - OnDefaultSelected( dummy ); - - Fit(); - - return true; -} - - -bool DIALOG_MIGRATE_SETTINGS::TransferDataFromWindow() -{ - if( !wxDialog::TransferDataFromWindow() ) - return false; - - if( m_btnPrevVer->GetValue() ) - { - m_manager->SetMigrateLibraryTables( false ); - - // Round-trip through a wxFileName object to remove any trailing separators - wxFileName path( m_cbPath->GetValue(), wxEmptyString ); - m_manager->SetMigrationSource( path.GetPath() ); - } - else - { - m_manager->SetMigrateLibraryTables( false ); - m_manager->SetMigrationSource( wxEmptyString ); - } - - return true; -} - - -void DIALOG_MIGRATE_SETTINGS::OnPrevVerSelected( wxCommandEvent& event ) -{ - m_standardButtons->GetAffirmativeButton()->Enable(); - m_cbPath->Enable(); - m_btnCustomPath->Enable(); - m_cbCopyLibraryTables->Enable(); - validatePath(); -} - - -void DIALOG_MIGRATE_SETTINGS::OnPathChanged( wxCommandEvent& event ) -{ - validatePath(); -} - - -void DIALOG_MIGRATE_SETTINGS::OnPathDefocused( wxFocusEvent& event ) -{ - validatePath(); -} - - -void DIALOG_MIGRATE_SETTINGS::OnChoosePath( wxCommandEvent& event ) -{ - wxDirDialog dlg( nullptr, _( "Select Settings Path" ), m_cbPath->GetValue(), - wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST ); - - if( dlg.ShowModal() == wxID_OK ) - { - m_cbPath->SetValue( dlg.GetPath() ); - validatePath(); - } -} - - -void DIALOG_MIGRATE_SETTINGS::OnDefaultSelected( wxCommandEvent& event ) -{ - m_standardButtons->GetAffirmativeButton()->Enable(); - m_cbPath->Disable(); - m_btnCustomPath->Disable(); - m_cbCopyLibraryTables->Disable(); - showPathError( false ); -} - - -bool DIALOG_MIGRATE_SETTINGS::validatePath() -{ - wxString path = m_cbPath->GetValue(); - bool valid = SETTINGS_MANAGER::IsSettingsPathValid( path ); - - showPathError( !valid ); - m_standardButtons->GetAffirmativeButton()->Enable( valid && !path.IsEmpty() ); - - return valid; -} - - -void DIALOG_MIGRATE_SETTINGS::showPathError( bool aShow ) -{ - m_lblPathError->Show( aShow ); - Layout(); - Fit(); -} diff --git a/common/dialogs/panel_startwizard_libraries_base.cpp b/common/dialogs/panel_startwizard_libraries_base.cpp new file mode 100644 index 0000000000..0a89c0003b --- /dev/null +++ b/common/dialogs/panel_startwizard_libraries_base.cpp @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "panel_startwizard_libraries_base.h" + +/////////////////////////////////////////////////////////////////////////// + +PANEL_STARTWIZARD_LIBRARIES_BASE::PANEL_STARTWIZARD_LIBRARIES_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +{ + wxBoxSizer* bPanelSizer; + bPanelSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer8; + bSizer8 = new wxBoxSizer( wxVERTICAL ); + + m_stIntro = new wxStaticText( this, wxID_ANY, _("KiCad comes with a large set of symbol and footprint libraries maintained by the KiCad librarian team. You may also create your own libraries, and install third-party ones from the Plugin and Content Manager or other sources.\n\nLibrary tables are the configuration files which list the libraries to be loaded. Global libraries are available in every project, and you may also add project-specific libraries if desired."), wxDefaultPosition, wxDefaultSize, 0 ); + m_stIntro->Wrap( 540 ); + bSizer8->Add( m_stIntro, 0, wxALL|wxEXPAND, 5 ); + + m_stRequiredTablesLabel = new wxStaticText( this, wxID_ANY, _("The following global library tables need to be created:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_stRequiredTablesLabel->SetLabelMarkup( _("The following global library tables need to be created:") ); + m_stRequiredTablesLabel->Wrap( -1 ); + bSizer8->Add( m_stRequiredTablesLabel, 0, wxALL|wxEXPAND, 5 ); + + m_stRequiredTables = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_stRequiredTables->SetLabelMarkup( _("dummy") ); + m_stRequiredTables->Wrap( -1 ); + bSizer8->Add( m_stRequiredTables, 0, wxALL, 5 ); + + m_stQuery = new wxStaticText( this, wxID_ANY, _("How would you like KiCad to create them?"), wxDefaultPosition, wxDefaultSize, 0 ); + m_stQuery->Wrap( 400 ); + bSizer8->Add( m_stQuery, 0, wxALL, 5 ); + + m_rbDefaultTables = new wxRadioButton( this, wxID_ANY, _("Start with the built-in KiCad libraries (recommended)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_rbDefaultTables->SetValue( true ); + bSizer8->Add( m_rbDefaultTables, 0, wxALL, 5 ); + + m_rbImport = new wxRadioButton( this, wxID_ANY, _("Import tables from the previous version"), wxDefaultPosition, wxDefaultSize, 0 ); + m_rbImport->SetToolTip( _("Library tables will be imported from the version you selected on the previous step. Any tables that cannot be imported will be created with the default KiCad libraries.") ); + + bSizer8->Add( m_rbImport, 0, wxALL, 5 ); + + m_rbBlankTables = new wxRadioButton( this, wxID_ANY, _("Start with no libraries"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer8->Add( m_rbBlankTables, 0, wxALL, 5 ); + + + bPanelSizer->Add( bSizer8, 1, wxEXPAND, 5 ); + + + this->SetSizer( bPanelSizer ); + this->Layout(); +} + +PANEL_STARTWIZARD_LIBRARIES_BASE::~PANEL_STARTWIZARD_LIBRARIES_BASE() +{ +} diff --git a/common/dialogs/panel_startwizard_libraries_base.fbp b/common/dialogs/panel_startwizard_libraries_base.fbp new file mode 100644 index 0000000000..025fd334bd --- /dev/null +++ b/common/dialogs/panel_startwizard_libraries_base.fbp @@ -0,0 +1,520 @@ + + + + + C++ + + 1 + connect + none + + + 0 + 1 + res + UTF-8 + panel_startwizard_libraries_base + 1000 + 1 + 1 + UI + PanelStartWizardLibraries + . + 0 + source_name + 1 + 0 + source_name + + + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 0 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PANEL_STARTWIZARD_LIBRARIES_BASE + + 550,-1 + + + 0 + + + wxTAB_TRAVERSAL + + + bPanelSizer + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer8 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + KiCad comes with a large set of symbol and footprint libraries maintained by the KiCad librarian team. You may also create your own libraries, and install third-party ones from the Plugin and Content Manager or other sources. Library tables are the configuration files which list the libraries to be loaded. Global libraries are available in every project, and you may also add project-specific libraries if desired. + 0 + + 0 + + + 0 + + 1 + m_stIntro + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + 540 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + <b>The following global library tables need to be created:</b> + 1 + + 0 + + + 0 + + 1 + m_stRequiredTablesLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + dummy + 1 + + 0 + + + 0 + + 1 + m_stRequiredTables + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + How would you like KiCad to create them? + 0 + + 0 + + + 0 + + 1 + m_stQuery + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + 400 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Start with the built-in KiCad libraries (recommended) + + 0 + + + 0 + + 1 + m_rbDefaultTables + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 1 + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Import tables from the previous version + + 0 + + + 0 + + 1 + m_rbImport + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + Library tables will be imported from the version you selected on the previous step. Any tables that cannot be imported will be created with the default KiCad libraries. + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Start with no libraries + + 0 + + + 0 + + 1 + m_rbBlankTables + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + diff --git a/common/dialogs/panel_startwizard_libraries_base.h b/common/dialogs/panel_startwizard_libraries_base.h new file mode 100644 index 0000000000..8dadd730ac --- /dev/null +++ b/common/dialogs/panel_startwizard_libraries_base.h @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class PANEL_STARTWIZARD_LIBRARIES_BASE +/////////////////////////////////////////////////////////////////////////////// +class PANEL_STARTWIZARD_LIBRARIES_BASE : public wxPanel +{ + private: + + protected: + wxStaticText* m_stIntro; + wxStaticText* m_stRequiredTablesLabel; + wxStaticText* m_stRequiredTables; + wxStaticText* m_stQuery; + wxRadioButton* m_rbDefaultTables; + wxRadioButton* m_rbImport; + wxRadioButton* m_rbBlankTables; + + public: + + PANEL_STARTWIZARD_LIBRARIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 550,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + + ~PANEL_STARTWIZARD_LIBRARIES_BASE(); + +}; + diff --git a/common/dialogs/panel_startwizard_privacy_base.cpp b/common/dialogs/panel_startwizard_privacy_base.cpp new file mode 100644 index 0000000000..1b6d332fe8 --- /dev/null +++ b/common/dialogs/panel_startwizard_privacy_base.cpp @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "panel_startwizard_privacy_base.h" + +/////////////////////////////////////////////////////////////////////////// + +PANEL_STARTWIZARD_PRIVACY_BASE::PANEL_STARTWIZARD_PRIVACY_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +{ + wxBoxSizer* bPanelSizer; + bPanelSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer8; + bSizer8 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer1; + sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Updates") ), wxVERTICAL ); + + m_stIntro = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Allow connections to the Internet to check for updated versions of KiCad and packages installed through the Plugin and Content Manager?"), wxDefaultPosition, wxDefaultSize, 0 ); + m_stIntro->Wrap( 550 ); + sbSizer1->Add( m_stIntro, 0, wxALL|wxEXPAND, 5 ); + + m_cbAutoUpdateKiCad = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Check for KiCad updates on startup"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer1->Add( m_cbAutoUpdateKiCad, 0, wxALL, 5 ); + + m_cbAutoUpdatePCM = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Check for package updates on startup"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer1->Add( m_cbAutoUpdatePCM, 0, wxALL, 5 ); + + + bSizer8->Add( sbSizer1, 0, wxEXPAND, 5 ); + + m_sizerDataCollection = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Data Collection") ), wxVERTICAL ); + + m_stIntroDataCollection = new wxStaticText( m_sizerDataCollection->GetStaticBox(), wxID_ANY, _("KiCad can anonymously report crashes and other event data to the development team in order to help identify and fix bugs and improve performance.\n\nWhen data collection is enabled, KiCad will automatically send reports when crashes or other notable events occur. These reports contain technical details about the state of the KiCad software at the time of the report. No personally identifiable information (PII) is collected, and your design files such as schematics, PCBs, and libraries are never shared as part of this process."), wxDefaultPosition, wxDefaultSize, 0 ); + m_stIntroDataCollection->Wrap( 550 ); + m_sizerDataCollection->Add( m_stIntroDataCollection, 0, wxALL|wxEXPAND, 5 ); + + m_cbDataCollection = new wxCheckBox( m_sizerDataCollection->GetStaticBox(), wxID_ANY, _("Enable anonymous data collection"), wxDefaultPosition, wxDefaultSize, 0 ); + m_sizerDataCollection->Add( m_cbDataCollection, 0, wxALL, 5 ); + + + bSizer8->Add( m_sizerDataCollection, 0, wxEXPAND|wxTOP, 5 ); + + + bPanelSizer->Add( bSizer8, 1, wxEXPAND, 5 ); + + + this->SetSizer( bPanelSizer ); + this->Layout(); + bPanelSizer->Fit( this ); +} + +PANEL_STARTWIZARD_PRIVACY_BASE::~PANEL_STARTWIZARD_PRIVACY_BASE() +{ +} diff --git a/common/dialogs/panel_startwizard_privacy_base.fbp b/common/dialogs/panel_startwizard_privacy_base.fbp new file mode 100644 index 0000000000..ea5021d03e --- /dev/null +++ b/common/dialogs/panel_startwizard_privacy_base.fbp @@ -0,0 +1,424 @@ + + + + + C++ + + 1 + connect + none + + + 0 + 1 + res + UTF-8 + panel_startwizard_privacy_base + 1000 + 1 + 1 + UI + PanelStartWizardPrivacy + . + 0 + source_name + 1 + 0 + source_name + + + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 0 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PANEL_STARTWIZARD_PRIVACY_BASE + + -1,-1 + + + 0 + + + wxTAB_TRAVERSAL + + + bPanelSizer + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer8 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + wxID_ANY + Updates + + sbSizer1 + wxVERTICAL + 1 + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Allow connections to the Internet to check for updated versions of KiCad and packages installed through the Plugin and Content Manager? + 0 + + 0 + + + 0 + + 1 + m_stIntro + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + 550 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Check for KiCad updates on startup + + 0 + + + 0 + + 1 + m_cbAutoUpdateKiCad + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Check for package updates on startup + + 0 + + + 0 + + 1 + m_cbAutoUpdatePCM + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + wxEXPAND|wxTOP + 0 + + wxID_ANY + Data Collection + + m_sizerDataCollection + wxVERTICAL + 1 + protected + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + KiCad can anonymously report crashes and other event data to the development team in order to help identify and fix bugs and improve performance. When data collection is enabled, KiCad will automatically send reports when crashes or other notable events occur. These reports contain technical details about the state of the KiCad software at the time of the report. No personally identifiable information (PII) is collected, and your design files such as schematics, PCBs, and libraries are never shared as part of this process. + 0 + + 0 + + + 0 + + 1 + m_stIntroDataCollection + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + 550 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Enable anonymous data collection + + 0 + + + 0 + + 1 + m_cbDataCollection + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + diff --git a/kicad/dialogs/panel_pcm_startwizard_base.h b/common/dialogs/panel_startwizard_privacy_base.h similarity index 56% rename from kicad/dialogs/panel_pcm_startwizard_base.h rename to common/dialogs/panel_startwizard_privacy_base.h index b6a34430d4..7449d690c5 100644 --- a/kicad/dialogs/panel_pcm_startwizard_base.h +++ b/common/dialogs/panel_startwizard_privacy_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -18,26 +18,31 @@ #include #include #include +#include #include /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -/// Class PANEL_PCM_STARTWIZARD_BASE +/// Class PANEL_STARTWIZARD_PRIVACY_BASE /////////////////////////////////////////////////////////////////////////////// -class PANEL_PCM_STARTWIZARD_BASE : public wxPanel +class PANEL_STARTWIZARD_PRIVACY_BASE : public wxPanel { private: protected: wxStaticText* m_stIntro; - wxCheckBox* m_cbAutoUpdate; + wxCheckBox* m_cbAutoUpdateKiCad; + wxCheckBox* m_cbAutoUpdatePCM; + wxStaticBoxSizer* m_sizerDataCollection; + wxStaticText* m_stIntroDataCollection; + wxCheckBox* m_cbDataCollection; public: - PANEL_PCM_STARTWIZARD_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_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_PCM_STARTWIZARD_BASE(); + ~PANEL_STARTWIZARD_PRIVACY_BASE(); }; diff --git a/common/dialogs/dialog_migrate_settings_base.cpp b/common/dialogs/panel_startwizard_settings_base.cpp similarity index 51% rename from common/dialogs/dialog_migrate_settings_base.cpp rename to common/dialogs/panel_startwizard_settings_base.cpp index 39671f3f15..e7db869125 100644 --- a/common/dialogs/dialog_migrate_settings_base.cpp +++ b/common/dialogs/panel_startwizard_settings_base.cpp @@ -7,28 +7,17 @@ #include "widgets/std_bitmap_button.h" -#include "dialog_migrate_settings_base.h" +#include "panel_startwizard_settings_base.h" /////////////////////////////////////////////////////////////////////////// -DIALOG_MIGRATE_SETTINGS_BASE::DIALOG_MIGRATE_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +PANEL_STARTWIZARD_SETTINGS_BASE::PANEL_STARTWIZARD_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) { - this->SetSizeHints( wxSize( 480,-1 ), wxDefaultSize ); - m_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bSizer6; bSizer6 = new wxBoxSizer( wxVERTICAL ); - m_lblWelcome = new wxStaticText( this, wxID_ANY, _("Welcome to KiCad %s!"), wxDefaultPosition, wxDefaultSize, 0 ); - m_lblWelcome->Wrap( -1 ); - m_lblWelcome->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); - - bSizer6->Add( m_lblWelcome, 0, wxALL|wxEXPAND, 5 ); - - - bSizer6->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - m_staticText2 = new wxStaticText( this, wxID_ANY, _("How would you like to configure KiCad?"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText2->Wrap( -1 ); bSizer6->Add( m_staticText2, 0, wxALL|wxEXPAND, 5 ); @@ -60,52 +49,33 @@ DIALOG_MIGRATE_SETTINGS_BASE::DIALOG_MIGRATE_SETTINGS_BASE( wxWindow* parent, wx bSizer6->Add( m_lblPathError, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); - m_cbCopyLibraryTables = new wxCheckBox( this, wxID_ANY, _("Import library configuration from previous version"), wxDefaultPosition, wxDefaultSize, 0 ); - m_cbCopyLibraryTables->SetValue(true); - m_cbCopyLibraryTables->SetToolTip( _("When checked, the symbol and footprint library tables from the previous version will be imported into this version") ); - - bSizer6->Add( m_cbCopyLibraryTables, 0, wxBOTTOM|wxRIGHT|wxLEFT, 23 ); - m_btnUseDefaults = new wxRadioButton( this, wxID_ANY, _("Start with default settings"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer6->Add( m_btnUseDefaults, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizer6->Add( m_btnUseDefaults, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); m_sizer->Add( bSizer6, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 10 ); - m_standardButtons = new wxStdDialogButtonSizer(); - m_standardButtonsOK = new wxButton( this, wxID_OK ); - m_standardButtons->AddButton( m_standardButtonsOK ); - m_standardButtonsCancel = new wxButton( this, wxID_CANCEL ); - m_standardButtons->AddButton( m_standardButtonsCancel ); - m_standardButtons->Realize(); - m_standardButtons->SetMinSize( wxSize( -1,50 ) ); - - m_sizer->Add( m_standardButtons, 0, wxEXPAND|wxALL, 5 ); - this->SetSizer( m_sizer ); this->Layout(); - m_sizer->Fit( this ); - - this->Centre( wxBOTH ); // Connect Events - m_btnPrevVer->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_MIGRATE_SETTINGS_BASE::OnPrevVerSelected ), NULL, this ); - m_cbPath->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_MIGRATE_SETTINGS_BASE::OnPathChanged ), NULL, this ); - m_cbPath->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_MIGRATE_SETTINGS_BASE::OnPathDefocused ), NULL, this ); - m_cbPath->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_MIGRATE_SETTINGS_BASE::OnPathChanged ), NULL, this ); - m_btnCustomPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MIGRATE_SETTINGS_BASE::OnChoosePath ), NULL, this ); - m_btnUseDefaults->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_MIGRATE_SETTINGS_BASE::OnDefaultSelected ), NULL, this ); + m_btnPrevVer->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_STARTWIZARD_SETTINGS_BASE::OnPrevVerSelected ), NULL, this ); + m_cbPath->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( PANEL_STARTWIZARD_SETTINGS_BASE::OnPathChanged ), NULL, this ); + m_cbPath->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( PANEL_STARTWIZARD_SETTINGS_BASE::OnPathDefocused ), NULL, this ); + m_cbPath->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PANEL_STARTWIZARD_SETTINGS_BASE::OnPathChanged ), NULL, this ); + m_btnCustomPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_STARTWIZARD_SETTINGS_BASE::OnChoosePath ), NULL, this ); + m_btnUseDefaults->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_STARTWIZARD_SETTINGS_BASE::OnDefaultSelected ), NULL, this ); } -DIALOG_MIGRATE_SETTINGS_BASE::~DIALOG_MIGRATE_SETTINGS_BASE() +PANEL_STARTWIZARD_SETTINGS_BASE::~PANEL_STARTWIZARD_SETTINGS_BASE() { // Disconnect Events - m_btnPrevVer->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_MIGRATE_SETTINGS_BASE::OnPrevVerSelected ), NULL, this ); - m_cbPath->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_MIGRATE_SETTINGS_BASE::OnPathChanged ), NULL, this ); - m_cbPath->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_MIGRATE_SETTINGS_BASE::OnPathDefocused ), NULL, this ); - m_cbPath->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_MIGRATE_SETTINGS_BASE::OnPathChanged ), NULL, this ); - m_btnCustomPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MIGRATE_SETTINGS_BASE::OnChoosePath ), NULL, this ); - m_btnUseDefaults->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_MIGRATE_SETTINGS_BASE::OnDefaultSelected ), NULL, this ); + m_btnPrevVer->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_STARTWIZARD_SETTINGS_BASE::OnPrevVerSelected ), NULL, this ); + m_cbPath->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( PANEL_STARTWIZARD_SETTINGS_BASE::OnPathChanged ), NULL, this ); + m_cbPath->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( PANEL_STARTWIZARD_SETTINGS_BASE::OnPathDefocused ), NULL, this ); + m_cbPath->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PANEL_STARTWIZARD_SETTINGS_BASE::OnPathChanged ), NULL, this ); + m_btnCustomPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_STARTWIZARD_SETTINGS_BASE::OnChoosePath ), NULL, this ); + m_btnUseDefaults->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_STARTWIZARD_SETTINGS_BASE::OnDefaultSelected ), NULL, this ); } diff --git a/common/dialogs/dialog_migrate_settings_base.fbp b/common/dialogs/panel_startwizard_settings_base.fbp similarity index 74% rename from common/dialogs/dialog_migrate_settings_base.fbp rename to common/dialogs/panel_startwizard_settings_base.fbp index 3e68903ba4..ff0264855a 100644 --- a/common/dialogs/dialog_migrate_settings_base.fbp +++ b/common/dialogs/panel_startwizard_settings_base.fbp @@ -13,12 +13,12 @@ 0 res UTF-8 - dialog_migrate_settings_base + panel_startwizard_settings_base 1000 1 1 UI - DIALOG_MIGRATE_SETTINGS + PanelStartwizardSettings . 0 source_name @@ -31,34 +31,30 @@ 1 0 0 - + 0 wxAUI_MGR_DEFAULT - wxBOTH 1 0 1 impl_virtual - 0 wxID_ANY - 480,-1 - DIALOG_MIGRATE_SETTINGS_BASE + + PANEL_STARTWIZARD_SETTINGS_BASE - - wxCAPTION|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h; forward_declare - Configure KiCad Settings Path + 500,300 + ; ; forward_declare 0 - + wxTAB_TRAVERSAL -1,-1 m_sizer @@ -73,78 +69,6 @@ bSizer6 wxVERTICAL none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - ,90,92,-1,70,0 - 0 - 0 - wxID_ANY - Welcome to KiCad %s! - 0 - - 0 - - - 0 - -1,-1 - 1 - m_lblWelcome - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxTOP|wxBOTTOM - 0 - - 0 - protected - 0 - - 5 wxALL|wxEXPAND @@ -500,74 +424,9 @@ -1 - - 23 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Import library configuration from previous version - - 0 - - - 0 - - 1 - m_cbCopyLibraryTables - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - When checked, the symbol and footprint library tables from the previous version will be imported into this version - - wxFILTER_NONE - wxDefaultValidator - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP 0 1 @@ -633,24 +492,6 @@ - - 5 - wxEXPAND|wxALL - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - -1,50 - m_standardButtons - protected - - diff --git a/common/dialogs/dialog_migrate_settings_base.h b/common/dialogs/panel_startwizard_settings_base.h similarity index 72% rename from common/dialogs/dialog_migrate_settings_base.h rename to common/dialogs/panel_startwizard_settings_base.h index f07f2de427..48fd5d6171 100644 --- a/common/dialogs/dialog_migrate_settings_base.h +++ b/common/dialogs/panel_startwizard_settings_base.h @@ -12,7 +12,6 @@ #include class STD_BITMAP_BUTTON; -#include "dialog_shim.h" #include #include #include @@ -27,33 +26,27 @@ class STD_BITMAP_BUTTON; #include #include #include -#include -#include +#include #include "kicommon.h" /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_MIGRATE_SETTINGS_BASE +/// Class PANEL_STARTWIZARD_SETTINGS_BASE /////////////////////////////////////////////////////////////////////////////// -class KICOMMON_API DIALOG_MIGRATE_SETTINGS_BASE : public DIALOG_SHIM +class KICOMMON_API PANEL_STARTWIZARD_SETTINGS_BASE : public wxPanel { private: protected: wxBoxSizer* m_sizer; - wxStaticText* m_lblWelcome; wxStaticText* m_staticText2; wxRadioButton* m_btnPrevVer; wxComboBox* m_cbPath; STD_BITMAP_BUTTON* m_btnCustomPath; wxStaticText* m_lblPathError; - wxCheckBox* m_cbCopyLibraryTables; wxRadioButton* m_btnUseDefaults; - wxStdDialogButtonSizer* m_standardButtons; - wxButton* m_standardButtonsOK; - wxButton* m_standardButtonsCancel; // Virtual event handlers, override them in your derived class virtual void OnPrevVerSelected( wxCommandEvent& event ) { event.Skip(); } @@ -65,9 +58,9 @@ class KICOMMON_API DIALOG_MIGRATE_SETTINGS_BASE : public DIALOG_SHIM public: - DIALOG_MIGRATE_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure KiCad Settings Path"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxRESIZE_BORDER ); + PANEL_STARTWIZARD_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); - ~DIALOG_MIGRATE_SETTINGS_BASE(); + ~PANEL_STARTWIZARD_SETTINGS_BASE(); }; diff --git a/common/libraries/library_manager.cpp b/common/libraries/library_manager.cpp index 149deb66f8..26bb992a93 100644 --- a/common/libraries/library_manager.cpp +++ b/common/libraries/library_manager.cpp @@ -49,6 +49,11 @@ LIBRARY_MANAGER::LIBRARY_MANAGER() LIBRARY_MANAGER::~LIBRARY_MANAGER() = default; +const std::map LIBRARY_MANAGER::m_typeToFilenameMap = + { { LIBRARY_TABLE_TYPE::SYMBOL, FILEEXT::SymbolLibraryTableFileName }, + { LIBRARY_TABLE_TYPE::FOOTPRINT, FILEEXT::FootprintLibraryTableFileName }, + { LIBRARY_TABLE_TYPE::DESIGN_BLOCK, FILEEXT::DesignBlockLibraryTableFileName } }; + void LIBRARY_MANAGER::loadTables( const wxString& aTablePath, LIBRARY_TABLE_SCOPE aScope ) { @@ -320,6 +325,60 @@ private: }; +bool LIBRARY_MANAGER::GlobalTablesValid() +{ + return InvalidGlobalTables().empty(); +} + + +std::vector LIBRARY_MANAGER::InvalidGlobalTables() +{ + std::vector invalidTables; + wxString basePath = PATHS::GetUserSettingsPath(); + + for( auto [type, name] : m_typeToFilenameMap ) + { + if( wxFileName fn( basePath, name ); fn.IsFileReadable() ) + { + if( LIBRARY_TABLE temp( fn, LIBRARY_TABLE_SCOPE::GLOBAL ); !temp.IsOk() ) + invalidTables.emplace_back( type ); + } + else + { + invalidTables.emplace_back( type ); + } + } + + return invalidTables; +} + + +bool LIBRARY_MANAGER::CreateGlobalTable( LIBRARY_TABLE_TYPE aType, bool aPopulateDefaultLibraries ) +{ + wxCHECK( m_typeToFilenameMap.contains( aType ), false ); + wxString basePath = PATHS::GetUserSettingsPath(); + + wxFileName fn( basePath, m_typeToFilenameMap.at( aType ) ); + fn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS ); + + LIBRARY_TABLE temp( fn, LIBRARY_TABLE_SCOPE::GLOBAL ); + temp.SetType( aType ); + + try + { + PRETTIFIED_FILE_OUTPUTFORMATTER formatter( fn.GetFullPath(), KICAD_FORMAT::FORMAT_MODE::LIBRARY_TABLE ); + temp.Format( &formatter ); + } + catch( IO_ERROR& e ) + { + wxLogTrace( traceLibraries, "Exception while saving: %s", e.What() ); + return false; + } + + return true; +} + + void LIBRARY_MANAGER::LoadGlobalTables() { loadTables( PATHS::GetUserSettingsPath(), LIBRARY_TABLE_SCOPE::GLOBAL ); diff --git a/common/libraries/library_table.cpp b/common/libraries/library_table.cpp index eb28e5839f..071fea8b74 100644 --- a/common/libraries/library_table.cpp +++ b/common/libraries/library_table.cpp @@ -152,8 +152,6 @@ bool LIBRARY_TABLE::addRowFromIR( const LIBRARY_TABLE_ROW_IR& aIR ) void LIBRARY_TABLE::Format( OUTPUTFORMATTER* aOutput ) const { - wxCHECK_MSG( IsOk(), /* void */, "Don't attempt to format a table that isn't OK!" ); - static const std::map types = { { LIBRARY_TABLE_TYPE::SYMBOL, "sym_lib_table" }, { LIBRARY_TABLE_TYPE::FOOTPRINT, "fp_lib_table" }, diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp index 2271c169c7..b9aedad7c1 100644 --- a/common/pgm_base.cpp +++ b/common/pgm_base.cpp @@ -415,7 +415,7 @@ bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit, bool aIsUnitTest ) winrt::init_apartment(winrt::apartment_type::single_threaded); #endif - m_settings_manager = std::make_unique( aHeadless ); + m_settings_manager = std::make_unique(); m_library_manager = std::make_unique(); m_background_jobs_monitor = std::make_unique(); m_notifications_manager = std::make_unique(); diff --git a/common/settings/settings_manager.cpp b/common/settings/settings_manager.cpp index 9a9ad16f9a..15ea9c02a2 100644 --- a/common/settings/settings_manager.cpp +++ b/common/settings/settings_manager.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include #include @@ -53,18 +52,26 @@ #include -SETTINGS_MANAGER::SETTINGS_MANAGER( bool aHeadless ) : - m_headless( aHeadless ), +SETTINGS_MANAGER::SETTINGS_MANAGER() : m_kiway( nullptr ), m_common_settings( nullptr ), - m_migration_source(), m_migrateLibraryTables( true ) { - // Check if the settings directory already exists, and if not, perform a migration if possible - if( !MigrateIfNeeded() ) + wxFileName path( PATHS::GetUserSettingsPath(), wxS( "" ) ); + wxLogTrace( traceSettings, wxT( "Using settings path %s" ), path.GetFullPath() ); + + if( !path.DirExists() ) { - m_ok = false; - return; + wxLogTrace( traceSettings, wxT( "Path didn't exist; creating it" ) ); + path.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ); + } + + if( !SettingsDirectoryValid() ) + { + // This will be picked up by the first-run wizard later in application start, + // but we allow it for now because many things rely on being able to access the + // settings manager. For now, default settings in memory will be used. + wxLogTrace( traceSettings, wxT( "Note: no valid settings directory on disk" ) ); } m_ok = true; @@ -75,15 +82,6 @@ SETTINGS_MANAGER::SETTINGS_MANAGER( bool aHeadless ) : // Create the built-in color settings // Here to allow the Python API to access the built-in colors registerBuiltinColorSettings(); - - wxFileName commonSettings( GetPathForSettingsFile( m_common_settings ), - m_common_settings->GetFullFilename() ); - - if( !wxFileExists( commonSettings.GetFullPath() ) ) - { - m_common_settings->Load(); - Save( m_common_settings ); - } } @@ -587,26 +585,9 @@ public: }; -bool SETTINGS_MANAGER::MigrateIfNeeded() +bool SETTINGS_MANAGER::SettingsDirectoryValid() const { wxFileName path( PATHS::GetUserSettingsPath(), wxS( "" ) ); - wxLogTrace( traceSettings, wxT( "Using settings path %s" ), path.GetFullPath() ); - - if( m_headless ) - { - // Special case namely for cli - // Ensure the settings directory at least exists to prevent additional loading errors - // from subdirectories. - // TODO review headless (unit tests) vs cli needs, this should be fine for unit tests though - if( !path.DirExists() ) - { - wxLogTrace( traceSettings, wxT( "Path didn't exist; creating it" ) ); - path.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ); - } - - wxLogTrace( traceSettings, wxT( "Settings migration not checked; running headless" ) ); - return true; - } if( path.DirExists() ) { @@ -621,31 +602,22 @@ bool SETTINGS_MANAGER::MigrateIfNeeded() } } - // Now we have an empty path, let's figure out what to put in it - DIALOG_MIGRATE_SETTINGS dlg( this ); + return false; +} - if( dlg.ShowModal() != wxID_OK ) - { - wxLogTrace( traceSettings, wxT( "Migration dialog canceled; exiting" ) ); + +bool SETTINGS_MANAGER::MigrateFromPreviousVersion( const wxString& aSourcePath ) +{ + wxFileName path( PATHS::GetUserSettingsPath(), wxS( "" ) ); + + if( aSourcePath.IsEmpty() ) return false; - } - if( !path.DirExists() ) - { - wxLogTrace( traceSettings, wxT( "Path didn't exist; creating it" ) ); - path.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ); - } + wxLogTrace( traceSettings, wxT( "Migrating from path %s" ), aSourcePath ); - if( m_migration_source.IsEmpty() ) - { - wxLogTrace( traceSettings, wxT( "No migration source given; starting with defaults" ) ); - return true; - } - - wxLogTrace( traceSettings, wxT( "Migrating from path %s" ), m_migration_source ); - - MIGRATION_TRAVERSER traverser( m_migration_source, path.GetFullPath(), m_migrateLibraryTables ); - wxDir source_dir( m_migration_source ); + // TODO(JE) library tables - move library table migration out of here probably + MIGRATION_TRAVERSER traverser( aSourcePath, path.GetFullPath(), m_migrateLibraryTables ); + wxDir source_dir( aSourcePath ); source_dir.Traverse( traverser ); @@ -683,7 +655,7 @@ bool SETTINGS_MANAGER::MigrateIfNeeded() for( const wxString& key : libKeys ) common.m_Env.vars.erase( key ); - common.SaveToFile( commonPath ); + common.SaveToFile( commonPath ); } return true; diff --git a/common/single_top.cpp b/common/single_top.cpp index 0eb4020c74..1182947cbb 100644 --- a/common/single_top.cpp +++ b/common/single_top.cpp @@ -57,6 +57,7 @@ #include #include +#include #ifdef KICAD_USE_SENTRY #include @@ -380,8 +381,6 @@ bool PGM_SINGLE_TOP::OnPgmInit() GetSettingsManager().RegisterSettings( new KICAD_SETTINGS ); - GetLibraryManager().LoadGlobalTables(); - #ifdef KICAD_IPC_API // Create the API server thread once the app event loop exists m_api_server = std::make_unique(); @@ -401,6 +400,16 @@ bool PGM_SINGLE_TOP::OnPgmInit() Kiway.SetTop( frame ); + STARTWIZARD startWizard; + startWizard.CheckAndRun( frame ); + + // Load library tables after startup wizard + GetLibraryManager().LoadGlobalTables(); + + // Preload libraries, since for single-top this won't have been done earlier + if( KIFACE* topFrame = Kiway.KiFACE( KIWAY::KifaceType( TOP_FRAME ) ) ) + topFrame->PreloadLibraries( &Kiway.Prj() ); + App().SetTopWindow( frame ); // wxApp gets a face. App().SetAppDisplayName( frame->GetAboutTitle() ); diff --git a/common/startwizard/startwizard.cpp b/common/startwizard/startwizard.cpp new file mode 100644 index 0000000000..64add04c4a --- /dev/null +++ b/common/startwizard/startwizard.cpp @@ -0,0 +1,228 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2023 Mark Roszko + * Copyright (C) 1992-2023 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 3 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class STARTWIZARD_PAGE : public wxWizardPageSimple +{ +public: + STARTWIZARD_PAGE( wxWizard* aParent, const wxString& aPageTitle ) : + wxWizardPageSimple( aParent ) + { + m_mainSizer = new wxBoxSizer( wxVERTICAL ); + + wxStaticText* pageTitle = new wxStaticText( this, -1, aPageTitle ); + pageTitle->SetFont( + wxFont( 14, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ) ); + m_mainSizer->Add( pageTitle, 0, wxALIGN_CENTRE | wxALL, 5 ); + + wxStaticLine* pageDivider = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, + wxDefaultSize, wxLI_HORIZONTAL ); + m_mainSizer->Add( pageDivider, 0, wxEXPAND | wxALL, 5 ); + } + + void AddContent( wxPanel* aContent ) + { + m_mainSizer->Add( aContent ); + + SetSizerAndFit( m_mainSizer ); + } + +private: + wxBoxSizer* m_mainSizer; +}; + + +class STARTWIZARD_WELCOME_PAGE : public wxWizardPageSimple +{ +public: + STARTWIZARD_WELCOME_PAGE( wxWizard* aParent ) : wxWizardPageSimple( aParent ) + { + m_mainSizer = new wxBoxSizer( wxVERTICAL ); + + wxStaticText* pageTitle = new wxStaticText( + this, -1, wxString::Format( _( "Welcome to KiCad %s" ), GetMajorMinorVersion() ) ); + pageTitle->SetFont( + wxFont( 14, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ) ); + m_mainSizer->Add( pageTitle, 0, wxALIGN_CENTRE | wxALL, 5 ); + + wxStaticLine* pageDivider = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, + wxDefaultSize, wxLI_HORIZONTAL ); + m_mainSizer->Add( pageDivider, 0, wxEXPAND | wxALL, 5 ); + + m_welcomeText = new wxStaticText( this, -1, + _( "KiCad is starting for the first time, or some of its configuration files are missing.\n\n" + "Let's take a moment to configure some basic settings. You can always modify these " + "settings later by opening the Preferences dialog." ) ); + m_mainSizer->Add( m_welcomeText, 0, wxEXPAND | wxALL, 5 ); + + wxBoxSizer* helpSizer = new wxBoxSizer( wxHORIZONTAL ); + wxStaticText* helpLabel = new wxStaticText( this, -1, _( "For help, please visit " ) ); + wxString docsUrl = wxString::Format( "https://go.kicad.org/docs/%s", GetMajorMinorVersion() ); + wxHyperlinkCtrl* helpLink = new wxHyperlinkCtrl( this, -1, wxT( "docs.kicad.org" ), docsUrl ); + helpSizer->Add( helpLabel, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 5 ); + helpSizer->Add( helpLink, 0, wxEXPAND | wxRIGHT | wxTOP | wxBOTTOM, 5 ); + m_mainSizer->Add( helpSizer, 0, wxEXPAND, 5 ); + + SetSizerAndFit( m_mainSizer ); + } + + void SetWrap( int aWidth ) const + { + m_welcomeText->Wrap( aWidth ); + } + +private: + wxBoxSizer* m_mainSizer; + wxStaticText* m_welcomeText; +}; + + +STARTWIZARD::STARTWIZARD() : + m_wizard( nullptr ) +{ +} + + +STARTWIZARD::~STARTWIZARD() +{ +} + + +STARTWIZARD_PROVIDER* STARTWIZARD::GetProvider( const wxString& aName ) +{ + if( auto it = std::ranges::find_if( m_providers, + [&]( const std::unique_ptr& aProvider ) + { + return aProvider->Name() == aName; + } ); it != m_providers.end() ) + { + return it->get(); + } + + return nullptr; +} + + +void STARTWIZARD::CheckAndRun( wxWindow* aParent ) +{ + m_providers.clear(); + + m_providers.push_back( std::make_unique() ); + m_providers.push_back( std::make_unique() ); + m_providers.push_back( std::make_unique() ); + //providers.push_back( std::make_unique() ); + + if( m_providers.size() == 0 ) + return; + + bool wizardRequired = std::ranges::any_of( std::as_const( m_providers ), + []( const std::unique_ptr& aProvider ) -> bool + { + return aProvider->NeedsUserInput(); + } ); + + if( !wizardRequired ) + return; + + Pgm().HideSplash(); + + m_wizard = new wxWizard( aParent, wxID_ANY, _( "KiCad Setup" ) ); + + STARTWIZARD_WELCOME_PAGE* firstPage = new STARTWIZARD_WELCOME_PAGE( m_wizard ); + wxWizardPageSimple* lastPage = nullptr; + wxSize minPageSize; + + for( std::unique_ptr& provider : m_providers ) + { + if( !provider->NeedsUserInput() ) + continue; + + STARTWIZARD_PAGE* page = new STARTWIZARD_PAGE( m_wizard, provider->GetPageName() ); + wxPanel* panel = provider->GetWizardPanel( page, this ); + page->AddContent( panel ); + + if( lastPage != nullptr ) + { + lastPage->Chain( page ); + } + else + { + firstPage->Chain( page ); + } + + lastPage = page; + + wxSize size = page->GetSizer()->CalcMin(); + + if( size.x > minPageSize.x ) + minPageSize.x = size.x; + + if( size.y > minPageSize.y ) + minPageSize.y = size.y; + } + + m_wizard->SetPageSize( minPageSize + wxSize( 10, 10 ) ); + firstPage->SetWrap( minPageSize.x ); + + m_wizard->Bind( wxEVT_WIZARD_CANCEL, + [&]( wxWizardEvent& aEvt ) + { + if( IsOK( aParent, _( "Are you sure? If you cancel KiCad setup, default settings " + "will be chosen for you." ) ) ) + { + for( std::unique_ptr& provider : m_providers ) + { + provider->ApplyDefaults(); + } + } + else + { + aEvt.Veto(); + } + } ); + + if( m_wizard->RunWizard( firstPage ) ) + { + for( std::unique_ptr& provider : m_providers ) + { + if( !provider->NeedsUserInput() ) + continue; + + provider->Finish(); + } + } + + m_wizard->Destroy(); + m_wizard = nullptr; +} diff --git a/common/startwizard/startwizard_provider_libraries.cpp b/common/startwizard/startwizard_provider_libraries.cpp new file mode 100644 index 0000000000..e9c6d7816a --- /dev/null +++ b/common/startwizard/startwizard_provider_libraries.cpp @@ -0,0 +1,155 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright The KiCad Developers, see AUTHORS.txt for contributors. + * @author Jon Evans + * + * 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 3 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, see . + */ + +#include +#include +#include +#include +#include +#include + + +class PANEL_STARTWIZARD_LIBRARIES : public PANEL_STARTWIZARD_LIBRARIES_BASE +{ +public: + PANEL_STARTWIZARD_LIBRARIES( const std::shared_ptr& aModel, + wxWindow* aParent, STARTWIZARD* aWizard ) : + PANEL_STARTWIZARD_LIBRARIES_BASE( aParent ), + m_model( aModel ), + m_wizard( aWizard ) + {} + + bool TransferDataFromWindow() override + { + if( m_rbDefaultTables->GetValue() ) + m_model->mode = STARTWIZARD_LIBRARIES_MODE::USE_DEFAULTS; + else if( m_rbImport->GetValue() ) + m_model->mode = STARTWIZARD_LIBRARIES_MODE::IMPORT; + else + m_model->mode = STARTWIZARD_LIBRARIES_MODE::CREATE_BLANK; + + return true; + } + + bool TransferDataToWindow() override + { + switch( m_model->mode ) + { + case STARTWIZARD_LIBRARIES_MODE::USE_DEFAULTS: m_rbDefaultTables->SetValue( true ); break; + case STARTWIZARD_LIBRARIES_MODE::IMPORT: m_rbImport->SetValue( true ); break; + case STARTWIZARD_LIBRARIES_MODE::CREATE_BLANK: m_rbBlankTables->SetValue( true ); break; + } + + if( auto settings = dynamic_cast( m_wizard->GetProvider( "settings" ) ) ) + { + if( !settings->NeedsUserInput() ) + { + // If the user didn't see the settings screen at all, just hide this option; we + // only offer import when we have the context of a previous version settings + // path selected by the user + m_rbImport->Show( false ); + } + else if( settings->GetModel().mode == STARTWIZARD_SETTINGS_MODE::USE_DEFAULTS ) + { + // But if they did see the screen and chose not to import, show the option but + // disable it as a breadcrumb that they can go back and choose to import settings + m_rbImport->Disable(); + + if( m_rbImport->GetValue() ) + m_rbDefaultTables->SetValue( true ); + } + else + { + m_rbImport->Enable(); + } + } + + wxString missingTablesText; + + for( const LIBRARY_TABLE_TYPE& type : m_model->missing_tables ) + { + switch( type ) + { + case LIBRARY_TABLE_TYPE::SYMBOL: + missingTablesText.Append( _( "Symbol library table" ) + "\n" ); + break; + + case LIBRARY_TABLE_TYPE::FOOTPRINT: + missingTablesText.Append( _( "Footprint library table" ) + "\n" ); + break; + + case LIBRARY_TABLE_TYPE::DESIGN_BLOCK: + missingTablesText.Append( _( "Design Block library table" ) + "\n" ); + break; + } + } + + m_stRequiredTables->SetLabel( missingTablesText.BeforeLast( '\n' ) ); + + return true; + } + +private: + std::shared_ptr m_model; + STARTWIZARD* m_wizard; +}; + + +STARTWIZARD_PROVIDER_LIBRARIES::STARTWIZARD_PROVIDER_LIBRARIES() : + STARTWIZARD_PROVIDER( wxT( "Libraries" ) ) +{ +} + + +bool STARTWIZARD_PROVIDER_LIBRARIES::NeedsUserInput() const +{ + return !LIBRARY_MANAGER::GlobalTablesValid(); +} + + +wxPanel* STARTWIZARD_PROVIDER_LIBRARIES::GetWizardPanel( wxWindow* aParent, STARTWIZARD* aWizard ) +{ + m_model = std::make_shared(); + m_model->missing_tables = LIBRARY_MANAGER::InvalidGlobalTables(); + return new PANEL_STARTWIZARD_LIBRARIES( m_model, aParent, aWizard ); +} + + +void STARTWIZARD_PROVIDER_LIBRARIES::Finish() +{ + // TODO(JE) handle importing tables from previous version and sanitizing them + + bool populateTables = m_model->mode == STARTWIZARD_LIBRARIES_MODE::USE_DEFAULTS; + + for( LIBRARY_TABLE_TYPE type : LIBRARY_MANAGER::InvalidGlobalTables() ) + { + LIBRARY_MANAGER::CreateGlobalTable( type, populateTables ); + } +} + + +void STARTWIZARD_PROVIDER_LIBRARIES::ApplyDefaults() +{ + for( LIBRARY_TABLE_TYPE type : LIBRARY_MANAGER::InvalidGlobalTables() ) + { + LIBRARY_MANAGER::CreateGlobalTable( type, true ); + } +} + diff --git a/common/startwizard/startwizard_provider_libraries.h b/common/startwizard/startwizard_provider_libraries.h new file mode 100644 index 0000000000..ad931f5aef --- /dev/null +++ b/common/startwizard/startwizard_provider_libraries.h @@ -0,0 +1,64 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright The KiCad Developers, see AUTHORS.txt for contributors. + * @author Jon Evans + * + * 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 3 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, see . + */ + + +#ifndef STARTWIZARD_PROVIDER_LIBRARIES_H +#define STARTWIZARD_PROVIDER_LIBRARIES_H + +#include +#include + +enum class STARTWIZARD_LIBRARIES_MODE +{ + USE_DEFAULTS, + IMPORT, + CREATE_BLANK +}; + +struct STARTWIZARD_PROVIDER_LIBRARIES_MODEL +{ + STARTWIZARD_LIBRARIES_MODE mode = STARTWIZARD_LIBRARIES_MODE::USE_DEFAULTS; + + std::vector missing_tables; +}; + +class STARTWIZARD_PROVIDER_LIBRARIES : public STARTWIZARD_PROVIDER +{ +public: + STARTWIZARD_PROVIDER_LIBRARIES(); + + virtual ~STARTWIZARD_PROVIDER_LIBRARIES() {} + + wxString Name() const override { return wxT( "libraries" ); } + + bool NeedsUserInput() const override; + + wxPanel* GetWizardPanel( wxWindow* aParent, STARTWIZARD* aWizard ) override; + + void Finish() override; + + void ApplyDefaults() override; + +private: + std::shared_ptr m_model; +}; + + +#endif //STARTWIZARD_PROVIDER_LIBRARIES_H diff --git a/common/startwizard/startwizard_provider_privacy.cpp b/common/startwizard/startwizard_provider_privacy.cpp new file mode 100644 index 0000000000..80c3887af6 --- /dev/null +++ b/common/startwizard/startwizard_provider_privacy.cpp @@ -0,0 +1,132 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2023 Mark Roszko + * Copyright (C) 1992-2023 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 3 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, see . + */ + +#include +#include +#include +#include + +#include +#include +#include + + +class PANEL_STARTWIZARD_PRIVACY : public PANEL_STARTWIZARD_PRIVACY_BASE +{ +public: + PANEL_STARTWIZARD_PRIVACY( std::shared_ptr aModel, + wxWindow* aParent ) : + PANEL_STARTWIZARD_PRIVACY_BASE( aParent ), + m_model( aModel ) + { +#ifndef KICAD_USE_SENTRY + m_sizerDataCollection->Show( false ); +#endif + }; + + bool TransferDataFromWindow() override + { + m_model->m_autoUpdateKiCad = m_cbAutoUpdateKiCad->GetValue(); + m_model->m_autoUpdatePCM = m_cbAutoUpdatePCM->GetValue(); + +#ifdef KICAD_USE_SENTRY + m_model->m_enableSentry = m_cbDataCollection->GetValue(); +#else + m_model->m_enableSentry = false; +#endif + + return true; + } + + bool TransferDataToWindow() override + { + m_cbAutoUpdateKiCad->SetValue( m_model->m_autoUpdateKiCad ); + m_cbAutoUpdatePCM->SetValue( m_model->m_autoUpdatePCM ); + +#ifdef KICAD_USE_SENTRY + m_cbDataCollection->SetValue( m_model->m_enableSentry ); +#endif + + return true; + } + +private: + std::shared_ptr m_model; +}; + + +STARTWIZARD_PROVIDER_PRIVACY::STARTWIZARD_PROVIDER_PRIVACY() : + STARTWIZARD_PROVIDER( wxT( "Updates && Privacy" ) ) +{ +} + + +bool STARTWIZARD_PROVIDER_PRIVACY::NeedsUserInput() const +{ + COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings(); + + return !commonSettings->m_DoNotShowAgain.update_check_prompt + || !commonSettings->m_DoNotShowAgain.data_collection_prompt; +} + + +wxPanel* STARTWIZARD_PROVIDER_PRIVACY::GetWizardPanel( wxWindow* aParent, STARTWIZARD* aWizard ) +{ + m_model = std::make_shared(); + return new PANEL_STARTWIZARD_PRIVACY( m_model, aParent ); +} + + +void STARTWIZARD_PROVIDER_PRIVACY::Finish() +{ + COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings(); + KICAD_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings( "kicad" ); + + if( !commonSettings->m_DoNotShowAgain.update_check_prompt ) + { + settings->m_KiCadUpdateCheck = m_model->m_autoUpdateKiCad; + settings->m_PcmUpdateCheck = m_model->m_autoUpdatePCM; + commonSettings->m_DoNotShowAgain.update_check_prompt = true; + } + + if( !commonSettings->m_DoNotShowAgain.data_collection_prompt ) + { + APP_MONITOR::SENTRY::Instance()->SetSentryOptIn( m_model->m_enableSentry ); + commonSettings->m_DoNotShowAgain.data_collection_prompt = true; + } + + Pgm().SaveCommonSettings(); +} + + +void STARTWIZARD_PROVIDER_PRIVACY::ApplyDefaults() +{ + COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings(); + KICAD_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings( "kicad" ); + + settings->m_KiCadUpdateCheck = true; + settings->m_PcmUpdateCheck = true; + APP_MONITOR::SENTRY::Instance()->SetSentryOptIn( false ); + + commonSettings->m_DoNotShowAgain.update_check_prompt = true; + commonSettings->m_DoNotShowAgain.data_collection_prompt = true; + + Pgm().SaveCommonSettings(); +} diff --git a/kicad/startwizard_provider_pcm.h b/common/startwizard/startwizard_provider_privacy.h similarity index 60% rename from kicad/startwizard_provider_pcm.h rename to common/startwizard/startwizard_provider_privacy.h index fd8022bfab..7730ba667d 100644 --- a/kicad/startwizard_provider_pcm.h +++ b/common/startwizard/startwizard_provider_privacy.h @@ -21,29 +21,35 @@ #ifndef STARTWIZARD_PROVIDER_PCM_H #define STARTWIZARD_PROVIDER_PCM_H -#include +#include #include -struct PANEL_PCM_STARTWIZARD_MODEL +struct STARTWIZARD_PROVIDER_PRIVACY_MODEL { - bool m_autoUpdateCheck; + bool m_autoUpdateKiCad = true; + bool m_autoUpdatePCM = true; + bool m_enableSentry = false; }; -class STARTWIZARD_PROVIDER_PCM : public STARTWIZARD_PROVIDER +class STARTWIZARD_PROVIDER_PRIVACY : public STARTWIZARD_PROVIDER { public: - STARTWIZARD_PROVIDER_PCM(); + STARTWIZARD_PROVIDER_PRIVACY(); - virtual ~STARTWIZARD_PROVIDER_PCM() {} + virtual ~STARTWIZARD_PROVIDER_PRIVACY() {} - virtual bool NeedsUserInput() const override; + wxString Name() const override { return wxT( "privacy" ); } - virtual wxPanel* GetWizardPanel( wxWindow* aParent ) override; + bool NeedsUserInput() const override; - virtual void Finish() override; + wxPanel* GetWizardPanel( wxWindow* aParent, STARTWIZARD* aWizard ) override; + + void Finish() override; + + void ApplyDefaults() override; private: - std::shared_ptr m_model; + std::shared_ptr m_model; }; #endif diff --git a/common/startwizard/startwizard_provider_settings.cpp b/common/startwizard/startwizard_provider_settings.cpp new file mode 100644 index 0000000000..a580ac8154 --- /dev/null +++ b/common/startwizard/startwizard_provider_settings.cpp @@ -0,0 +1,226 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright The KiCad Developers, see AUTHORS.txt for contributors. + * @author Jon Evans + * + * 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 3 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, see . + */ + + + +#include +#include "startwizard_provider_settings.h" + +#include +#include +#include +#include +#include +#include + + +class PANEL_STARTWIZARD_SETTINGS : public PANEL_STARTWIZARD_SETTINGS_BASE +{ +public: + PANEL_STARTWIZARD_SETTINGS( std::shared_ptr aModel, + wxWindow* aParent ) : + PANEL_STARTWIZARD_SETTINGS_BASE( aParent ), + m_model( aModel ) + { + m_btnCustomPath->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) ); + }; + + bool TransferDataFromWindow() override + { + if( m_btnUseDefaults->GetValue() ) + { + m_model->mode = STARTWIZARD_SETTINGS_MODE::USE_DEFAULTS; + } + else + { + m_model->mode = STARTWIZARD_SETTINGS_MODE::IMPORT; + // Round-trip through a wxFileName object to remove any trailing separators + wxFileName path( m_cbPath->GetValue(), wxEmptyString ); + m_model->import_path = path.GetPath(); + } + + return true; + } + + bool TransferDataToWindow() override + { + SETTINGS_MANAGER& manager = Pgm().GetSettingsManager(); + std::vector paths; + + if( m_model->mode == STARTWIZARD_SETTINGS_MODE::USE_DEFAULTS ) + { + m_btnUseDefaults->SetValue( true ); + + if( !manager.GetPreviousVersionPaths( &paths ) ) + { + m_btnPrevVer->SetLabelText( _( "Import settings from a previous version (none found)" ) ); + } + else + { + m_cbPath->Clear(); + + for( const auto& path : paths ) + m_cbPath->Append( path ); + + m_cbPath->SetSelection( 0 ); + } + + // SetValue does not fire the "OnRadioButton" event, so have to fabricate this + wxCommandEvent dummy; + OnDefaultSelected( dummy ); + } + else + { + m_btnPrevVer->SetValue( true ); + m_cbPath->SetStringSelection( m_model->import_path ); + + wxCommandEvent dummy; + OnPrevVerSelected( dummy ); + } + + return true; + } + +protected: + void OnPrevVerSelected( wxCommandEvent& event ) override; + + void OnPathChanged( wxCommandEvent& event ) override; + + void OnPathDefocused( wxFocusEvent& event ) override; + + void OnChoosePath( wxCommandEvent& event ) override; + + void OnDefaultSelected( wxCommandEvent& event ) override; + +private: + bool validatePath(); + + void showPathError( bool aShow = true ); + + std::shared_ptr m_model; +}; + + +void PANEL_STARTWIZARD_SETTINGS::OnPrevVerSelected( wxCommandEvent& event ) +{ + m_cbPath->Enable(); + m_btnCustomPath->Enable(); + validatePath(); +} + + +void PANEL_STARTWIZARD_SETTINGS::OnPathChanged( wxCommandEvent& event ) +{ + validatePath(); +} + + +void PANEL_STARTWIZARD_SETTINGS::OnPathDefocused( wxFocusEvent& event ) +{ + validatePath(); +} + + +void PANEL_STARTWIZARD_SETTINGS::OnChoosePath( wxCommandEvent& event ) +{ + wxDirDialog dlg( nullptr, _( "Select Settings Path" ), m_cbPath->GetValue(), + wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST ); + + if( dlg.ShowModal() == wxID_OK ) + { + m_cbPath->SetValue( dlg.GetPath() ); + validatePath(); + } +} + + +void PANEL_STARTWIZARD_SETTINGS::OnDefaultSelected( wxCommandEvent& event ) +{ + m_cbPath->Disable(); + m_btnCustomPath->Disable(); + showPathError( false ); +} + + +bool PANEL_STARTWIZARD_SETTINGS::validatePath() +{ + SETTINGS_MANAGER& manager = Pgm().GetSettingsManager(); + wxString path = m_cbPath->GetValue(); + bool valid = manager.IsSettingsPathValid( path ); + + showPathError( !valid ); + + return valid; +} + + +void PANEL_STARTWIZARD_SETTINGS::showPathError( bool aShow ) +{ + m_lblPathError->Show( aShow ); + Layout(); + Fit(); +} + + +STARTWIZARD_PROVIDER_SETTINGS::STARTWIZARD_PROVIDER_SETTINGS() : + STARTWIZARD_PROVIDER( wxT( "Configuration" ) ) +{ +} + + +bool STARTWIZARD_PROVIDER_SETTINGS::NeedsUserInput() const +{ + return !Pgm().GetSettingsManager().SettingsDirectoryValid(); +} + + +wxPanel* STARTWIZARD_PROVIDER_SETTINGS::GetWizardPanel( wxWindow* aParent, STARTWIZARD* aWizard ) +{ + m_model = std::make_shared(); + return new PANEL_STARTWIZARD_SETTINGS( m_model, aParent ); +} + + +void STARTWIZARD_PROVIDER_SETTINGS::Finish() +{ + SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); + COMMON_SETTINGS* settings = Pgm().GetCommonSettings(); + + if( m_model->mode == STARTWIZARD_SETTINGS_MODE::USE_DEFAULTS ) + { + settings->SaveToFile( mgr.GetPathForSettingsFile( settings ) ); + return; + } + + // Else, perform migration. First copy the old files in, then reload the in-memory copies. + mgr.MigrateFromPreviousVersion( m_model->import_path ); + mgr.Load(); +} + + +void STARTWIZARD_PROVIDER_SETTINGS::ApplyDefaults() +{ + SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); + COMMON_SETTINGS* settings = Pgm().GetCommonSettings(); + + // We will already have created default settings in memory; make sure they are persisted + // so we don't get first-run wizard restarts + settings->SaveToFile( mgr.GetPathForSettingsFile( settings ) ); +} diff --git a/common/startwizard/startwizard_provider_settings.h b/common/startwizard/startwizard_provider_settings.h new file mode 100644 index 0000000000..7ee018295e --- /dev/null +++ b/common/startwizard/startwizard_provider_settings.h @@ -0,0 +1,67 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright The KiCad Developers, see AUTHORS.txt for contributors. + * @author Jon Evans + * + * 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 3 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, see . + */ + + +#ifndef STARTWIZARD_PROVIDER_SETTINGS_H +#define STARTWIZARD_PROVIDER_SETTINGS_H + +#include + +#include + + +enum class STARTWIZARD_SETTINGS_MODE +{ + USE_DEFAULTS, + IMPORT +}; + +struct STARTWIZARD_PROVIDER_SETTINGS_MODEL +{ + STARTWIZARD_SETTINGS_MODE mode = STARTWIZARD_SETTINGS_MODE::USE_DEFAULTS; + wxString import_path; +}; + +class STARTWIZARD_PROVIDER_SETTINGS : public STARTWIZARD_PROVIDER +{ +public: + STARTWIZARD_PROVIDER_SETTINGS(); + + virtual ~STARTWIZARD_PROVIDER_SETTINGS() {} + + wxString Name() const override { return wxT( "settings" ); } + + bool NeedsUserInput() const override; + + wxPanel* GetWizardPanel( wxWindow* aParent, STARTWIZARD* aWizard ) override; + + void Finish() override; + + void ApplyDefaults() override; + + const STARTWIZARD_PROVIDER_SETTINGS_MODEL& GetModel() const { return *m_model; } + +private: + std::shared_ptr m_model; +}; + + + +#endif //STARTWIZARD_PROVIDER_SETTINGS_H diff --git a/common/startwizard_provider_datacollection.cpp b/common/startwizard_provider_datacollection.cpp deleted file mode 100644 index 160b8abafc..0000000000 --- a/common/startwizard_provider_datacollection.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2023 Mark Roszko - * Copyright (C) 1992-2023 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 3 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, see . - */ - -#include "startwizard_provider_datacollection.h" - -#include - -#include "pgm_base.h" -#include - - -wxPanel* STARTWIZARD_PROVIDER_DATACOLLECTION::GetWizardPanel( wxWindow* aParent ) -{ - m_model = std::make_shared(); - return new PANEL_DATA_COLLECTION( m_model, aParent ); -} - - -void STARTWIZARD_PROVIDER_DATACOLLECTION::Finish() -{ - APP_MONITOR::SENTRY::Instance()->SetSentryOptIn( m_model->m_enableSentry ); - - Pgm().GetCommonSettings()->m_DoNotShowAgain.data_collection_prompt = true; -} - - -bool STARTWIZARD_PROVIDER_DATACOLLECTION::NeedsUserInput() const -{ - return !Pgm().GetCommonSettings()->m_DoNotShowAgain.data_collection_prompt; -} diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index caf2e0e7ec..4a90bc00cf 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -415,7 +415,6 @@ set( EESCHEMA_SRCS schematic.cpp schematic_settings.cpp schematic_undo_redo.cpp - startwizard_provider_schlib.cpp sheet.cpp symbol.cpp symbol_async_loader.cpp diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index f940ebba16..ab385b7d47 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -69,7 +69,6 @@ #include #include #include -#include "startwizard_provider_schlib.h" #include #include @@ -197,10 +196,6 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER { // only run this under single_top, not under a project manager. frame->CreateServer( KICAD_SCH_PORT_SERVICE_NUMBER ); - - // Preload libraries, since this won't have been started by the manager - wxCHECK( aKiway, frame ); - Kiface().PreloadLibraries( &aKiway->Prj() ); } return frame; @@ -412,8 +407,6 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER void PreloadLibraries( PROJECT* aProject ) override; void ProjectChanged() override; - void GetStartupProviders( std::vector>& aProviders ) override; - private: bool loadGlobalLibTable(); bool loadGlobalDesignBlockLibTable(); @@ -824,9 +817,3 @@ bool IFACE::HandleJobConfig( JOB* aJob, wxWindow* aParent ) { return m_jobHandler->HandleJobConfig( aJob, aParent ); } - - -void IFACE::GetStartupProviders( std::vector>& aProviders ) -{ - aProviders.push_back( std::make_unique() ); -} diff --git a/eeschema/eeschema_helpers.cpp b/eeschema/eeschema_helpers.cpp index 7cd6460db1..ff662cdad2 100644 --- a/eeschema/eeschema_helpers.cpp +++ b/eeschema/eeschema_helpers.cpp @@ -59,7 +59,7 @@ SETTINGS_MANAGER* EESCHEMA_HELPERS::GetSettingsManager() } else { - s_SettingsManager = new SETTINGS_MANAGER( true ); + s_SettingsManager = new SETTINGS_MANAGER(); } } diff --git a/eeschema/startwizard_provider_schlib.h b/eeschema/startwizard_provider_schlib.h index a051e639bb..b273ad34c5 100644 --- a/eeschema/startwizard_provider_schlib.h +++ b/eeschema/startwizard_provider_schlib.h @@ -22,7 +22,7 @@ #define STARTWIZARD_PROVIDER_SCHLIB_H #include -#include +#include <../include/startwizard/startwizard_provider.h> class PANEL_GLOBAL_LIB_TABLE_CONFIG_MODEL; diff --git a/include/dialogs/dialog_migrate_settings.h b/include/dialogs/dialog_migrate_settings.h deleted file mode 100644 index a4163d8a3f..0000000000 --- a/include/dialogs/dialog_migrate_settings.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2020 Jon Evans - * Copyright The 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 3 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, see . - */ - -#pragma once - -#include "dialog_migrate_settings_base.h" - - -class SETTINGS_MANAGER; - - -class KICOMMON_API DIALOG_MIGRATE_SETTINGS : public DIALOG_MIGRATE_SETTINGS_BASE -{ -public: - DIALOG_MIGRATE_SETTINGS( SETTINGS_MANAGER* aManager ); - ~DIALOG_MIGRATE_SETTINGS() = default; - - bool TransferDataToWindow() override; - bool TransferDataFromWindow() override; - -protected: - - void OnPrevVerSelected( wxCommandEvent& event ) override; - void OnPathChanged( wxCommandEvent& event ) override; - void OnPathDefocused( wxFocusEvent& event ) override; - void OnChoosePath( wxCommandEvent& event ) override; - void OnDefaultSelected( wxCommandEvent& event ) override; - -private: - bool validatePath(); - - void showPathError( bool aShow = true ); - -private: - SETTINGS_MANAGER* m_manager; -}; diff --git a/include/kiway.h b/include/kiway.h index 157133c26f..6f3dd44b83 100644 --- a/include/kiway.h +++ b/include/kiway.h @@ -244,11 +244,6 @@ struct KIFACE */ virtual void GetActions( std::vector& aActions ) const = 0; - /** - * Append this Kiface's registered startup provideers to the given list - */ - virtual void GetStartupProviders( std::vector>& aProviders ) {} - virtual int HandleJob( JOB* aJob, REPORTER* aReporter, PROGRESS_REPORTER* aProgressReporter ) { return 0; diff --git a/include/libraries/library_manager.h b/include/libraries/library_manager.h index 929f24e856..7664981190 100644 --- a/include/libraries/library_manager.h +++ b/include/libraries/library_manager.h @@ -47,6 +47,14 @@ public: ~LIBRARY_MANAGER(); + /// @return true if all required global tables are present on disk and valid + static bool GlobalTablesValid(); + + /// @return a list of global tables that are not valid (or an empty list if GlobalTablesValid() returns true) + static std::vector InvalidGlobalTables(); + + static bool CreateGlobalTable( LIBRARY_TABLE_TYPE aType, bool aPopulateDefaultLibraries ); + void LoadGlobalTables(); /// Notify all adapters that the project has changed @@ -136,6 +144,8 @@ private: std::map> m_projectTables; std::map> m_adapters; + + static const std::map m_typeToFilenameMap; }; diff --git a/include/settings/settings_manager.h b/include/settings/settings_manager.h index f67995b6a0..1e64ab6efe 100644 --- a/include/settings/settings_manager.h +++ b/include/settings/settings_manager.h @@ -48,10 +48,17 @@ class LOCKFILE; class KICOMMON_API SETTINGS_MANAGER { public: - SETTINGS_MANAGER( bool aHeadless = false ); + SETTINGS_MANAGER(); ~SETTINGS_MANAGER(); + /** + * @return true if the settings directory for this version of KiCad exists and has at least a + * common settings file (kicad_common.json). Used to know whether or not the first-run wizard + * needs to be shown. + */ + bool SettingsDirectoryValid() const; + /** * @return true if settings load was successful */ @@ -272,28 +279,11 @@ public: wxString GetPathForSettingsFile( JSON_SETTINGS* aSettings ); /** - * Handle the initialization of the user settings directory and migration from previous - * KiCad versions as needed. + * Handle migration of the settings from previous KiCad versions. * - * This method will check for the existence of the user settings path for this KiCad version. - * If it exists, settings load will proceed normally using that path. - * - * If that directory is empty or does not exist, the migration wizard will be launched, which - * will give users the option to migrate settings from a previous KiCad version (if one is - * found), manually specify a directory to migrate from, or start with default settings. - * - * @return true if migration was successful or not necessary, false otherwise. + * @return true if migration was successful, false otherwise. */ - bool MigrateIfNeeded(); - - /** - * Helper for #DIALOG_MIGRATE_SETTINGS to specify a source for migration. - * - * @param aSource is a directory containing settings files to migrate from (can be empty). - */ - void SetMigrationSource( const wxString& aSource ) { m_migration_source = aSource; } - - void SetMigrateLibraryTables( bool aMigrate = true ) { m_migrateLibraryTables = aMigrate; } + bool MigrateFromPreviousVersion( const wxString& aSourcePath ); /** * Retrieve the name of the most recent previous KiCad version that can be found in the @@ -510,9 +500,6 @@ private: private: - /// True if running outside a UI context. - bool m_headless; - /// The kiway this settings manager interacts with. KIWAY* m_kiway; @@ -527,8 +514,6 @@ private: // Convenience shortcut COMMON_SETTINGS* m_common_settings; - wxString m_migration_source; - /// If true, the symbol and footprint library tables will be migrated from the previous version. bool m_migrateLibraryTables; diff --git a/kicad/startwizard.h b/include/startwizard/startwizard.h similarity index 79% rename from kicad/startwizard.h rename to include/startwizard/startwizard.h index a410bff844..1dac6e02ed 100644 --- a/kicad/startwizard.h +++ b/include/startwizard/startwizard.h @@ -20,20 +20,26 @@ #ifndef STARTWIZARD_H #define STARTWIZARD_H -class KIWAY; +#include + class wxWizard; class wxWindow; +class STARTWIZARD_PROVIDER; -class STARTWIZARD +class KICOMMON_API STARTWIZARD { public: - STARTWIZARD( KIWAY* aKiway ); + STARTWIZARD(); + + ~STARTWIZARD(); void CheckAndRun( wxWindow* parent ); + STARTWIZARD_PROVIDER* GetProvider( const wxString& aName ); + private: - KIWAY* m_kiway; wxWizard* m_wizard; + std::vector> m_providers; }; #endif diff --git a/include/startwizard_provider.h b/include/startwizard/startwizard_provider.h similarity index 82% rename from include/startwizard_provider.h rename to include/startwizard/startwizard_provider.h index ea1f06b185..63adba2932 100644 --- a/include/startwizard_provider.h +++ b/include/startwizard/startwizard_provider.h @@ -26,6 +26,7 @@ class wxWizardPageSimple; class wxPanel; class wxWindow; +class STARTWIZARD; class STARTWIZARD_PROVIDER { @@ -34,14 +35,19 @@ public: virtual ~STARTWIZARD_PROVIDER() {} + virtual wxString Name() const = 0; + virtual bool NeedsUserInput() const { return false; } - virtual wxPanel* GetWizardPanel( wxWindow* aParent ) { return nullptr; } + virtual wxPanel* GetWizardPanel( wxWindow* aParent, STARTWIZARD* aWizard ) { return nullptr; } const wxString& GetPageName() const { return m_pageName; } virtual void Finish() {} + /// Apply whatever actions and settings should happen if the user cancels the startup wizard + virtual void ApplyDefaults() {} + private: wxString m_pageName; }; diff --git a/include/startwizard_provider_datacollection.h b/include/startwizard_provider_datacollection.h deleted file mode 100644 index 06e6106dfd..0000000000 --- a/include/startwizard_provider_datacollection.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2023 Mark Roszko - * Copyright (C) 1992-2023 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 3 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, see . - */ - -#ifndef STARTWIZARD_PROVIDER_DATACOLLECTION_H -#define STARTWIZARD_PROVIDER_DATACOLLECTION_H - -#include -#include -#include - -class STARTWIZARD_PROVIDER_DATACOLLECTION : public STARTWIZARD_PROVIDER -{ -public: - STARTWIZARD_PROVIDER_DATACOLLECTION() : STARTWIZARD_PROVIDER( wxT( "Data Collection" ) ){}; - - virtual bool NeedsUserInput() const override; - - virtual wxPanel* GetWizardPanel( wxWindow* aParent ) override; - - virtual void Finish() override; - -private: - std::shared_ptr m_model; -}; - -#endif \ No newline at end of file diff --git a/kicad/CMakeLists.txt b/kicad/CMakeLists.txt index 69a3ba6c88..502e488075 100644 --- a/kicad/CMakeLists.txt +++ b/kicad/CMakeLists.txt @@ -34,7 +34,6 @@ set( KICAD_SRCS dialogs/panel_kicad_launcher.cpp dialogs/panel_jobset_base.cpp dialogs/panel_jobset.cpp - dialogs/panel_pcm_startwizard_base.cpp files-io.cpp jobs_runner.cpp import_proj.cpp @@ -48,8 +47,6 @@ set( KICAD_SRCS project_tree_traverser.cpp update_manager.cpp toolbars_kicad_manager.cpp - startwizard.cpp - startwizard_provider_pcm.cpp tools/kicad_manager_actions.cpp tools/kicad_manager_control.cpp ) diff --git a/kicad/dialogs/panel_pcm_startwizard_base.cpp b/kicad/dialogs/panel_pcm_startwizard_base.cpp deleted file mode 100644 index 1263715f97..0000000000 --- a/kicad/dialogs/panel_pcm_startwizard_base.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "panel_pcm_startwizard_base.h" - -/////////////////////////////////////////////////////////////////////////// - -PANEL_PCM_STARTWIZARD_BASE::PANEL_PCM_STARTWIZARD_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) -{ - wxBoxSizer* bPanelSizer; - bPanelSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer8; - bSizer8 = new wxBoxSizer( wxVERTICAL ); - - m_stIntro = new wxStaticText( this, wxID_ANY, _("KiCad includes support for third party content via the Plugin and Content Manager (PCM)."), wxDefaultPosition, wxDefaultSize, 0 ); - m_stIntro->Wrap( 400 ); - bSizer8->Add( m_stIntro, 0, wxALL, 5 ); - - m_cbAutoUpdate = new wxCheckBox( this, wxID_ANY, _("Automatically check for content updates on launch of KiCad"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer8->Add( m_cbAutoUpdate, 0, wxALL, 5 ); - - - bPanelSizer->Add( bSizer8, 1, wxEXPAND, 5 ); - - - this->SetSizer( bPanelSizer ); - this->Layout(); - bPanelSizer->Fit( this ); -} - -PANEL_PCM_STARTWIZARD_BASE::~PANEL_PCM_STARTWIZARD_BASE() -{ -} diff --git a/kicad/dialogs/panel_startwizard_pcm_base.fbp b/kicad/dialogs/panel_startwizard_pcm_base.fbp deleted file mode 100644 index cf296001d6..0000000000 --- a/kicad/dialogs/panel_startwizard_pcm_base.fbp +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - panel_pcm_startwizard_base - 1000 - none - - - 1 - PanelPcmStartWizard - - . - - 1 - 1 - 1 - 1 - UI - 0 - 1 - 0 - - 0 - wxAUI_MGR_DEFAULT - - - 1 - 1 - impl_virtual - - - 0 - wxID_ANY - - - PANEL_PCM_STARTWIZARD_BASE - - -1,-1 - - - 0 - - - wxTAB_TRAVERSAL - - - bPanelSizer - wxHORIZONTAL - none - - 5 - wxEXPAND - 1 - - - bSizer8 - wxVERTICAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - KiCad includes support for third party content via the Plugin and Content Manager (PCM). - 0 - - 0 - - - 0 - - 1 - m_stIntro - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - 400 - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Automatically check for content updates on launch of KiCad - - 0 - - - 0 - - 1 - m_cbAutoUpdate - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - diff --git a/kicad/kicad.cpp b/kicad/kicad.cpp index 05af2a1875..4401e1d05f 100644 --- a/kicad/kicad.cpp +++ b/kicad/kicad.cpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include <../include/startwizard/startwizard.h> #include #include #include @@ -239,7 +239,7 @@ bool PGM_KICAD::OnPgmInit() wxWindow::FromDIP( wxSize( 775, -1 ), NULL ) ); frame = managerFrame; - STARTWIZARD startWizard( &Kiway ); + STARTWIZARD startWizard; startWizard.CheckAndRun( frame ); } else diff --git a/kicad/startwizard.cpp b/kicad/startwizard.cpp deleted file mode 100644 index 89986be61b..0000000000 --- a/kicad/startwizard.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2023 Mark Roszko - * Copyright (C) 1992-2023 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 3 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, see . - */ - -#include -#include -#include -#include -#include -#include - -#ifdef KICAD_USE_SENTRY -#include -#endif - -#include -#include - - -class STARTWIZARD_PAGE : public wxWizardPageSimple -{ -public: - STARTWIZARD_PAGE( wxWizard* aParent, const wxString& aPageTitle ) : wxWizardPageSimple( aParent ) - { - m_mainSizer = new wxBoxSizer( wxVERTICAL ); - - wxStaticText* pageTitle = new wxStaticText( this, -1, wxString::Format( _( "Setup: %s" ), aPageTitle ) ); - pageTitle->SetFont( - wxFont( 14, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ) ); - m_mainSizer->Add( pageTitle, 0, wxALIGN_CENTRE | wxALL, 5 ); - - wxStaticLine* pageDivider = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, - wxDefaultSize, wxLI_HORIZONTAL ); - m_mainSizer->Add( pageDivider, 0, wxEXPAND | wxALL, 5 ); - } - - void AddContent(wxPanel* aContent) - { - m_mainSizer->Add( aContent ); - - SetSizerAndFit( m_mainSizer ); - } - -private: - wxBoxSizer* m_mainSizer; -}; - - -STARTWIZARD::STARTWIZARD( KIWAY* aKiway ) : - m_kiway( aKiway ), - m_wizard( nullptr ) -{ -} - - -void STARTWIZARD::CheckAndRun( wxWindow* aParent ) -{ - KIFACE* kiface = nullptr; - - std::vector> providers; - -#ifdef KICAD_USE_SENTRY - providers.push_back( std::make_unique() ); -#endif - providers.push_back( std::make_unique() ); - - kiface = m_kiway->KiFACE( KIWAY::FACE_SCH ); - kiface->GetStartupProviders( providers ); - - kiface = m_kiway->KiFACE( KIWAY::FACE_PCB ); - kiface->GetStartupProviders( providers ); - - if( providers.size() == 0 ) - return; - - bool wizardRequired = std::any_of( providers.cbegin(), providers.cend(), - []( const std::unique_ptr& aProvider ) -> bool - { - return aProvider->NeedsUserInput(); - } ); - - if( !wizardRequired ) - return; - - - Pgm().HideSplash(); - - m_wizard = new wxWizard( aParent ); - - wxWizardPageSimple* firstPage = nullptr; - wxWizardPageSimple* lastPage = nullptr; - for( std::unique_ptr& provider : providers ) - { - if( !provider->NeedsUserInput() ) - continue; - - STARTWIZARD_PAGE* page = new STARTWIZARD_PAGE( m_wizard, provider->GetPageName() ); - wxPanel* panel = provider->GetWizardPanel( page ); - page->AddContent( panel ); - - if( firstPage == nullptr ) - firstPage = page; - - if( lastPage != nullptr ) - { - lastPage->Chain( page ); - } - - lastPage = page; - } - - m_wizard->SetPageSize( m_wizard->GetPageSize() * 1.5 ); - - bool finished = m_wizard->RunWizard( firstPage ); - - if (finished) - { - for( std::unique_ptr& provider : providers ) - { - if( !provider->NeedsUserInput() ) - continue; - - provider->Finish(); - } - } - - m_wizard->Destroy(); - m_wizard = nullptr; -} diff --git a/kicad/startwizard_provider_pcm.cpp b/kicad/startwizard_provider_pcm.cpp deleted file mode 100644 index da88871688..0000000000 --- a/kicad/startwizard_provider_pcm.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2023 Mark Roszko - * Copyright (C) 1992-2023 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 3 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, see . - */ - -#include "startwizard_provider_pcm.h" - -#include - -#include "dialogs/panel_pcm_startwizard_base.h" -#include "settings/kicad_settings.h" -#include "pgm_kicad.h" - -class PANEL_PCM_STARTWIZARD : public PANEL_PCM_STARTWIZARD_BASE -{ -public: - PANEL_PCM_STARTWIZARD( std::shared_ptr aModel, - wxWindow* aParent ) : - PANEL_PCM_STARTWIZARD_BASE( aParent ), - m_model( aModel ){}; - - - bool TransferDataFromWindow() override - { - m_model->m_autoUpdateCheck = m_cbAutoUpdate->GetValue(); - - return true; - } - - bool TransferDataToWindow() override { return true; } - -private: - std::shared_ptr m_model; -}; - - -STARTWIZARD_PROVIDER_PCM::STARTWIZARD_PROVIDER_PCM() : - STARTWIZARD_PROVIDER( wxT( "Plugin & Content Manager" ) ) -{ -} - - -bool STARTWIZARD_PROVIDER_PCM::NeedsUserInput() const -{ - COMMON_SETTINGS* commonSettings = PgmTop().GetCommonSettings(); - return !commonSettings->m_DoNotShowAgain.update_check_prompt; -} - - -wxPanel* STARTWIZARD_PROVIDER_PCM::GetWizardPanel( wxWindow* aParent ) -{ - m_model = std::make_shared(); - return new PANEL_PCM_STARTWIZARD( m_model, aParent ); -} - - -void STARTWIZARD_PROVIDER_PCM::Finish() -{ - COMMON_SETTINGS* commonSettings = PgmTop().GetCommonSettings(); - KICAD_SETTINGS* settings = static_cast( PgmTop().PgmSettings() ); - - if( !commonSettings->m_DoNotShowAgain.update_check_prompt ) - { - if( m_model->m_autoUpdateCheck ) - { - settings->m_KiCadUpdateCheck = true; - settings->m_PcmUpdateCheck = true; - } - else - { - settings->m_KiCadUpdateCheck = false; - settings->m_PcmUpdateCheck = false; - } - } -} diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 96328db355..785a7bb9b4 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -392,8 +392,6 @@ set( PCBNEW_CLASS_SRCS zone_filler.cpp edit_zone_helpers.cpp - startwizard_provider_fplib.cpp - ratsnest/ratsnest.cpp tools/array_tool.cpp diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 704e33f3c1..393528700d 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -69,7 +69,6 @@ #include <3d_viewer/toolbars_3d.h> #include #include -#include "startwizard_provider_fplib.h" #include @@ -392,8 +391,6 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER bool HandleJobConfig( JOB* aJob, wxWindow* aParent ) override; - void GetStartupProviders( std::vector>& aProviders ) override; - private: bool loadGlobalLibTable(); @@ -622,9 +619,3 @@ bool IFACE::HandleJobConfig( JOB* aJob, wxWindow* aParent ) { return m_jobHandler->HandleJobConfig( aJob, aParent ); } - - -void IFACE::GetStartupProviders( std::vector>& aProviders ) -{ - aProviders.push_back( std::make_unique() ); -} diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp index fc74a13fd9..b24940b2e4 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp @@ -116,7 +116,7 @@ SETTINGS_MANAGER* GetSettingsManager() { // Ensure wx system settings stuff is available ignore_unused( wxTheApp ); - s_SettingsManager = new SETTINGS_MANAGER( true ); + s_SettingsManager = new SETTINGS_MANAGER(); } } diff --git a/pcbnew/startwizard_provider_fplib.cpp b/pcbnew/startwizard_provider_fplib.cpp deleted file mode 100644 index 0b3bd4495b..0000000000 --- a/pcbnew/startwizard_provider_fplib.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2019 Wayne Stambaugh - * Copyright (C) 2019 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 3 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, see . - */ - -#include "startwizard_provider_fplib.h" -#include - -#include -#include -#include - -#include "fp_lib_table.h" - -class PANEL_GLOBAL_FP_LIB_TABLE_CONFIG : public PANEL_GLOBAL_LIB_TABLE_CONFIG -{ -public: - PANEL_GLOBAL_FP_LIB_TABLE_CONFIG( wxWindow* aParent, std::shared_ptr aModel ) : - PANEL_GLOBAL_LIB_TABLE_CONFIG( aParent, _( "footprint" ), aModel, KIWAY::FACE_PCB ){}; - - virtual ~PANEL_GLOBAL_FP_LIB_TABLE_CONFIG(){}; - - virtual wxFileName GetGlobalTableFileName() override { return FP_LIB_TABLE::GetGlobalTableFileName(); }; - - bool TransferDataFromWindow() override; -}; - - -bool PANEL_GLOBAL_FP_LIB_TABLE_CONFIG::TransferDataFromWindow() -{ - - return true; -} - - -STARTWIZARD_PROVIDER_FPLIB::STARTWIZARD_PROVIDER_FPLIB() : - STARTWIZARD_PROVIDER( wxT( "Footprint Libraries" ) ) -{ -} - - -wxPanel* STARTWIZARD_PROVIDER_FPLIB::GetWizardPanel( wxWindow* aParent ) -{ - m_model = std::make_shared(); - return new PANEL_GLOBAL_FP_LIB_TABLE_CONFIG( aParent, m_model ); -} - - -bool STARTWIZARD_PROVIDER_FPLIB::NeedsUserInput() const -{ - wxFileName fn = FP_LIB_TABLE::GetGlobalTableFileName(); - - return !fn.FileExists(); -} - - -void STARTWIZARD_PROVIDER_FPLIB::Finish() -{ - // Create an empty table if requested by the user. - if( m_model->m_tableMode == PANEL_GLOBAL_LIB_TABLE_CONFIG_MODEL::TABLE_MODE::EMPTY ) - { - FP_LIB_TABLE emptyTable; - - try - { - emptyTable.Save( FP_LIB_TABLE::GetGlobalTableFileName() ); - } - catch( const IO_ERROR& ioe ) - { - DisplayError( NULL, wxString::Format( _( "Error occurred writing empty footprint " - "library table '%s'." ), - FP_LIB_TABLE::GetGlobalTableFileName() ) - + wxS( "\n" ) + ioe.What() ); - } - } - - wxFileName fn = m_model->m_defaultTablePath; - - if( m_model->m_tableMode == PANEL_GLOBAL_LIB_TABLE_CONFIG_MODEL::TABLE_MODE::CUSTOM ) - { - if( m_model->m_customTablePath.IsEmpty() ) - { - DisplayError( NULL, _( "Please select a footprint library table file." ) ); - } - - fn = m_model->m_customTablePath; - - // Make sure the footprint library table to copy actually exists. - if( !fn.FileExists() ) - { - DisplayError( NULL, wxString::Format( _( "File '%s' not found." ), fn.GetFullPath() ) ); - } - - // Make sure the footprint library table to copy is a valid footprint library table file. - FP_LIB_TABLE tmpTable; - - try - { - tmpTable.Load( fn.GetFullPath() ); - } - catch( const IO_ERROR& ioe ) - { - DisplayError( NULL, - wxString::Format( _( "'%s' is not a valid footprint library table." ), - fn.GetFullPath() ) - + wxS( "\n" ) + ioe.What() ); - } - } - - // Create the config path if it doesn't already exist. - wxFileName fpTableFileName = FP_LIB_TABLE::GetGlobalTableFileName(); - - if( !fpTableFileName.DirExists() && !fpTableFileName.Mkdir( 0x777, wxPATH_MKDIR_FULL ) ) - { - DisplayError( NULL, wxString::Format( _( "Cannot create library table path '%s'." ), - fpTableFileName.GetPath() ) ); - } - - // Copy the global footprint library table file to the user config. - if( !::wxCopyFile( fn.GetFullPath(), fpTableFileName.GetFullPath() ) ) - { - DisplayError( NULL, wxString::Format( _( "Cannot copy footprint library table from:\n" - "%s\n" - "to:\n" - "%s." ), - fn.GetFullPath(), fpTableFileName.GetFullPath() ) ); - } - - // Load the successfully copied footprint library table file. This should not fail - // since the file was tested above. Check for failure anyway to keep the compiler - // from complaining. - try - { - FP_LIB_TABLE::LoadGlobalTable( GFootprintTable ); - } - catch( const IO_ERROR& ioe ) - { - DisplayError( NULL, - _( "Error loading footprint library table." ) + wxS( "\n" ) + ioe.What() ); - } -} \ No newline at end of file diff --git a/pcbnew/startwizard_provider_fplib.h b/pcbnew/startwizard_provider_fplib.h deleted file mode 100644 index c236d56b1c..0000000000 --- a/pcbnew/startwizard_provider_fplib.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright The 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 3 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, see . - */ - -#ifndef STARTWIZARD_PROVIDER_FPLIB_H -#define STARTWIZARD_PROVIDER_FPLIB_H - -#include -#include - -class PANEL_GLOBAL_LIB_TABLE_CONFIG_MODEL; - -class STARTWIZARD_PROVIDER_FPLIB : public STARTWIZARD_PROVIDER -{ -public: - STARTWIZARD_PROVIDER_FPLIB(); - - virtual bool NeedsUserInput() const override; - - virtual wxPanel* GetWizardPanel( wxWindow* aParent ) override; - - virtual void Finish() override; - -private: - std::shared_ptr m_model; -}; - -#endif diff --git a/qa/data/config/9.99/kicad_common.json b/qa/data/config/9.99/kicad_common.json index 8c7494096b..470158798d 100644 --- a/qa/data/config/9.99/kicad_common.json +++ b/qa/data/config/9.99/kicad_common.json @@ -74,7 +74,7 @@ "version": 4 }, "netclass_panel": { - "eeschema_shown_columns": "0 19 20 21 22", + "eeschema_shown_columns": "0 21 22 23 24", "pcbnew_shown_columns": "0 1 2 3 4 5 6 7 8 9", "sash_pos": 160 }, diff --git a/qa/schematic_utils/eeschema_test_utils.cpp b/qa/schematic_utils/eeschema_test_utils.cpp index f76c0a48e2..71bc782670 100644 --- a/qa/schematic_utils/eeschema_test_utils.cpp +++ b/qa/schematic_utils/eeschema_test_utils.cpp @@ -40,8 +40,7 @@ KI_TEST::SCHEMATIC_TEST_FIXTURE::SCHEMATIC_TEST_FIXTURE() : m_schematic( nullptr ), - m_pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) ), - m_manager( true ) + m_pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) ) { } diff --git a/qa/tests/api/test_api_proto.cpp b/qa/tests/api/test_api_proto.cpp index d8c2be3c94..f560ad6f16 100644 --- a/qa/tests/api/test_api_proto.cpp +++ b/qa/tests/api/test_api_proto.cpp @@ -38,8 +38,7 @@ BOOST_AUTO_TEST_SUITE( ApiProto ) struct PROTO_TEST_FIXTURE { - PROTO_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + PROTO_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/eeschema/erc/test_erc_four_way.cpp b/qa/tests/eeschema/erc/test_erc_four_way.cpp index e4811d50eb..cf12540051 100644 --- a/qa/tests/eeschema/erc/test_erc_four_way.cpp +++ b/qa/tests/eeschema/erc/test_erc_four_way.cpp @@ -31,8 +31,7 @@ struct ERC_REGRESSION_TEST_FIXTURE { - ERC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + ERC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/eeschema/erc/test_erc_global_labels.cpp b/qa/tests/eeschema/erc/test_erc_global_labels.cpp index de051927b6..63cfd4b899 100644 --- a/qa/tests/eeschema/erc/test_erc_global_labels.cpp +++ b/qa/tests/eeschema/erc/test_erc_global_labels.cpp @@ -31,8 +31,7 @@ struct ERC_REGRESSION_TEST_FIXTURE { - ERC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + ERC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/eeschema/erc/test_erc_ground_pins.cpp b/qa/tests/eeschema/erc/test_erc_ground_pins.cpp index 4dcfc33603..20e6a4d5ad 100644 --- a/qa/tests/eeschema/erc/test_erc_ground_pins.cpp +++ b/qa/tests/eeschema/erc/test_erc_ground_pins.cpp @@ -42,7 +42,7 @@ struct ERC_GROUND_PIN_TEST_FIXTURE { ERC_GROUND_PIN_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + m_settingsManager() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/eeschema/erc/test_erc_hierarchical_schematics.cpp b/qa/tests/eeschema/erc/test_erc_hierarchical_schematics.cpp index 869d357e42..ef06833ae4 100644 --- a/qa/tests/eeschema/erc/test_erc_hierarchical_schematics.cpp +++ b/qa/tests/eeschema/erc/test_erc_hierarchical_schematics.cpp @@ -32,7 +32,7 @@ struct ERC_REGRESSION_TEST_FIXTURE { - ERC_REGRESSION_TEST_FIXTURE() : m_settingsManager( true /* headless */ ) {} + ERC_REGRESSION_TEST_FIXTURE() {} SETTINGS_MANAGER m_settingsManager; std::unique_ptr m_schematic; diff --git a/qa/tests/eeschema/erc/test_erc_label_multiple_wires.cpp b/qa/tests/eeschema/erc/test_erc_label_multiple_wires.cpp index 00716a4187..db58bd784c 100644 --- a/qa/tests/eeschema/erc/test_erc_label_multiple_wires.cpp +++ b/qa/tests/eeschema/erc/test_erc_label_multiple_wires.cpp @@ -31,8 +31,7 @@ struct ERC_REGRESSION_TEST_FIXTURE { - ERC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + ERC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/eeschema/erc/test_erc_label_names.cpp b/qa/tests/eeschema/erc/test_erc_label_names.cpp index eb064c0f29..87b15c281f 100644 --- a/qa/tests/eeschema/erc/test_erc_label_names.cpp +++ b/qa/tests/eeschema/erc/test_erc_label_names.cpp @@ -31,7 +31,7 @@ struct ERC_REGRESSION_TEST_FIXTURE { - ERC_REGRESSION_TEST_FIXTURE() : m_settingsManager( true /* headless */ ) {} + ERC_REGRESSION_TEST_FIXTURE() {} SETTINGS_MANAGER m_settingsManager; std::unique_ptr m_schematic; diff --git a/qa/tests/eeschema/erc/test_erc_label_not_connected.cpp b/qa/tests/eeschema/erc/test_erc_label_not_connected.cpp index f4f7801033..27a6cd3fc5 100644 --- a/qa/tests/eeschema/erc/test_erc_label_not_connected.cpp +++ b/qa/tests/eeschema/erc/test_erc_label_not_connected.cpp @@ -32,8 +32,7 @@ struct ERC_REGRESSION_TEST_FIXTURE { - ERC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + ERC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/eeschema/erc/test_erc_multiple_pin_to_pin.cpp b/qa/tests/eeschema/erc/test_erc_multiple_pin_to_pin.cpp index 4a3c9db589..463ce4ce05 100644 --- a/qa/tests/eeschema/erc/test_erc_multiple_pin_to_pin.cpp +++ b/qa/tests/eeschema/erc/test_erc_multiple_pin_to_pin.cpp @@ -32,7 +32,7 @@ struct ERC_REGRESSION_TEST_FIXTURE { - ERC_REGRESSION_TEST_FIXTURE() : m_settingsManager( true /* headless */ ) {} + ERC_REGRESSION_TEST_FIXTURE() {} SETTINGS_MANAGER m_settingsManager; std::unique_ptr m_schematic; diff --git a/qa/tests/eeschema/erc/test_erc_no_connect.cpp b/qa/tests/eeschema/erc/test_erc_no_connect.cpp index 88bade4071..65fc195393 100644 --- a/qa/tests/eeschema/erc/test_erc_no_connect.cpp +++ b/qa/tests/eeschema/erc/test_erc_no_connect.cpp @@ -32,8 +32,7 @@ struct ERC_REGRESSION_TEST_FIXTURE { - ERC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + ERC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/eeschema/erc/test_erc_stacking_pins.cpp b/qa/tests/eeschema/erc/test_erc_stacking_pins.cpp index a4996d7389..16f7e28d31 100644 --- a/qa/tests/eeschema/erc/test_erc_stacking_pins.cpp +++ b/qa/tests/eeschema/erc/test_erc_stacking_pins.cpp @@ -32,8 +32,7 @@ struct ERC_REGRESSION_TEST_FIXTURE { - ERC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + ERC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/eeschema/erc/test_erc_unconnected_wire_endpoints.cpp b/qa/tests/eeschema/erc/test_erc_unconnected_wire_endpoints.cpp index 7d98901560..809536ce78 100644 --- a/qa/tests/eeschema/erc/test_erc_unconnected_wire_endpoints.cpp +++ b/qa/tests/eeschema/erc/test_erc_unconnected_wire_endpoints.cpp @@ -31,7 +31,7 @@ struct ERC_REGRESSION_TEST_FIXTURE { - ERC_REGRESSION_TEST_FIXTURE() : m_settingsManager( true /* headless */ ) {} + ERC_REGRESSION_TEST_FIXTURE() {} SETTINGS_MANAGER m_settingsManager; std::unique_ptr m_schematic; diff --git a/qa/tests/eeschema/erc/test_erc_wire_bus_entry.cpp b/qa/tests/eeschema/erc/test_erc_wire_bus_entry.cpp index 354c03ef99..60fdb46602 100644 --- a/qa/tests/eeschema/erc/test_erc_wire_bus_entry.cpp +++ b/qa/tests/eeschema/erc/test_erc_wire_bus_entry.cpp @@ -31,7 +31,7 @@ struct ERC_REGRESSION_TEST_FIXTURE { - ERC_REGRESSION_TEST_FIXTURE() : m_settingsManager( true /* headless */ ) {} + ERC_REGRESSION_TEST_FIXTURE() {} SETTINGS_MANAGER m_settingsManager; std::unique_ptr m_schematic; diff --git a/qa/tests/eeschema/test_bus_entry_concurrency.cpp b/qa/tests/eeschema/test_bus_entry_concurrency.cpp index 71648d7b54..0ff210be2b 100644 --- a/qa/tests/eeschema/test_bus_entry_concurrency.cpp +++ b/qa/tests/eeschema/test_bus_entry_concurrency.cpp @@ -37,7 +37,7 @@ struct BUS_ENTRY_CONCURRENCY_FIXTURE { BUS_ENTRY_CONCURRENCY_FIXTURE() : - m_mgr( true /* headless */ ) + m_mgr() { m_mgr.LoadProject( "" ); m_schematic = std::make_unique( &m_mgr.Prj() ); diff --git a/qa/tests/eeschema/test_connectivity_algo.cpp b/qa/tests/eeschema/test_connectivity_algo.cpp index 5286f76482..fa788cf6dd 100644 --- a/qa/tests/eeschema/test_connectivity_algo.cpp +++ b/qa/tests/eeschema/test_connectivity_algo.cpp @@ -34,8 +34,7 @@ struct CONNECTIVITY_TEST_FIXTURE { - CONNECTIVITY_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + CONNECTIVITY_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; @@ -61,4 +60,4 @@ BOOST_FIXTURE_TEST_CASE( CheckNetCounts, CONNECTIVITY_TEST_FIXTURE ) BOOST_CHECK( nets == graph->GetNetMap().size() ); } -} \ No newline at end of file +} diff --git a/qa/tests/eeschema/test_flat_hierarchy.cpp b/qa/tests/eeschema/test_flat_hierarchy.cpp index fa293c01ec..37853acc4c 100644 --- a/qa/tests/eeschema/test_flat_hierarchy.cpp +++ b/qa/tests/eeschema/test_flat_hierarchy.cpp @@ -38,7 +38,7 @@ struct FLAT_HIERARCHY_FIXTURE { FLAT_HIERARCHY_FIXTURE() : - m_settingsManager( true /* headless */ ) + m_settingsManager() { m_settingsManager.LoadProject( "" ); m_schematic = std::make_unique( nullptr ); diff --git a/qa/tests/eeschema/test_incremental_netlister.cpp b/qa/tests/eeschema/test_incremental_netlister.cpp index 9d9159df0b..4195e5024f 100644 --- a/qa/tests/eeschema/test_incremental_netlister.cpp +++ b/qa/tests/eeschema/test_incremental_netlister.cpp @@ -34,8 +34,7 @@ struct CONNECTIVITY_TEST_FIXTURE { - CONNECTIVITY_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + CONNECTIVITY_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; @@ -161,4 +160,4 @@ BOOST_FIXTURE_TEST_CASE( RemoveAddItems, CONNECTIVITY_TEST_FIXTURE ) } } } -} \ No newline at end of file +} diff --git a/qa/tests/eeschema/test_legacy_load.cpp b/qa/tests/eeschema/test_legacy_load.cpp index ef60f4f94e..8b52ddfec9 100644 --- a/qa/tests/eeschema/test_legacy_load.cpp +++ b/qa/tests/eeschema/test_legacy_load.cpp @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_SUITE( LegacyLoad ) BOOST_AUTO_TEST_CASE( TestLoadWithLogging ) { - SETTINGS_MANAGER settingsManager( true ); + SETTINGS_MANAGER settingsManager; // Create a temporary project wxString tempDir = wxStandardPaths::Get().GetTempDir(); diff --git a/qa/tests/eeschema/test_legacy_power_symbols.cpp b/qa/tests/eeschema/test_legacy_power_symbols.cpp index 91f64dc27a..d6bcc03e68 100644 --- a/qa/tests/eeschema/test_legacy_power_symbols.cpp +++ b/qa/tests/eeschema/test_legacy_power_symbols.cpp @@ -29,8 +29,7 @@ struct LEGACY_POWER_SYMBOLS_TEST_FIXTURE { - LEGACY_POWER_SYMBOLS_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + LEGACY_POWER_SYMBOLS_TEST_FIXTURE() { } void CheckSymbols() diff --git a/qa/tests/eeschema/test_netlist_exporter_xml_stacked.cpp b/qa/tests/eeschema/test_netlist_exporter_xml_stacked.cpp index 6f0fd89278..fa0a827fa2 100644 --- a/qa/tests/eeschema/test_netlist_exporter_xml_stacked.cpp +++ b/qa/tests/eeschema/test_netlist_exporter_xml_stacked.cpp @@ -33,7 +33,7 @@ struct XML_STACKED_PIN_FIXTURE { - XML_STACKED_PIN_FIXTURE() : m_settingsManager( true /* headless */ ) {} + XML_STACKED_PIN_FIXTURE() {} SETTINGS_MANAGER m_settingsManager; std::unique_ptr m_schematic; diff --git a/qa/tests/eeschema/test_save_load_schematic.cpp b/qa/tests/eeschema/test_save_load_schematic.cpp index bba11ab8f1..45770b61d6 100644 --- a/qa/tests/eeschema/test_save_load_schematic.cpp +++ b/qa/tests/eeschema/test_save_load_schematic.cpp @@ -45,7 +45,7 @@ struct SAVE_LOAD_FIXTURE { SAVE_LOAD_FIXTURE() : - m_settingsManager( true /* headless */ ) + m_settingsManager() { // Create a temporary project file so we have a valid project name wxString tempDir = wxStandardPaths::Get().GetTempDir(); diff --git a/qa/tests/eeschema/test_stacked_pin_conversion.cpp b/qa/tests/eeschema/test_stacked_pin_conversion.cpp index 3b2a92688e..c9a3127806 100644 --- a/qa/tests/eeschema/test_stacked_pin_conversion.cpp +++ b/qa/tests/eeschema/test_stacked_pin_conversion.cpp @@ -31,7 +31,7 @@ struct STACKED_PIN_CONVERSION_FIXTURE { STACKED_PIN_CONVERSION_FIXTURE() { - m_settingsManager = std::make_unique( true ); + m_settingsManager = std::make_unique(); m_symbol = std::make_unique( "TestSymbol" ); } diff --git a/qa/tests/eeschema/test_stacked_pin_nomenclature.cpp b/qa/tests/eeschema/test_stacked_pin_nomenclature.cpp index ccd2b39858..d8d4fed43a 100644 --- a/qa/tests/eeschema/test_stacked_pin_nomenclature.cpp +++ b/qa/tests/eeschema/test_stacked_pin_nomenclature.cpp @@ -33,7 +33,7 @@ struct STACKED_PIN_FIXTURE { - STACKED_PIN_FIXTURE() : m_settingsManager( true /* headless */ ) {} + STACKED_PIN_FIXTURE() {} SETTINGS_MANAGER m_settingsManager; std::unique_ptr m_schematic; diff --git a/qa/tests/pcbnew/drc/test_custom_rule_severities.cpp b/qa/tests/pcbnew/drc/test_custom_rule_severities.cpp index 4d8378f42c..e51c86cfd3 100644 --- a/qa/tests/pcbnew/drc/test_custom_rule_severities.cpp +++ b/qa/tests/pcbnew/drc/test_custom_rule_severities.cpp @@ -32,8 +32,7 @@ struct DRC_REGRESSION_TEST_FIXTURE { - DRC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + DRC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/drc/test_drc_component_classes.cpp b/qa/tests/pcbnew/drc/test_drc_component_classes.cpp index 2ee408eac0..9adf25a661 100644 --- a/qa/tests/pcbnew/drc/test_drc_component_classes.cpp +++ b/qa/tests/pcbnew/drc/test_drc_component_classes.cpp @@ -31,8 +31,7 @@ struct DRC_REGRESSION_TEST_FIXTURE { - DRC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + DRC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/drc/test_drc_copper_conn.cpp b/qa/tests/pcbnew/drc/test_drc_copper_conn.cpp index 1068e4c7f0..e42875f0e1 100644 --- a/qa/tests/pcbnew/drc/test_drc_copper_conn.cpp +++ b/qa/tests/pcbnew/drc/test_drc_copper_conn.cpp @@ -35,8 +35,7 @@ struct DRC_REGRESSION_TEST_FIXTURE { - DRC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + DRC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/drc/test_drc_copper_graphics.cpp b/qa/tests/pcbnew/drc/test_drc_copper_graphics.cpp index fa00229950..05a7e95a84 100644 --- a/qa/tests/pcbnew/drc/test_drc_copper_graphics.cpp +++ b/qa/tests/pcbnew/drc/test_drc_copper_graphics.cpp @@ -32,8 +32,7 @@ struct DRC_COPPER_GRAPHICS_TEST_FIXTURE { - DRC_COPPER_GRAPHICS_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + DRC_COPPER_GRAPHICS_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/drc/test_drc_copper_sliver.cpp b/qa/tests/pcbnew/drc/test_drc_copper_sliver.cpp index 041b609b75..691a1a3f9c 100644 --- a/qa/tests/pcbnew/drc/test_drc_copper_sliver.cpp +++ b/qa/tests/pcbnew/drc/test_drc_copper_sliver.cpp @@ -42,8 +42,7 @@ struct DRC_REGRESSION_TEST_FIXTURE { - DRC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + DRC_REGRESSION_TEST_FIXTURE() { } ~DRC_REGRESSION_TEST_FIXTURE() diff --git a/qa/tests/pcbnew/drc/test_drc_incorrect_text_mirror.cpp b/qa/tests/pcbnew/drc/test_drc_incorrect_text_mirror.cpp index 389e055bd7..11de036059 100644 --- a/qa/tests/pcbnew/drc/test_drc_incorrect_text_mirror.cpp +++ b/qa/tests/pcbnew/drc/test_drc_incorrect_text_mirror.cpp @@ -31,7 +31,7 @@ struct DRC_INCORRECT_TEXT_MIRROR_TEST_FIXTURE { - DRC_INCORRECT_TEXT_MIRROR_TEST_FIXTURE() : m_settingsManager( true /* headless */ ) {} + DRC_INCORRECT_TEXT_MIRROR_TEST_FIXTURE() {} SETTINGS_MANAGER m_settingsManager; std::unique_ptr m_board; diff --git a/qa/tests/pcbnew/drc/test_drc_lengths.cpp b/qa/tests/pcbnew/drc/test_drc_lengths.cpp index a84242fad6..c71962cf00 100644 --- a/qa/tests/pcbnew/drc/test_drc_lengths.cpp +++ b/qa/tests/pcbnew/drc/test_drc_lengths.cpp @@ -35,7 +35,7 @@ struct DRC_REGRESSION_TEST_FIXTURE { - DRC_REGRESSION_TEST_FIXTURE() : m_settingsManager( true /* headless */ ) {} + DRC_REGRESSION_TEST_FIXTURE() {} SETTINGS_MANAGER m_settingsManager; std::unique_ptr m_board; diff --git a/qa/tests/pcbnew/drc/test_drc_multi_netclasses.cpp b/qa/tests/pcbnew/drc/test_drc_multi_netclasses.cpp index d2e159476e..7d6a6b33c8 100644 --- a/qa/tests/pcbnew/drc/test_drc_multi_netclasses.cpp +++ b/qa/tests/pcbnew/drc/test_drc_multi_netclasses.cpp @@ -35,8 +35,7 @@ struct DRC_REGRESSION_TEST_FIXTURE { - DRC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + DRC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/drc/test_drc_orientation.cpp b/qa/tests/pcbnew/drc/test_drc_orientation.cpp index f68e45c2fb..7dce513594 100644 --- a/qa/tests/pcbnew/drc/test_drc_orientation.cpp +++ b/qa/tests/pcbnew/drc/test_drc_orientation.cpp @@ -35,8 +35,7 @@ struct DRC_REGRESSION_TEST_FIXTURE { - DRC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + DRC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/drc/test_drc_regressions.cpp b/qa/tests/pcbnew/drc/test_drc_regressions.cpp index cda3dd92c3..57bc1481df 100644 --- a/qa/tests/pcbnew/drc/test_drc_regressions.cpp +++ b/qa/tests/pcbnew/drc/test_drc_regressions.cpp @@ -36,8 +36,7 @@ struct DRC_REGRESSION_TEST_FIXTURE { - DRC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + DRC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/drc/test_drc_skew.cpp b/qa/tests/pcbnew/drc/test_drc_skew.cpp index c6f77af1e6..aa9f1df0ed 100644 --- a/qa/tests/pcbnew/drc/test_drc_skew.cpp +++ b/qa/tests/pcbnew/drc/test_drc_skew.cpp @@ -35,8 +35,7 @@ struct DRC_REGRESSION_TEST_FIXTURE { - DRC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + DRC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/drc/test_drc_starved_thermal.cpp b/qa/tests/pcbnew/drc/test_drc_starved_thermal.cpp index 564ab17842..bed2ea1e6e 100644 --- a/qa/tests/pcbnew/drc/test_drc_starved_thermal.cpp +++ b/qa/tests/pcbnew/drc/test_drc_starved_thermal.cpp @@ -36,7 +36,7 @@ struct DRC_REGRESSION_TEST_FIXTURE { // clang-format off : suggestions look worse. - DRC_REGRESSION_TEST_FIXTURE() : m_settingsManager( true /* headless */ ) {} + DRC_REGRESSION_TEST_FIXTURE() {} // clang-format on SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/drc/test_drc_tuning_profiles.cpp b/qa/tests/pcbnew/drc/test_drc_tuning_profiles.cpp index 12894db2ef..649e3c56ac 100644 --- a/qa/tests/pcbnew/drc/test_drc_tuning_profiles.cpp +++ b/qa/tests/pcbnew/drc/test_drc_tuning_profiles.cpp @@ -32,7 +32,7 @@ struct DRC_REGRESSION_TEST_FIXTURE { DRC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + m_settingsManager() { } diff --git a/qa/tests/pcbnew/drc/test_drc_unconnected_items_exclusion_loss.cpp b/qa/tests/pcbnew/drc/test_drc_unconnected_items_exclusion_loss.cpp index 1aa0e34c18..85a9e1cb4f 100644 --- a/qa/tests/pcbnew/drc/test_drc_unconnected_items_exclusion_loss.cpp +++ b/qa/tests/pcbnew/drc/test_drc_unconnected_items_exclusion_loss.cpp @@ -73,8 +73,7 @@ struct FileCleaner struct DRC_BASE_FIXTURE { - DRC_BASE_FIXTURE() : - m_settingsManager( true /* headless */ ) + DRC_BASE_FIXTURE() { } diff --git a/qa/tests/pcbnew/drc/test_drc_via_dangling.cpp b/qa/tests/pcbnew/drc/test_drc_via_dangling.cpp index a19f9ef032..fee6698e12 100644 --- a/qa/tests/pcbnew/drc/test_drc_via_dangling.cpp +++ b/qa/tests/pcbnew/drc/test_drc_via_dangling.cpp @@ -31,8 +31,7 @@ struct DRC_REGRESSION_TEST_FIXTURE { - DRC_REGRESSION_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + DRC_REGRESSION_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/drc/test_solder_mask_bridging.cpp b/qa/tests/pcbnew/drc/test_solder_mask_bridging.cpp index 61b1fdb8ae..1835c79688 100644 --- a/qa/tests/pcbnew/drc/test_solder_mask_bridging.cpp +++ b/qa/tests/pcbnew/drc/test_solder_mask_bridging.cpp @@ -32,8 +32,7 @@ struct DRC_SOLDER_MASK_BRIDGING_TEST_FIXTURE { - DRC_SOLDER_MASK_BRIDGING_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + DRC_SOLDER_MASK_BRIDGING_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/test_barcode_load_save.cpp b/qa/tests/pcbnew/test_barcode_load_save.cpp index 3f94dccfcf..0cc3912d6e 100644 --- a/qa/tests/pcbnew/test_barcode_load_save.cpp +++ b/qa/tests/pcbnew/test_barcode_load_save.cpp @@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE( BarcodeWriteRead ) { - SETTINGS_MANAGER settingsManager( true ); + SETTINGS_MANAGER settingsManager; std::unique_ptr board = std::make_unique(); @@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE( BarcodeWriteRead ) BOOST_AUTO_TEST_CASE( BarcodeFootprintWriteRead ) { - SETTINGS_MANAGER settingsManager( true ); + SETTINGS_MANAGER settingsManager; FOOTPRINT footprint( nullptr ); @@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE( BarcodeFootprintWriteRead ) BOOST_AUTO_TEST_CASE( BarcodePositioningAlignment ) { - SETTINGS_MANAGER settingsManager( true ); + SETTINGS_MANAGER settingsManager; std::unique_ptr board = std::make_unique(); diff --git a/qa/tests/pcbnew/test_component_classes.cpp b/qa/tests/pcbnew/test_component_classes.cpp index 01e8246591..98b3b22c6e 100644 --- a/qa/tests/pcbnew/test_component_classes.cpp +++ b/qa/tests/pcbnew/test_component_classes.cpp @@ -36,8 +36,7 @@ struct PCB_COMPONENT_CLASS_FIXTURE { - PCB_COMPONENT_CLASS_FIXTURE() : - m_settingsManager( true /* headless */ ) + PCB_COMPONENT_CLASS_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/test_multichannel.cpp b/qa/tests/pcbnew/test_multichannel.cpp index 95371b158c..58ad11f1a3 100644 --- a/qa/tests/pcbnew/test_multichannel.cpp +++ b/qa/tests/pcbnew/test_multichannel.cpp @@ -36,7 +36,7 @@ struct MULTICHANNEL_TEST_FIXTURE { - MULTICHANNEL_TEST_FIXTURE() : m_settingsManager( true /* headless */ ) {} + MULTICHANNEL_TEST_FIXTURE() {} SETTINGS_MANAGER m_settingsManager; std::unique_ptr m_board; diff --git a/qa/tests/pcbnew/test_pns_basics.cpp b/qa/tests/pcbnew/test_pns_basics.cpp index 34c4b8837e..72abc966aa 100644 --- a/qa/tests/pcbnew/test_pns_basics.cpp +++ b/qa/tests/pcbnew/test_pns_basics.cpp @@ -303,8 +303,7 @@ private: struct PNS_TEST_FIXTURE { - PNS_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + PNS_TEST_FIXTURE() { m_router = new PNS::ROUTER; m_iface = new MOCK_PNS_KICAD_IFACE( this ); diff --git a/qa/tests/pcbnew/test_prettifier.cpp b/qa/tests/pcbnew/test_prettifier.cpp index 611ea593b7..a4dcd3c454 100644 --- a/qa/tests/pcbnew/test_prettifier.cpp +++ b/qa/tests/pcbnew/test_prettifier.cpp @@ -40,8 +40,7 @@ struct PRETTIFIER_TEST_FIXTURE { - PRETTIFIER_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + PRETTIFIER_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/test_save_load.cpp b/qa/tests/pcbnew/test_save_load.cpp index c6a5566e07..7027438555 100644 --- a/qa/tests/pcbnew/test_save_load.cpp +++ b/qa/tests/pcbnew/test_save_load.cpp @@ -36,8 +36,7 @@ namespace { struct SAVE_LOAD_TEST_FIXTURE { - SAVE_LOAD_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + SAVE_LOAD_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/test_tracks_cleaner.cpp b/qa/tests/pcbnew/test_tracks_cleaner.cpp index 54b71bf11f..6ccbdf375b 100644 --- a/qa/tests/pcbnew/test_tracks_cleaner.cpp +++ b/qa/tests/pcbnew/test_tracks_cleaner.cpp @@ -39,8 +39,7 @@ namespace { struct TRACK_CLEANER_TEST_FIXTURE { - TRACK_CLEANER_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + TRACK_CLEANER_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/test_triangulation.cpp b/qa/tests/pcbnew/test_triangulation.cpp index 58de6eeb71..2e0c7db63e 100644 --- a/qa/tests/pcbnew/test_triangulation.cpp +++ b/qa/tests/pcbnew/test_triangulation.cpp @@ -39,8 +39,7 @@ namespace { struct TRIANGULATE_TEST_FIXTURE { - TRIANGULATE_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + TRIANGULATE_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; diff --git a/qa/tests/pcbnew/test_zone_filler.cpp b/qa/tests/pcbnew/test_zone_filler.cpp index 791e077af3..f9c07e8e46 100644 --- a/qa/tests/pcbnew/test_zone_filler.cpp +++ b/qa/tests/pcbnew/test_zone_filler.cpp @@ -37,8 +37,7 @@ struct ZONE_FILL_TEST_FIXTURE { - ZONE_FILL_TEST_FIXTURE() : - m_settingsManager( true /* headless */ ) + ZONE_FILL_TEST_FIXTURE() { } SETTINGS_MANAGER m_settingsManager; @@ -338,4 +337,4 @@ BOOST_FIXTURE_TEST_CASE( RegressionNetTie, ZONE_FILL_TEST_FIXTURE ) } } } -} \ No newline at end of file +} diff --git a/qa/tests/spice/test_ngspice_helpers.cpp b/qa/tests/spice/test_ngspice_helpers.cpp index 6f610d25c6..ce63ec43a0 100644 --- a/qa/tests/spice/test_ngspice_helpers.cpp +++ b/qa/tests/spice/test_ngspice_helpers.cpp @@ -42,7 +42,6 @@ class TEST_NGSPICE_HELPERS { public: TEST_NGSPICE_HELPERS() : - m_manager( true ), m_schematic( nullptr ), m_exporter( &m_schematic ) { diff --git a/qa/tools/pns/pns_log_file.cpp b/qa/tools/pns/pns_log_file.cpp index e29211ae14..73379357c1 100644 --- a/qa/tools/pns/pns_log_file.cpp +++ b/qa/tools/pns/pns_log_file.cpp @@ -358,7 +358,7 @@ bool PNS_LOG_FILE::Load( const wxFileName& logFileName, REPORTER* aRpt ) aRpt->Report( wxString::Format( wxT( "Loading project settings from '%s'" ), fname_settings.GetFullPath() ) ); - m_settingsMgr.reset( new SETTINGS_MANAGER ( true ) ); + m_settingsMgr.reset( new SETTINGS_MANAGER ); m_settingsMgr->LoadProject( fname_project.GetFullPath() ); PROJECT* project = m_settingsMgr->GetProject( fname_project.GetFullPath() ); project->SetReadOnly();