mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Added support for .json files with file dialogs
This commit is contained in:
@@ -319,7 +319,7 @@ void NewProjectDialog::OnplatformListItemSelect(wxListEvent& event)
|
||||
|
||||
void NewProjectDialog::OnbrowseBtClick(wxCommandEvent& event)
|
||||
{
|
||||
wxFileDialog dialog( this, _( "Choose a file for the project" ), newProjectBaseFolder, _("Project.gdg"), "\"GDevelop\" Project (*.gdg)|*.gdg", wxFD_SAVE );
|
||||
wxFileDialog dialog( this, _("Choose a file for the project"), newProjectBaseFolder, _("Project.gdg"), "GDevelop Project (*.gdg, *.json)|*.gdg;*.json", wxFD_SAVE );
|
||||
|
||||
if ( dialog.ShowModal() != wxID_CANCEL )
|
||||
{
|
||||
|
@@ -70,7 +70,7 @@ void MainFrame::CreateNewProject()
|
||||
|
||||
newProject->SetProjectFile(dialog.GetChosenFilename());
|
||||
newProject->AddPlatform(*associatedPlatform);
|
||||
newProject->SaveToFile(newProject->GetProjectFile());
|
||||
Save(*newProject, newProject->GetProjectFile());
|
||||
|
||||
games.push_back(newProject);
|
||||
SetCurrentGame(games.size()-1);
|
||||
@@ -110,7 +110,7 @@ void MainFrame::OnMenuOpenSelected( wxCommandEvent& event )
|
||||
sf::Lock lock(CodeCompiler::openSaveDialogMutex);
|
||||
|
||||
wxString oldWorkingDir = wxGetCwd();
|
||||
wxFileDialog openFileDialog( this, _( "Choose the project to open" ), "", "", "\"GDevelop\" Project(*.gdg)|*.gdg|\"GDevelop\" Project Autosave (*.gdg.autosave)|*.gdg.autosave" );
|
||||
wxFileDialog openFileDialog( this, _( "Choose the project to open" ), "", "", "GDevelop Project (*.gdg, *.json)|*.gdg;*.json|GDevelop Project Autosave (*.gdg.autosave)|*.gdg.autosave" );
|
||||
wxSetWorkingDirectory(oldWorkingDir); //Ensure Windows does not mess up with the working directory.
|
||||
|
||||
if (openFileDialog.ShowModal() != wxID_CANCEL && !openFileDialog.GetPath().empty() )
|
||||
@@ -132,7 +132,7 @@ void MainFrame::OnOpenExampleSelected(wxCommandEvent& event)
|
||||
#endif
|
||||
|
||||
wxString oldWorkingDir = wxGetCwd();
|
||||
wxFileDialog open( NULL, _( "Open an example" ), examplesDir, "", "\"GDevelop\" Project (*.gdg)|*.gdg" );
|
||||
wxFileDialog open( NULL, _( "Open an example" ), examplesDir, "", "GDevelop Project (*.gdg, *.json)|*.gdg;*.json" );
|
||||
wxSetWorkingDirectory(oldWorkingDir); //Ensure Windows does not mess up with the working directory.
|
||||
|
||||
if ( open.ShowModal() != wxID_CANCEL && !open.GetPath().empty() )
|
||||
@@ -267,7 +267,7 @@ void MainFrame::OnRibbonSaveAllClicked(wxRibbonButtonBarEvent& evt)
|
||||
{
|
||||
sf::Lock lock(CodeCompiler::openSaveDialogMutex);
|
||||
|
||||
wxFileDialog fileDialog( this, _( "Choose where to save the project" ), "", "", "\"GDevelop\" Project (*.gdg)|*.gdg", wxFD_SAVE );
|
||||
wxFileDialog fileDialog( this, _( "Choose where to save the project" ), "", "", "GDevelop Project (*.gdg, *.json)|*.gdg;*.json", wxFD_SAVE );
|
||||
fileDialog.ShowModal();
|
||||
|
||||
std::string path = gd::ToString(fileDialog.GetPath());
|
||||
@@ -327,7 +327,7 @@ void MainFrame::SaveAs()
|
||||
if ( !CurrentGameIsValid() ) return;
|
||||
|
||||
//Display dialog box
|
||||
wxFileDialog fileDialog( this, _( "Choose where to save the project" ), "", "", "\"GDevelop\" Project (*.gdg)|*.gdg", wxFD_SAVE );
|
||||
wxFileDialog fileDialog( this, _( "Choose where to save the project" ), "", "", "GDevelop Project (*.gdg, *.json)|*.gdg;*.json", wxFD_SAVE );
|
||||
fileDialog.ShowModal();
|
||||
|
||||
std::string file = gd::ToString(fileDialog.GetPath());
|
||||
|
@@ -388,7 +388,7 @@ void StartHerePage::OnopenExamplesLinkClick(wxCommandEvent& event)
|
||||
wxString examplesDir = wxGetCwd()+"/Examples/";
|
||||
#endif
|
||||
|
||||
wxFileDialog open( NULL, _( "Open an example" ), examplesDir, "", "\"GDevelop\" Game (*.gdg;*.jgd)|*.jgd;*.gdg" );
|
||||
wxFileDialog open( NULL, _( "Open an example" ), examplesDir, "", "GDevelop Project (*.gdg, *.json)|*.gdg;*.json" );
|
||||
open.ShowModal();
|
||||
|
||||
if ( !open.GetPath().empty() ) mainEditor.Open(string(open.GetPath().mb_str()));
|
||||
|
Reference in New Issue
Block a user