Browse Source

Enregistrement de session, début du codage des fonctions de gestions du ruleset depuis le GUI

master
Maxime Wack 11 years ago
parent
commit
1d9144445d
6 changed files with 100 additions and 9 deletions
  1. +45
    -0
      CosMoS/config.cpp
  2. +10
    -3
      CosMoS/config.h
  3. +1
    -1
      CosMoS/cosmos.cpp
  4. +41
    -1
      CosMoS/optionsRche.cpp
  5. +1
    -1
      CosMoS/optionsRche.fbp
  6. +2
    -3
      CosMoS/optionsRcheGUI.cpp

+ 45
- 0
CosMoS/config.cpp View File

@@ -126,6 +126,51 @@ void config::load()
first_time = false;
}

void config::addrule(rule toadd)
{
ruleset.push_back(toadd);
}

void config::delrule(int index)
{
ruleset.erase(ruleset.begin()+index);
}

int config::getnbrule()
{
return ruleset.size();
}

rule config::getrule(int index)
{
return ruleset[index];
}

void config::modrule(int index, rule temp)
{
ruleset[index] = temp;
}

void config::uprule(int index)
{
if (index > 0)
{
rule temp = ruleset[index-1];
ruleset[index-1] = ruleset[index];
ruleset[index] = temp;
}
}

void config::downrule(int index)
{
if (index < (int)ruleset.size() - 1)
{
rule temp = ruleset[index+1];
ruleset[index+1] = ruleset[index];
ruleset[index] = temp;
}
}

wxString config::bool2W(bool in)
{
if (in)


+ 10
- 3
CosMoS/config.h View File

@@ -37,9 +37,9 @@ typedef struct trule

enum
{
NOT=0,
AND=1,
OR=2
AND=0,
OR=1,
NOT=2
};

enum
@@ -74,6 +74,13 @@ public:
~config();
void save();
void addrule(rule toadd);
void delrule(int index);
int getnbrule();
rule getrule(int index);
void modrule(int index, rule temp);
void uprule(int index);
void downrule(int index);
// GETters et SETters
void SetDbpath(const wxString& dbpath) {this->dbpath = dbpath;}


+ 1
- 1
CosMoS/cosmos.cpp View File

@@ -12,7 +12,7 @@ cosmosGUI( parent )
{
wxMessageBox(_T("Vous lancez CosMoS pour la première fois,\nveuillez configurer le chemin de la base\nainsi que les paramètres de connexion"));
fenetre_options->ShowModal();
wxMessageBox(_T("Vous pouvez également créer des sets d'options de recherche"));
wxMessageBox(_T("Vous pouvez également commencer à créer des sets d'options de recherche"));
fenetre_optionsRche->ShowModal();
}



+ 41
- 1
CosMoS/optionsRche.cpp View File

@@ -5,11 +5,49 @@ optionsRche::optionsRche( wxWindow* parent, config* configuration )
dialog_optionsRche( parent )
{
this->configuration = configuration;
int nbrule = configuration->getnbrule();
for (int i=0; i<nbrule; i++)
{
wxString nom = configuration->getrule(i).name;
checklist_ruleset->InsertItems(1, &nom, i);
if (configuration->getrule(i).inuse)
checklist_ruleset->Check(i);
}
}

void optionsRche::OnChecklistSelect( wxCommandEvent& event )
{
// TODO: Implement OnChecklistSelect
rule currentrule = configuration->getrule(event.GetInt());
textctrl_nomset->SetValue(currentrule.name);
radio_demandeur->SetSelection(currentrule.demandeur);
radio_both->SetSelection(currentrule.both);
radio_responsable->SetSelection(currentrule.responsable);
radio_delai->SetValue(!currentrule.type_date);
radio_dates->SetValue(currentrule.type_date);
checkbox_debut->SetValue(currentrule.usedebut);
checkbox_fin->SetValue(currentrule.usefin);
if (currentrule.type_date == delai)
{
spinctrl_debut->SetValue(currentrule.debut);
spinctrl_fin->SetValue(currentrule.fin);
}
else
{
//TODO: conversions wxDateTime <-> int
}
checkbox_ville->SetValue(currentrule.useville);
textctrl_ville->SetValue(currentrule.ville);
checkbox_suppl->SetValue(currentrule.usesuppl);
textctrl_suppl->SetValue(currentrule.suppl);
spinctrl_retmax->SetValue(currentrule.retmax);
}

void optionsRche::OnAdd( wxCommandEvent& event )
@@ -39,6 +77,8 @@ void optionsRche::OnUpdate( wxCommandEvent& event )

void optionsRche::OnOk( wxCommandEvent& event )
{
//TODO: actualiser les checkés !
//TODO: sauvegarder la config !!!!
Close();
}



+ 1
- 1
CosMoS/optionsRche.fbp View File

@@ -99,7 +99,7 @@
<property name="proportion">1</property>
<object class="wxCheckListBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;defaut&quot;</property>
<property name="choices"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>


+ 2
- 3
CosMoS/optionsRcheGUI.cpp View File

@@ -19,9 +19,8 @@ dialog_optionsRche::dialog_optionsRche( wxWindow* parent, wxWindowID id, const w
wxBoxSizer* horizontalsizer;
horizontalsizer = new wxBoxSizer( wxHORIZONTAL );
wxString checklist_rulesetChoices[] = { wxT("defaut") };
int checklist_rulesetNChoices = sizeof( checklist_rulesetChoices ) / sizeof( wxString );
checklist_ruleset = new wxCheckListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, checklist_rulesetNChoices, checklist_rulesetChoices, wxLB_NEEDED_SB|wxLB_SINGLE );
wxArrayString checklist_rulesetChoices;
checklist_ruleset = new wxCheckListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, checklist_rulesetChoices, wxLB_NEEDED_SB|wxLB_SINGLE );
horizontalsizer->Add( checklist_ruleset, 1, wxEXPAND|wxALL, 5 );
wxBoxSizer* sizer_rulesetorder;


Loading…
Cancel
Save