Move git clone to standard create project
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16523
This commit is contained in:
parent
b36a67e556
commit
b65fa46c3c
|
@ -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_tested( 0 ), m_failedTest( false ), m_testError( wxEmptyString ), m_tempRepo( false ),
|
||||||
m_repoType( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL )
|
m_repoType( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL )
|
||||||
{
|
{
|
||||||
m_txtName->SetFocus();
|
m_txtURL->SetFocus();
|
||||||
|
|
||||||
if( !m_repository )
|
if( !m_repository )
|
||||||
{
|
{
|
||||||
|
|
|
@ -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_filename = aFileName ? *aFileName : wxString();
|
||||||
|
|
||||||
wxString default_dir = m_frame->GetMruPath();
|
wxString default_dir = m_frame->GetMruPath();
|
||||||
wxFileDialog dlg( m_frame, _( "Create New Project" ), default_dir, default_filename,
|
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
|
// Add a "Create a new directory" checkbox
|
||||||
FILEDLG_NEW_PROJECT newProjectHook;
|
FILEDLG_NEW_PROJECT newProjectHook;
|
||||||
|
@ -154,23 +155,8 @@ int KICAD_MANAGER_CONTROL::NewFromRepository( const TOOL_EVENT& aEvent )
|
||||||
if( ret != wxID_OK )
|
if( ret != wxID_OK )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
wxFileName reponame( dlg.GetRepoName() );
|
wxString project_name = dlg.GetRepoName();
|
||||||
|
wxFileName pro = newProjectDirectory( &project_name, true );
|
||||||
// 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 );
|
|
||||||
|
|
||||||
if( !pro.IsOk() )
|
if( !pro.IsOk() )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -79,8 +79,7 @@ private:
|
||||||
|
|
||||||
int openProject( const wxString& aDefaultDir );
|
int openProject( const wxString& aDefaultDir );
|
||||||
|
|
||||||
wxFileName newProjectDirectory( wxString* aFileName = nullptr );
|
wxFileName newProjectDirectory( wxString* aFileName = nullptr, bool isRepo = false );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue