7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 14:50:11 +00:00

Don't auto-save local settings when migrating

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19540
This commit is contained in:
Jon Evans 2025-01-08 08:43:28 -05:00
parent 302ceeb14e
commit 7ce0f55305
4 changed files with 22 additions and 3 deletions

View File

@ -45,7 +45,8 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
m_ShapeOpacity( 1.0 ),
m_ImageOpacity( 0.6 ),
m_PcbSelectionFilter(),
m_project( aProject )
m_project( aProject ),
m_wasMigrated( false )
{
// Keep old files around
m_deleteLegacyAfterMigration = false;
@ -356,6 +357,8 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
{
At( "board" ).erase( "visible_items" );
}
m_wasMigrated = true;
}
return true;
@ -414,6 +417,7 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
}
At( "board" )["visible_items"] = visible;
m_wasMigrated = true;
}
return true;
@ -432,6 +436,8 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
At( ptr ).push_back( LAYER_SHAPES - GAL_LAYER_ID_START );
else
At( "board" ).erase( "visible_items" );
m_wasMigrated = true;
}
return true;
@ -461,6 +467,7 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
}
At( ptr ) = newLayers;
m_wasMigrated = true;
}
return true;

View File

@ -103,6 +103,7 @@
#include <widgets/panel_sch_selection_filter.h>
#include <widgets/wx_aui_utils.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <project/project_local_settings.h>
#ifdef KICAD_IPC_API
#include <api/api_plugin_manager.h>
@ -1097,7 +1098,8 @@ void SCH_EDIT_FRAME::doCloseWindow()
}
// Make sure local settings are persisted
SaveProjectLocalSettings();
if( !Prj().GetLocalSettings().WasMigrated() )
SaveProjectLocalSettings();
// Shutdown all running tools
if( m_toolManager )

View File

@ -72,6 +72,11 @@ public:
void ClearFileState();
/**
* @return true if the local settings needed to be migrated, and shouldn't be auto-saved
*/
bool WasMigrated() const { return m_wasMigrated; }
protected:
wxString getFileExt() const override
{
@ -152,6 +157,8 @@ public:
private:
/// A link to the owning project
PROJECT* m_project;
bool m_wasMigrated;
};
#endif

View File

@ -1269,7 +1269,10 @@ void PCB_EDIT_FRAME::doCloseWindow()
}
// Make sure local settings are persisted
SaveProjectLocalSettings();
if( !Prj().GetLocalSettings().WasMigrated() )
SaveProjectLocalSettings();
else
wxLogTrace( traceAutoSave, wxT( "Skipping auto-save of migrated local settings" ) );
// Do not show the layer manager during closing to avoid flicker
// on some platforms (Windows) that generate useless redraw of items in