Improve import tab

This commit is contained in:
Loic Guegan 2022-12-25 19:43:05 +01:00
parent 29f330f307
commit 723f7cc91b
6 changed files with 103 additions and 13 deletions

View file

@ -3,7 +3,10 @@
BaseImportTab::BaseImportTab(wxFrame *parent, TabInfos *main_tab):
TabBase_TabImport(parent), main_tab(main_tab)
{
RefreshImportLists();
glm=new GameListManager(game_list);
RefreshImportLists();
this->Bind(wxEVT_BUTTON, &BaseImportTab::OnLoad, this, ID_LOAD_BUTTON);
opened_db_list->SetHint("No other database open");
}
void BaseImportTab::RefreshImportLists(){
@ -22,3 +25,7 @@ void BaseImportTab::RefreshImportLists(){
}
}
}
void BaseImportTab::OnLoad(wxCommandEvent &event){
wxLogDebug("Load!");
}

View file

@ -1,9 +1,12 @@
#include "ochess.hpp"
#include "GameListManager.hpp"
class BaseImportTab : public TabBase_TabImport {
TabInfos *main_tab;
GameListManager *glm;
public:
BaseImportTab(wxFrame *parent, TabInfos *main_tab);
void RefreshImportLists();
void OnLoad(wxCommandEvent &event);
};

View file

@ -1,3 +1,5 @@
#pragma once
#include "ochess.hpp"
#define TERMS_IN(COL) (row.COL.find(terms) != std::string::npos)

View file

@ -594,7 +594,7 @@ TabBase_TabImport::TabBase_TabImport( wxWindow* parent, wxWindowID id, const wxP
wxBoxSizer* top_sizer;
top_sizer = new wxBoxSizer( wxHORIZONTAL );
opened_game_list = new wxComboBox( this, wxID_ANY, wxT("No game opened"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
opened_game_list = new wxComboBox( this, wxID_ANY, wxT("No game opened"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
top_sizer->Add( opened_game_list, 100, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
import_from_game_button = new wxButton( this, wxID_ANY, wxT("Import Game"), wxDefaultPosition, wxDefaultSize, 0 );
@ -620,20 +620,23 @@ TabBase_TabImport::TabBase_TabImport( wxWindow* parent, wxWindowID id, const wxP
m_staticText29->Wrap( -1 );
bSizer33->Add( m_staticText29, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
opened_db_list = new wxComboBox( this, wxID_ANY, wxT("No other databases opened"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
opened_db_list = new wxComboBox( this, wxID_ANY, wxT("No other databases opened"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
bSizer33->Add( opened_db_list, 100, wxALL|wxEXPAND, 5 );
import_from_db_button = new wxButton( this, wxID_ANY, wxT("Import Selection"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer33->Add( import_from_db_button, 0, wxALL, 5 );
load_button = new wxButton( this, ID_LOAD_BUTTON, wxT("Load"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer33->Add( load_button, 0, wxALL, 5 );
bottom_sizer->Add( bSizer33, 1, wxEXPAND, 5 );
game_list = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ICON );
game_list = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ICON|wxLC_REPORT );
game_list->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTIONTEXT ) );
bottom_sizer->Add( game_list, 20, wxALL|wxEXPAND, 5 );
import_from_db_button = new wxButton( this, wxID_ANY, wxT("Import Selection"), wxDefaultPosition, wxDefaultSize, 0 );
bottom_sizer->Add( import_from_db_button, 0, wxALL|wxEXPAND, 5 );
main_sizer->Add( bottom_sizer, 100, wxEXPAND, 5 );

View file

@ -61,6 +61,7 @@
#define ID_APPLY_FILTER_BUTTON 1016
#define ID_IMPORT_BUTTON 1017
#define ID_DELETE_BUTTON 1018
#define ID_LOAD_BUTTON 1019
///////////////////////////////////////////////////////////////////////////////
/// Class MainFrame
@ -344,8 +345,9 @@ class TabBase_TabImport : public wxPanel
wxStaticText* from_db_label;
wxStaticText* m_staticText29;
wxComboBox* opened_db_list;
wxButton* import_from_db_button;
wxButton* load_button;
wxListCtrl* game_list;
wxButton* import_from_db_button;
public: