aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/left_panel/GameTabLeftPanel.cpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-12-30 15:09:24 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-12-30 15:09:24 +0100
commit27ac369fb6b773f642eabed087194ff7e95f9156 (patch)
treebaa1627d2a24f79f3b2bbdabcae8e21c61be1da1 /src/game_tab/left_panel/GameTabLeftPanel.cpp
parenteec973bc05c0a7e0c511b392704c6d093c2820b4 (diff)
Enable game saving
Diffstat (limited to 'src/game_tab/left_panel/GameTabLeftPanel.cpp')
-rw-r--r--src/game_tab/left_panel/GameTabLeftPanel.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/game_tab/left_panel/GameTabLeftPanel.cpp b/src/game_tab/left_panel/GameTabLeftPanel.cpp
index c5bf8ae..4f09bdd 100644
--- a/src/game_tab/left_panel/GameTabLeftPanel.cpp
+++ b/src/game_tab/left_panel/GameTabLeftPanel.cpp
@@ -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);
}
}