mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-07-03 02:37:39 +00:00
Enable game saving
This commit is contained in:
parent
eec973bc05
commit
27ac369fb6
4 changed files with 28 additions and 3 deletions
|
@ -32,9 +32,16 @@ GameTabLeftPanel::GameTabLeftPanel(wxFrame *parent, std::shared_ptr<Game> game)
|
|||
void GameTabLeftPanel::OnToolClick(wxCommandEvent &event){
|
||||
short id=event.GetId();
|
||||
if(id==0){
|
||||
if(related_file.size()>0){
|
||||
// Todo implement save file
|
||||
if(!related_file.size()>0){
|
||||
wxFileDialog
|
||||
newFileDialog(this, _("Save Game"), "", "",
|
||||
"PGN files (*.pgn)|*.pgn", wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||
if (newFileDialog.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
// Create and open new db
|
||||
related_file = newFileDialog.GetPath().ToStdString();
|
||||
}
|
||||
SaveGame(related_file,game);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../Game.hpp"
|
||||
#include "board/BoardCanvas.hpp"
|
||||
#include "ochess.hpp"
|
||||
#include "base_tab/gamebase/GameBase.hpp"
|
||||
|
||||
// Foreign events
|
||||
wxDECLARE_EVENT(GAME_CHANGE, wxCommandEvent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue