From e0a1894928abb8361f959a147066e94e2cda996b Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sat, 26 Feb 2022 12:30:07 +0100 Subject: Improve database game import --- src/base_tab/BaseTab.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/base_tab/BaseTab.cpp') diff --git a/src/base_tab/BaseTab.cpp b/src/base_tab/BaseTab.cpp index f7cf48f..3816b59 100644 --- a/src/base_tab/BaseTab.cpp +++ b/src/base_tab/BaseTab.cpp @@ -1,5 +1,6 @@ #include "BaseTab.hpp" #include +#include "AppendGameDialog.hpp" BaseTab::BaseTab(wxFrame *parent, std::string base_file) : BasePanelBF(parent), base_file(base_file), TabInfos(TabInfos::BASE), @@ -17,10 +18,17 @@ BaseTab::BaseTab(wxFrame *parent, std::string base_file) 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); + this->Bind(wxEVT_BUTTON, &BaseTab::OnImport, this, ID_IMPORT_BUTTON); + current_base->SetLabel(base_file); LoadFile(); } +void BaseTab::OnImport(wxCommandEvent &event) { + AppendGameDialog *dia=new AppendGameDialog(this,base); + dia->ShowModal(); +} + void BaseTab::OnDelete(wxCommandEvent &event) { long selected = game_list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); @@ -77,7 +85,7 @@ void BaseTab::OnExport(wxCommandEvent &event) { GameBase *base; if (ext == "pgn") { base = new PGNGameBase(path); - base->Save(this->base); + base->Export(this->base); delete base; } } @@ -109,4 +117,4 @@ void BaseTab::LoadFile() { wxCommandEvent event(REFRESH_TAB_TITLE, GetId()); event.SetEventObject(this); ProcessEvent(event); -} \ No newline at end of file +} -- cgit v1.2.3