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:

View file

@ -6018,7 +6018,7 @@
<property name="selection">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="style">wxCB_READONLY</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
@ -6356,7 +6356,7 @@
<property name="selection">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="style">wxCB_READONLY</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
@ -6407,8 +6407,8 @@
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Import Selection</property>
<property name="id">ID_LOAD_BUTTON</property>
<property name="label">Load</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
@ -6418,7 +6418,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">import_from_db_button</property>
<property name="name">load_button</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -6494,7 +6494,80 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLC_ICON</property>
<property name="style">wxLC_ICON|wxLC_REPORT</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Import Selection</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">import_from_db_button</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>