Browse Source

Modification des paramètres de recherche (remplacement NOT par «NOT demandeur» et «NOT responsable»)

Ajout de toutes les fonctions et GUI pour gérer les sets de règles de recherche !
master
Maxime Wack 11 years ago
parent
commit
f39b75528a
8 changed files with 123 additions and 22 deletions
  1. +1
    -0
      CosMoS/bdd.cpp
  2. +8
    -3
      CosMoS/config.cpp
  3. +2
    -1
      CosMoS/config.h
  4. +101
    -10
      CosMoS/optionsRche.cpp
  5. +3
    -3
      CosMoS/optionsRche.fbp
  6. +3
    -0
      CosMoS/optionsRche.h
  7. +3
    -3
      CosMoS/optionsRcheGUI.cpp
  8. +2
    -2
      Sante_Pub.workspace

+ 1
- 0
CosMoS/bdd.cpp View File

@@ -191,6 +191,7 @@ void class_bdd::updategrid()
resp.Replace("Mme Le Pr. ", "", true);
resp.Replace("Mr. ", "", true);
resp.Replace("Dr. ", "", true);
resp.Replace("Dr ", "", true);
resp.Replace("Pr. ", "", true);
resp.Replace("Pr ", "", true);
resp.Replace("Mme ", "", true);


+ 8
- 3
CosMoS/config.cpp View File

@@ -16,7 +16,9 @@ void config::createDefault()
proxyport = 8080;
rule defaultrule = {"defaut", true, AND, AND, AND, delai, true, true, 5, 2, true, "Nancy", false, "", 20};
rule rule2 = {"regle 2", false, OR, NOTd, OR, dates, true, true, 20110223, 20120910, false, "", false, "", 30};
ruleset.push_back(defaultrule);
ruleset.push_back(rule2);
first_time = true;
}
@@ -193,7 +195,8 @@ wxString config::op2W(int in)
{
case AND: return "AND"; break;
case OR: return "OR"; break;
case NOT: return "NOT"; break;
case NOTd: return "NOTd"; break;
case NOTr: return "NOTr"; break;
default: return "AND";break;
};
}
@@ -204,8 +207,10 @@ int config::W2op(wxString in)
return AND;
else if (in == "OR")
return OR;
else if (in == "NOT")
return NOT;
else if (in == "NOTd")
return NOTd;
else if (in == "NOTr")
return NOTr;
return AND;
}



+ 2
- 1
CosMoS/config.h View File

@@ -39,7 +39,8 @@ enum
{
AND=0,
OR=1,
NOT=2
NOTd=2,
NOTr=3
};

enum


+ 101
- 10
CosMoS/optionsRche.cpp View File

@@ -8,8 +8,7 @@ dialog_optionsRche( parent )
int nbrule = configuration->getnbrule();
for (int i=0; i<nbrule; i++)
{
wxString nom = configuration->getrule(i).name;
checklist_ruleset->InsertItems(1, &nom, i);
checklist_ruleset->Append(configuration->getrule(i).name);
if (configuration->getrule(i).inuse)
checklist_ruleset->Check(i);
}
@@ -38,7 +37,8 @@ void optionsRche::OnChecklistSelect( wxCommandEvent& event )
}
else
{
//TODO: conversions wxDateTime <-> int
datepicker_debut->SetValue(int2date(currentrule.debut));
datepicker_fin->SetValue(int2date(currentrule.fin));
}
checkbox_ville->SetValue(currentrule.useville);
@@ -48,37 +48,116 @@ void optionsRche::OnChecklistSelect( wxCommandEvent& event )
textctrl_suppl->SetValue(currentrule.suppl);
spinctrl_retmax->SetValue(currentrule.retmax);
wxCommandEvent ev;
updateGUI(ev);
}

void optionsRche::OnAdd( wxCommandEvent& event )
{
// TODO: Implement OnAdd
rule toadd;
toadd.name = textctrl_nomset->GetValue();
toadd.demandeur = radio_demandeur->GetSelection();
toadd.both = radio_both->GetSelection();
toadd.responsable = radio_responsable->GetSelection();
toadd.type_date = radio_dates->GetValue();
toadd.usedebut = checkbox_debut->GetValue();
toadd.usefin = checkbox_fin->GetValue();
if (radio_dates->GetValue())
{
toadd.debut = date2int(datepicker_debut->GetValue());
toadd.fin = date2int(datepicker_fin->GetValue());
}
else
{
toadd.debut = spinctrl_debut->GetValue();
toadd.fin = spinctrl_fin->GetValue();
}
toadd.useville = checkbox_ville->GetValue();
toadd.ville = textctrl_ville->GetValue();
toadd.usesuppl = checkbox_suppl->GetValue();
toadd.suppl = textctrl_suppl->GetValue();
toadd.retmax = spinctrl_retmax->GetValue();
checklist_ruleset->Append(toadd.name);
configuration->addrule(toadd);
}

void optionsRche::OnUp( wxCommandEvent& event )
{
// TODO: Implement OnUp
int selected = checklist_ruleset->GetSelection();
configuration->uprule(selected);
if (selected > 0)
{
wxString temp = checklist_ruleset->GetString(selected-1);
checklist_ruleset->SetString(selected-1, checklist_ruleset->GetStringSelection());
checklist_ruleset->SetString(selected, temp);
checklist_ruleset->SetSelection(selected-1);
}
}

void optionsRche::OnDown( wxCommandEvent& event )
{
// TODO: Implement OnDown
int selected = checklist_ruleset->GetSelection();
configuration->downrule(selected);
if (selected < (int)checklist_ruleset->GetCount() - 1)
{
wxString temp = checklist_ruleset->GetString(selected+1);
checklist_ruleset->SetString(selected+1, checklist_ruleset->GetStringSelection());
checklist_ruleset->SetString(selected, temp);
checklist_ruleset->SetSelection(selected+1);
}
}

void optionsRche::OnDel( wxCommandEvent& event )
{
// TODO: Implement OnDel
configuration->delrule(checklist_ruleset->GetSelection());
checklist_ruleset->Delete(checklist_ruleset->GetSelection());
}

void optionsRche::OnUpdate( wxCommandEvent& event )
{
// TODO: Implement OnUpdate
rule tomod;
tomod.name = textctrl_nomset->GetValue();
tomod.demandeur = radio_demandeur->GetSelection();
tomod.both = radio_both->GetSelection();
tomod.responsable = radio_responsable->GetSelection();
tomod.type_date = radio_dates->GetValue();
tomod.usedebut = checkbox_debut->GetValue();
tomod.usefin = checkbox_fin->GetValue();
if (radio_dates->GetValue())
{
tomod.debut = date2int(datepicker_debut->GetValue());
tomod.fin = date2int(datepicker_fin->GetValue());
}
else
{
tomod.debut = spinctrl_debut->GetValue();
tomod.fin = spinctrl_fin->GetValue();
}
tomod.useville = checkbox_ville->GetValue();
tomod.ville = textctrl_ville->GetValue();
tomod.usesuppl = checkbox_suppl->GetValue();
tomod.suppl = textctrl_suppl->GetValue();
tomod.retmax = spinctrl_retmax->GetValue();
checklist_ruleset->SetString(checklist_ruleset->GetSelection(), tomod.name);
configuration->modrule(checklist_ruleset->GetSelection(), tomod);
}

void optionsRche::OnOk( wxCommandEvent& event )
{
//TODO: actualiser les checkés !
//TODO: sauvegarder la config !!!!
// Actualisation des sets selectionnés
for (int i=0; i < (int)checklist_ruleset->GetCount(); i++)
{
rule temp = configuration->getrule(i);
if (checklist_ruleset->IsChecked(i))
temp.inuse = true;
else
temp.inuse = false;
configuration->modrule(i, temp);
}
configuration->save();
Close();
}

@@ -121,3 +200,15 @@ void optionsRche::updateGUI( wxCommandEvent& event )
datepicker_fin->Disable();
}
}

wxDateTime optionsRche::int2date(int in)
{
wxDateTime out;
out.ParseFormat(_itoW(in), "%Y%m%d");
return out;
}

int optionsRche::date2int(wxDateTime in)
{
return wxAtoi(in.Format("%Y%m%d"));
}

+ 3
- 3
CosMoS/optionsRche.fbp View File

@@ -657,7 +657,7 @@
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="0">
<property name="bg"></property>
<property name="choices">&quot;AND&quot; &quot;OR&quot; &quot;NOT&quot;</property>
<property name="choices">&quot;AND&quot; &quot;OR&quot; &quot;NOT demandeur&quot; &quot;NOT responsable&quot;</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
@@ -1101,7 +1101,7 @@
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxDP_DEFAULT</property>
<property name="style">wxDP_DROPDOWN</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
@@ -1273,7 +1273,7 @@
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxDP_DEFAULT</property>
<property name="style">wxDP_DROPDOWN</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>


+ 3
- 0
CosMoS/optionsRche.h View File

@@ -25,6 +25,9 @@ protected:
void updateGUI( wxCommandEvent& event );
void OnUpdate( wxCommandEvent& event );
void OnOk( wxCommandEvent& event );
wxDateTime int2date(int in);
int date2int(wxDateTime in);
public:
/** Constructor */
optionsRche( wxWindow* parent, config* configuration );


+ 3
- 3
CosMoS/optionsRcheGUI.cpp View File

@@ -67,7 +67,7 @@ dialog_optionsRche::dialog_optionsRche( wxWindow* parent, wxWindowID id, const w
radio_demandeur->SetSelection( 0 );
sizer_noms->Add( radio_demandeur, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxString radio_bothChoices[] = { wxT("AND"), wxT("OR"), wxT("NOT") };
wxString radio_bothChoices[] = { wxT("AND"), wxT("OR"), wxT("NOT demandeur"), wxT("NOT responsable") };
int radio_bothNChoices = sizeof( radio_bothChoices ) / sizeof( wxString );
radio_both = new wxRadioBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, radio_bothNChoices, radio_bothChoices, 1, wxRA_SPECIFY_COLS );
radio_both->SetSelection( 0 );
@@ -108,7 +108,7 @@ dialog_optionsRche::dialog_optionsRche( wxWindow* parent, wxWindowID id, const w
spinctrl_debut = new wxSpinCtrl( this, wxID_ANY, wxT("5"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 5 );
sizer_dates->Add( spinctrl_debut, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
datepicker_debut = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT );
datepicker_debut = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN );
datepicker_debut->Enable( false );
sizer_dates->Add( datepicker_debut, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
@@ -120,7 +120,7 @@ dialog_optionsRche::dialog_optionsRche( wxWindow* parent, wxWindowID id, const w
spinctrl_fin = new wxSpinCtrl( this, wxID_ANY, wxT("2"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 2 );
sizer_dates->Add( spinctrl_fin, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
datepicker_fin = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT );
datepicker_fin = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN );
datepicker_fin->Enable( false );
sizer_dates->Add( datepicker_fin, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );


+ 2
- 2
Sante_Pub.workspace View File

@@ -18,7 +18,7 @@
<Project Name="testcurl" ConfigName="Debug"/>
<Project Name="testsqlite" ConfigName="Debug"/>
</WorkspaceConfiguration>
<WorkspaceConfiguration Name="Release" Selected="yes">
<WorkspaceConfiguration Name="Release" Selected="no">
<Project Name="COSMOS" ConfigName="Release"/>
<Project Name="CosMoS" ConfigName="Release"/>
<Project Name="grid" ConfigName="Release"/>
@@ -31,7 +31,7 @@
<Project Name="testcurl" ConfigName="Debug_WIN"/>
<Project Name="testsqlite" ConfigName="Debug_WIN"/>
</WorkspaceConfiguration>
<WorkspaceConfiguration Name="Release_WIN" Selected="no">
<WorkspaceConfiguration Name="Release_WIN" Selected="yes">
<Project Name="CosMoS" ConfigName="Release_WIN"/>
<Project Name="grid" ConfigName="Release_WIN"/>
<Project Name="testcurl" ConfigName="Release_WIN"/>


Loading…
Cancel
Save