diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-12-27 15:58:16 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-12-27 15:58:16 +0100 |
| commit | c97e151e1be7123d9d15e9ffcff1c46cecbb543a (patch) | |
| tree | a160099d4b1e7f66b22a19d35c0d1a997aca86bb /src/base_tab/AppendGameDialog.cpp | |
| parent | f40fd3e7a4c5fd36c977ad5343de4fe7859cbbbe (diff) | |
Improve game import
Diffstat (limited to 'src/base_tab/AppendGameDialog.cpp')
| -rw-r--r-- | src/base_tab/AppendGameDialog.cpp | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/base_tab/AppendGameDialog.cpp b/src/base_tab/AppendGameDialog.cpp deleted file mode 100644 index 260ba90..0000000 --- a/src/base_tab/AppendGameDialog.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "AppendGameDialog.hpp" -#include "MainWindow.hpp" -#include "ochess.hpp" - -AppendGameDialog::AppendGameDialog(wxWindow *parent, std::shared_ptr<GameBase> base) - : DialogAppendGame(parent), base(base) { - - for (TabInfos *i : wxGetApp().ListTabInfos()) { - if (i->type == TabInfos::GAME || i->type == TabInfos::BASE) { - wxWindow *win = dynamic_cast<wxWindow *>(i); - game_list->Append(win->GetLabel()); - tinfos.push_back(i); - } - } - - Bind(wxEVT_BUTTON, &AppendGameDialog::OnCancel, this, - ID_DIALOG_CANCEL_BUTTON); - Bind(wxEVT_BUTTON, &AppendGameDialog::OnImport, this, - ID_DIALOG_IMPORT_BUTTON); - Bind(wxEVT_CLOSE_WINDOW, &AppendGameDialog::OnClose, this); -} - -void AppendGameDialog::OnClose(wxCloseEvent &e) { Destroy(); } - -void AppendGameDialog::OnCancel(wxCommandEvent &event) { this->Close(); } - -void AppendGameDialog::OnImport(wxCommandEvent &event) { - std::vector<std::uint32_t> to_ignore; - std::vector<std::shared_ptr<GameBase>> new_games_bases; - std::vector<std::shared_ptr<Game>> new_games; - - wxArrayInt selections; - game_list->GetSelections(selections); - - for (int &i : selections) { - TabInfos *tinfo = tinfos[i]; - if (tinfo->type == TabInfos::BASE) { - new_games_bases.push_back(tinfo->GetBase()); - } else if (tinfo->type == TabInfos::GAME) { - new_games.push_back(tinfo->GetGame()); - } - } - - base->Save(to_ignore, new_games_bases, new_games); - - this->Close(); -}
\ No newline at end of file |
