aboutsummaryrefslogtreecommitdiff
path: root/src/base_tab/BaseImportTab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/base_tab/BaseImportTab.cpp')
-rw-r--r--src/base_tab/BaseImportTab.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/base_tab/BaseImportTab.cpp b/src/base_tab/BaseImportTab.cpp
index 2daa125..b43cb54 100644
--- a/src/base_tab/BaseImportTab.cpp
+++ b/src/base_tab/BaseImportTab.cpp
@@ -2,9 +2,22 @@
#include <algorithm>
#include "gamebase/GameBase.hpp"
+#define NOTIFY_MANAGE_TAB() \
+{ \
+ wxCommandEvent e(REFRESH_MANAGE_TAB,GetId()); \
+ ProcessEvent(e); \
+}
+
+wxDECLARE_EVENT(REFRESH_MANAGE_TAB, wxCommandEvent);
+
BaseImportTab::BaseImportTab(wxFrame *parent, std::shared_ptr<GameBase> db, TabInfos *main_tab):
TabBase_TabImport(parent), main_tab(main_tab), base(db)
{
+ // Init counters
+ import_ndb=0;
+ import_ngames=0;
+ import_nselect=0;
+
glm=std::make_shared<GameListManager>(game_list);
RefreshImportLists();
RefreshPendingImports();
@@ -27,17 +40,19 @@ void BaseImportTab::OnImportDatabase(wxCommandEvent &event){
}
void BaseImportTab::RefreshPendingImports(){
- int ngames=games_to_import.size();
- int ndb=databases_to_import.size();
- int nbselect=0;
+ import_ndb=databases_to_import.size();
+ import_ngames=games_to_import.size();
+ import_nselect=0;
for (auto it = selected_games_to_import.begin(); it != selected_games_to_import.end(); it++){
- nbselect+=it->second.size();
+ import_nselect+=it->second.size();
}
pending_imports->Clear();
- if(ngames+ndb+nbselect>0){
- pending_imports->AppendText(" Pending imports: "+std::to_string(ngames+nbselect)+" games and "+std::to_string(ndb)+" databases");
+ if(import_ndb+import_ngames+import_nselect>0){
+ pending_imports->AppendText(" Pending imports: "+std::to_string(import_ngames+import_nselect)+" games and "+std::to_string(import_ndb)+" databases");
}else
pending_imports->SetHint("No pending imports");
+
+ NOTIFY_MANAGE_TAB();
}
void BaseImportTab::RefreshImportLists(){
@@ -116,6 +131,7 @@ void BaseImportTab::Reset(std::shared_ptr<GameBase> base){
this->selected_games_to_import.clear();
glm->Clear();
RefreshPendingImports();
+ NOTIFY_MANAGE_TAB();
}
std::vector<std::shared_ptr<Game>> BaseImportTab::GetGameToImport(){