From b65fa46c3c254a0854e66a6d8141271cc9ad37d7 Mon Sep 17 00:00:00 2001 From: Jan Wichmann Date: Fri, 19 Jan 2024 23:52:37 +0000 Subject: [PATCH] Move git clone to standard create project Fixes https://gitlab.com/kicad/code/kicad/-/issues/16523 --- common/dialogs/git/dialog_git_repository.cpp | 2 +- kicad/tools/kicad_manager_control.cpp | 24 ++++---------------- kicad/tools/kicad_manager_control.h | 3 +-- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/common/dialogs/git/dialog_git_repository.cpp b/common/dialogs/git/dialog_git_repository.cpp index 3d2c44f2b9..b0cc6e1b71 100644 --- a/common/dialogs/git/dialog_git_repository.cpp +++ b/common/dialogs/git/dialog_git_repository.cpp @@ -42,7 +42,7 @@ DIALOG_GIT_REPOSITORY::DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository* m_tested( 0 ), m_failedTest( false ), m_testError( wxEmptyString ), m_tempRepo( false ), m_repoType( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL ) { - m_txtName->SetFocus(); + m_txtURL->SetFocus(); if( !m_repository ) { diff --git a/kicad/tools/kicad_manager_control.cpp b/kicad/tools/kicad_manager_control.cpp index ef32238063..04694e7709 100644 --- a/kicad/tools/kicad_manager_control.cpp +++ b/kicad/tools/kicad_manager_control.cpp @@ -64,13 +64,14 @@ void KICAD_MANAGER_CONTROL::Reset( RESET_REASON aReason ) } -wxFileName KICAD_MANAGER_CONTROL::newProjectDirectory( wxString* aFileName ) +wxFileName KICAD_MANAGER_CONTROL::newProjectDirectory( wxString* aFileName, bool isRepo ) { wxString default_filename = aFileName ? *aFileName : wxString(); wxString default_dir = m_frame->GetMruPath(); wxFileDialog dlg( m_frame, _( "Create New Project" ), default_dir, default_filename, - FILEEXT::ProjectFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + ( isRepo ? wxString( "" ) : FILEEXT::ProjectFileWildcard() ), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); // Add a "Create a new directory" checkbox FILEDLG_NEW_PROJECT newProjectHook; @@ -154,23 +155,8 @@ int KICAD_MANAGER_CONTROL::NewFromRepository( const TOOL_EVENT& aEvent ) if( ret != wxID_OK ) return -1; - wxFileName reponame( dlg.GetRepoName() ); - - // Set the default file extension for the new repository's project, - // preserving any part that is the original extension in the process. - if( reponame.GetExt().IsEmpty() ) - { - reponame.SetExt( FILEEXT::ProjectFileExtension ); - } - else if( reponame.GetExt().ToStdString() != FILEEXT::ProjectFileExtension ) - { - reponame.SetName( reponame.GetName() + wxT( "." ) + reponame.GetExt() ); - reponame.SetExt( FILEEXT::ProjectFileExtension ); - } - - wxString project_name = reponame.GetFullPath(); - - wxFileName pro = newProjectDirectory( &project_name ); + wxString project_name = dlg.GetRepoName(); + wxFileName pro = newProjectDirectory( &project_name, true ); if( !pro.IsOk() ) return -1; diff --git a/kicad/tools/kicad_manager_control.h b/kicad/tools/kicad_manager_control.h index 1ab7964bb5..f95466f41c 100644 --- a/kicad/tools/kicad_manager_control.h +++ b/kicad/tools/kicad_manager_control.h @@ -79,8 +79,7 @@ private: int openProject( const wxString& aDefaultDir ); - wxFileName newProjectDirectory( wxString* aFileName = nullptr ); - + wxFileName newProjectDirectory( wxString* aFileName = nullptr, bool isRepo = false ); }; #endif