diff options
Diffstat (limited to 'src/base_tab/BaseTab.cpp')
| -rw-r--r-- | src/base_tab/BaseTab.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/base_tab/BaseTab.cpp b/src/base_tab/BaseTab.cpp index 9234a47..f7cf48f 100644 --- a/src/base_tab/BaseTab.cpp +++ b/src/base_tab/BaseTab.cpp @@ -15,6 +15,7 @@ BaseTab::BaseTab(wxFrame *parent, std::string base_file) this->Bind(wxEVT_BUTTON, &BaseTab::OnDelete, this, ID_DELETE_BUTTON); this->Bind(wxEVT_BUTTON, &BaseTab::OnSave, this, ID_SAVE_BUTTON); + this->Bind(wxEVT_BUTTON, &BaseTab::OnExport, this, ID_EXPORT_BUTTON); this->Bind(wxEVT_LIST_ITEM_ACTIVATED, &BaseTab::OnOpenGame, this, wxID_ANY); current_base->SetLabel(base_file); LoadFile(); @@ -65,6 +66,23 @@ void BaseTab::OnOpenGame(wxListEvent &event) { void BaseTab::ApplyPreferences() {} +void BaseTab::OnExport(wxCommandEvent &event) { + wxFileDialog openFileDialog(this, _("Export database"), "", "", + "Database files (*.pgn)|*.pgn", + wxFD_SAVE | wxFD_OVERWRITE_PROMPT); + if (openFileDialog.ShowModal() != wxID_CANCEL) { + std::string path = openFileDialog.GetPath().ToStdString(); + wxFileName file(base_file); + wxString ext = file.GetExt().Lower(); + GameBase *base; + if (ext == "pgn") { + base = new PGNGameBase(path); + base->Save(this->base); + delete base; + } + } +} + void BaseTab::LoadFile() { wxFileName file(base_file); wxString ext = file.GetExt().Lower(); |
