Debug import

This commit is contained in:
Loic Guegan 2022-12-26 17:03:52 +01:00
parent aae19085bb
commit a09db7e745

View file

@ -19,6 +19,8 @@ TabBase_TabImport(parent), main_tab(main_tab), base(db)
void BaseImportTab::OnImportDatabase(wxCommandEvent &event){
if(std::find(databases_to_import.begin(), databases_to_import.end(), selected_base) == databases_to_import.end()){
databases_to_import.push_back(selected_base);
selected_games_to_import.clear();
glm->Clear();
RefreshPendingImports();
}
else SHOW_DIALOG_INFO("Database already prepared for import");
@ -53,16 +55,21 @@ void BaseImportTab::RefreshImportLists(){
}
void BaseImportTab::OnImportSelection(wxCommandEvent &event){
long selected = -1;
while ((selected = game_list->GetNextItem(selected, wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED)) !=
wxNOT_FOUND) {
long game_id=glm->GetItemGameId(selected);
if(selected_games_to_import.find(game_id) == selected_games_to_import.end()){
selected_games_to_import[game_id]=selected_base->GetGame(glm->GetItemGameId(selected));
glm->MarkItemAsImported(selected);
if(std::find(databases_to_import.begin(), databases_to_import.end(), selected_base) == databases_to_import.end()){
long selected = -1;
while ((selected = game_list->GetNextItem(selected, wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED)) !=
wxNOT_FOUND) {
long game_id=glm->GetItemGameId(selected);
if(selected_games_to_import.find(game_id) == selected_games_to_import.end()){
selected_games_to_import[game_id]=selected_base->GetGame(glm->GetItemGameId(selected));
glm->MarkItemAsImported(selected);
}
}
}
else {
SHOW_DIALOG_INFO("Database already prepared for import");
}
RefreshPendingImports();
}