From 607d51752155b234935806cc165d28ee8bd5adf8 Mon Sep 17 00:00:00 2001 From: luca Date: Tue, 24 Jul 2007 15:44:05 +0000 Subject: [PATCH] Patch level :4.0 nopatch Files correlati : Ricompilazione Demo : [ ] Commento :aggiunta scelta tipo installazione git-svn-id: svn://10.65.10.50/trunk@15515 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- setup/Setup.cpp | 192 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 138 insertions(+), 54 deletions(-) diff --git a/setup/Setup.cpp b/setup/Setup.cpp index 7fe452e02..18d189c1c 100755 --- a/setup/Setup.cpp +++ b/setup/Setup.cpp @@ -210,9 +210,10 @@ class CampoWizardPage; //predefinizione di CampoWizardPage (magia nera!!) //predefinizione pure della CampoWizard con tutti i suoi metodi per poterlo usare nel metodo GetWizard (magia nerissima!!) class CampoWizard : public wxWizard { - enum { m_nPages = 10 }; + enum { m_nPages = 11 }; CampoWizardPage* m_pPage[m_nPages]; wxString _destination_path; //path di aggiornamento/installazione + unsigned int _installation_type; //tipo di installazione selezionata (standard,server,client...) protected: int Pages() const { return m_nPages; } @@ -225,6 +226,8 @@ public: bool GetBool(wxWindowID id) const; void SetDestinationPath(const wxString& path); const wxString& GetDestinationPath() const; + void SetInstallationType(const unsigned int type); + const unsigned int GetInstallationType() const; CampoWizard(wxWindow* pParent); }; @@ -317,7 +320,8 @@ CampoWizardPage1::CampoWizardPage1(wxWizard* parent) : CampoWizardPage(parent) { //contenuto della prima schermata (pagina benvenuto) wxString strTitle = wxT("Benvenuti in APPNAME"); - wxString strBody = wxT("Questo programma vi guiderà passo a passo nell'installazione / aggiornamento del software."); + wxString strBody = wxT("

Questo programma vi guiderà passo a passo nell'installazione / aggiornamento del software.

"); + strBody += wxT("

Prima di proseguire con l'installazione assicurarsi di avere effettuato il login a Windows con un utente di tipo 'Amministratore'.

"); SetHTMLText(strTitle, strBody); } @@ -356,19 +360,19 @@ CampoWizardPage2::CampoWizardPage2(wxWizard* parent) : CampoWizardPage(parent) wxString group; long index; const wxString program = "Program"; - wxArrayString gruppi, campi; + wxArrayString asGroups, asCampi; //cerca se esiste campo.stp;se lo trova cerca quelle che sono le installazioni valide;se ne trova.. - //..le aggiunge ad un array di stringhe (campi) da cui genera un radiobutton di scelte + //..le aggiunge ad un array di stringhe (asCampi) da cui genera un radiobutton di scelte for (bool ok = campo_stp.GetFirstGroup(group, index); ok; ok = campo_stp.GetNextGroup(group, index)) { - gruppi.Add(group); + asGroups.Add(group); } int prechecked = -1; - for (unsigned int i = 0; i < gruppi.GetCount(); i++) + for (unsigned int i = 0; i < asGroups.GetCount(); i++) { wxFileConfig campo_stp("", "", "", "C:\\campo.stp", wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_NO_ESCAPE_CHARACTERS); - campo_stp.SetPath(gruppi[i]); + campo_stp.SetPath(asGroups[i]); wxString path = campo_stp.Read(program); //sono installazioni valide quelle che presentano la coppia di files campo.ini e campo.aut (senza.. @@ -379,7 +383,7 @@ CampoWizardPage2::CampoWizardPage2(wxWizard* parent) : CampoWizardPage(parent) campo_aut << "\\campo.aut"; if (wxFileName::FileExists(campo_ini) && wxFileName::FileExists(campo_aut)) { - campi.Add(path); + asCampi.Add(path); //cerca l'eventuale installazione server se ci sono piu' installazioni sulla stessa macchina if (prechecked < 0) { @@ -392,33 +396,35 @@ CampoWizardPage2::CampoWizardPage2(wxWizard* parent) : CampoWizardPage(parent) } } + wxString strTitle, strBody; //se non ci sono delle installazioni da aggiornare propone solo installazioni.. - if (campi.IsEmpty()) + if (asCampi.IsEmpty()) { - wxString strTitle = wxT("Scelta Installazione"); - wxString strBody = wxT("

E' possibile INSTALLARE Campo in un nuovo direttorio.

"); - SetHTMLText(strTitle, strBody); + strTitle += wxT("Scelta Installazione"); + strBody += wxT("

E' possibile INSTALLARE Campo in un nuovo direttorio.

"); - campi.Add("Nuova installazione"); //voce di nuova installazione! + asCampi.Add("Nuova installazione"); //voce di nuova installazione! m_pRadioBox = new wxRadioBox(this, 201, "Installazione del software", wxDefaultPosition, - wxDefaultSize, campi, 0, wxRA_SPECIFY_ROWS); + wxDefaultSize, asCampi, 0, wxRA_SPECIFY_ROWS); } //..senno' propone di aggiornare else { - wxString strTitle = wxT("Scelta Aggiornamento / Installazione"); - wxString strBody = wxT("

E' possibile AGGIORNARE (scelta consigliata) una installazione di Campo gia' presente oppure INSTALLARE in un nuovo direttorio.

"); + strTitle += wxT("Scelta Aggiornamento / Installazione"); + strBody += wxT("

E' possibile AGGIORNARE (scelta consigliata) una installazione di Campo gia' presente oppure INSTALLARE in un nuovo direttorio.

"); strBody += wxT("

Selezionare l'opzione desiderata nel riquadro sottostante.

"); - SetHTMLText(strTitle, strBody); //radiobutton con le scelte aggiornamento - campi.Add("Nuova installazione"); - + asCampi.Add("Nuova installazione"); m_pRadioBox = new wxRadioBox(this, 201, "Selezionare l'installazione da aggiornare (consigliato) o Nuova installazione", wxDefaultPosition, - wxDefaultSize, campi, 0, wxRA_SPECIFY_ROWS); + wxDefaultSize, asCampi, 0, wxRA_SPECIFY_ROWS); if (prechecked > 0) m_pRadioBox->SetSelection(prechecked); } + + strBody += wxT("

Prima di proseguire accertarsi che non vi sia alcuna sessione di Campo attiva! "); + strBody += wxT("Terminare quindi le eventuali sessioni di Campo attive e proseguire.

"); + SetHTMLText(strTitle, strBody); GetSizer()->Add(m_pRadioBox); } /**********************************************************************************************************/ @@ -448,11 +454,11 @@ CampoWizardPage3::CampoWizardPage3(wxWizard* parent) : CampoWizardPage(parent) SetHTMLPage("licenza.htm"); //radiobutton Accetta / Rifiuta - wxArrayString acc_ref; - acc_ref.Add("Accetta"); - acc_ref.Add("Rifiuta"); + wxArrayString asAccRef; + asAccRef.Add("Accetta"); + asAccRef.Add("Rifiuta"); wxRadioBox* radio_box = new wxRadioBox(this, 301, "Selezionare 'Accetta' per proseguire con l'installazione, 'Rifiuta' per terminare l'installazione", wxDefaultPosition, - wxDefaultSize, acc_ref, 0, wxRA_SPECIFY_COLS); + wxDefaultSize, asAccRef, 0, wxRA_SPECIFY_COLS); radio_box->SetSelection(1); GetSizer()->Add(radio_box); @@ -728,12 +734,12 @@ CampoWizardPage4::CampoWizardPage4(wxWizard* parent) : CampoWizardPage(parent) case 1: strBody += wxT("

E' stata rilevata una chiave tipo Hardlock:

"); strBody += wxT("

"); - strBody += wxT("

Si puo' procedere con l'installazione /aggiornamento del software Campo. Premere il pulsante \"Next\".

"); + strBody += wxT("

Si puo' procedere con l'installazione /aggiornamento del software Campo. Premere il pulsante \"Next\".

"); break; case 2: strBody += wxT("

E' stata rilevata una chiave tipo Eutron:

"); strBody += wxT("

"); - strBody += wxT("

Si puo' procedere con l'installazione /aggiornamento del software Campo. Premere il pulsante \"Next\".

"); + strBody += wxT("

Si puo' procedere con l'installazione /aggiornamento del software Campo. Premere il pulsante \"Next\".

"); break; //case 3: e' il caso del server di chiavi;la DongleTest() per ora non lo fa //break; @@ -768,21 +774,57 @@ CampoWizardPage4::CampoWizardPage4(wxWizard* parent) : CampoWizardPage(parent) } /**********************************************************************************************************/ -// nuove pagine da implementare +// 5 Scelta tipo installazione /**********************************************************************************************************/ class CampoWizardPage5 : public CampoWizardPage { + wxRadioBox* m_pRadioBox; + protected: + virtual bool TransferDataFromWindow(); + public: CampoWizardPage5(wxWizard* parent); }; -CampoWizardPage5::CampoWizardPage5(wxWizard* parent) : CampoWizardPage(parent) + +bool CampoWizardPage5::TransferDataFromWindow() { - wxString strTitle = wxT("Pagina 5"); - wxString strBody = wxT("Pagina 5"); - SetHTMLText(strTitle, strBody); + const unsigned int type = m_pRadioBox->GetSelection(); + GetWizard().SetInstallationType(type); + return true; } +CampoWizardPage5::CampoWizardPage5(wxWizard* parent) : CampoWizardPage(parent) +{ + //Istruzioni per l'uso! + wxString strTitle = wxT("Scelta del tipo di installazione"); + wxString strBody = wxT("

Standard (scelta consigliata). Installazione su postazione singola, con programmi e dati sul disco locale del computer

"); + strBody += wxT("

Installazioni di rete (per utenti esperti)

"); + strBody += wxT("

Server: Computer in rete sul quale sono presenti una copia, utilizzata o meno, dei programmi (server programmi) e l’area dati (server dati). "); + strBody += wxT("In una installazione in rete di Campo e' necessario sia presente un unica postazione di tipo server, "); + strBody += wxT("e deve essere installata per prima!

"); + strBody += wxT("

Client: Computer in rete sul quale e' presente una copia dei programmi ma non l'area dati. "); + strBody += wxT("I client possono essere installati solo dopo l'installazione del server!

"); + SetHTMLText(strTitle, strBody); + + //radiobutton con i tipi di installazione + wxArrayString asInstType; + asInstType.Add("Standard"); + asInstType.Add("Server"); + asInstType.Add("Client"); + + m_pRadioBox = new wxRadioBox(this, 501, "Selezionare il tipo di installazione", wxDefaultPosition, + wxDefaultSize, asInstType, 0, wxRA_SPECIFY_ROWS); + //setta il default a Standard + m_pRadioBox->SetSelection(0); + GetSizer()->Add(m_pRadioBox); + +} + + +/**********************************************************************************************************/ +// 6 Installazione standard +/**********************************************************************************************************/ class CampoWizardPage6 : public CampoWizardPage { protected: @@ -791,11 +833,13 @@ public: }; CampoWizardPage6::CampoWizardPage6(wxWizard* parent) : CampoWizardPage(parent) { - wxString strTitle = wxT("Pagina 6"); - wxString strBody = wxT("Pagina 6"); + wxString strTitle = wxT("Installazione di tipo Standard"); + wxString strBody = wxT("Pagina 6. Installazione Standard"); SetHTMLText(strTitle, strBody); } - +/**********************************************************************************************************/ +// 7 Installazione server +/**********************************************************************************************************/ class CampoWizardPage7 : public CampoWizardPage { protected: @@ -804,30 +848,43 @@ public: }; CampoWizardPage7::CampoWizardPage7(wxWizard* parent) : CampoWizardPage(parent) { - wxString strTitle = wxT("Pagina 7"); - wxString strBody = wxT("Pagina 7"); + wxString strTitle = wxT("Installazione di tipo Server"); + wxString strBody = wxT("Pagina 7. Installazione Server"); + SetHTMLText(strTitle, strBody); +} +/**********************************************************************************************************/ +// 8 Installazione client +/**********************************************************************************************************/ +class CampoWizardPage8 : public CampoWizardPage +{ +protected: +public: + CampoWizardPage8(wxWizard* parent); +}; +CampoWizardPage8::CampoWizardPage8(wxWizard* parent) : CampoWizardPage(parent) +{ + wxString strTitle = wxT("Installazione di tipo Client"); + wxString strBody = wxT("Pagina 8. Installazione Client"); SetHTMLText(strTitle, strBody); } - - /**********************************************************************************************************/ //pagina con la selezione di destinazione /**********************************************************************************************************/ -class CampoWizardPage8 : public CampoWizardPage +class CampoWizardPage9 : public CampoWizardPage { protected: DECLARE_EVENT_TABLE(); void OnDirPick(wxCommandEvent& e); public: - CampoWizardPage8(wxWizard* parent); + CampoWizardPage9(wxWizard* parent); }; -BEGIN_EVENT_TABLE(CampoWizardPage8, CampoWizardPage) +BEGIN_EVENT_TABLE(CampoWizardPage9, CampoWizardPage) EVT_BUTTON(202, OnDirPick) END_EVENT_TABLE() -void CampoWizardPage8::OnDirPick(wxCommandEvent& e) +void CampoWizardPage9::OnDirPick(wxCommandEvent& e) { wxFileName strPath = Get(201); wxDirDialog dlg(this, wxDirSelectorPromptStr, strPath.GetPath(), @@ -839,7 +896,7 @@ void CampoWizardPage8::OnDirPick(wxCommandEvent& e) } } -CampoWizardPage8::CampoWizardPage8(wxWizard* parent) : CampoWizardPage(parent) +CampoWizardPage9::CampoWizardPage9(wxWizard* parent) : CampoWizardPage(parent) { //seconda pagina wxString strTitle = wxT("Selezione della cartella di destinazione"); @@ -858,13 +915,13 @@ CampoWizardPage8::CampoWizardPage8(wxWizard* parent) : CampoWizardPage(parent) pSizer->Add(pButton, 0, wxALL, 0); } -class CampoWizardPage9 : public CampoWizardPage +class CampoWizardPage10 : public CampoWizardPage { public: - CampoWizardPage9(wxWizard* parent); + CampoWizardPage10(wxWizard* parent); }; -CampoWizardPage9::CampoWizardPage9(wxWizard* parent) : CampoWizardPage(parent) +CampoWizardPage10::CampoWizardPage10(wxWizard* parent) : CampoWizardPage(parent) { wxString strTitle = wxT(""); wxString strBody; @@ -881,13 +938,13 @@ CampoWizardPage9::CampoWizardPage9(wxWizard* parent) : CampoWizardPage(parent) GetSizer()->Add(pBox, 0, wxALL, 0); } -class CampoWizardPage10 : public CampoWizardPage +class CampoWizardPage11 : public CampoWizardPage { public: - CampoWizardPage10(wxWizard* parent); + CampoWizardPage11(wxWizard* parent); }; -CampoWizardPage10::CampoWizardPage10(wxWizard* parent) : CampoWizardPage(parent) +CampoWizardPage11::CampoWizardPage11(wxWizard* parent) : CampoWizardPage(parent) { wxString strTitle = wxT("Collegamenti"); wxString strBody; @@ -950,7 +1007,7 @@ void CampoWizard::SetDestinationPath(const wxString& path) } else { - m_pPage[2]->Chain(m_pPage[2], m_pPage[8]); + m_pPage[2]->Chain(m_pPage[3], m_pPage[8]); } } @@ -959,6 +1016,32 @@ const wxString& CampoWizard::GetDestinationPath() const return _destination_path; } +void CampoWizard::SetInstallationType(const unsigned int type) +{ + _installation_type = type; + //in base al tipo di installazione spara l'utente alla pagina corretta + switch (_installation_type) + { + case 0: //standard + m_pPage[5]->Chain(m_pPage[4], m_pPage[5]); + break; + case 1: //server + m_pPage[5]->Chain(m_pPage[4], m_pPage[6]); + break; + case 2: //client + m_pPage[5]->Chain(m_pPage[4], m_pPage[7]); + break; + default: //standard + m_pPage[5]->Chain(m_pPage[4], m_pPage[5]); + break; + } +} + +const unsigned int CampoWizard::GetInstallationType() const +{ + return _installation_type; +} + CampoWizard::CampoWizard(wxWindow* pParent) { wxBitmap bitmap; @@ -971,12 +1054,13 @@ CampoWizard::CampoWizard(wxWindow* pParent) m_pPage[1] = new CampoWizardPage2(this); //pagina scelta aggiornamento/tipo installazione m_pPage[2] = new CampoWizardPage3(this); //pagina licenza m_pPage[3] = new CampoWizardPage4(this); //pagina test ed installazione chiavi - m_pPage[4] = new CampoWizardPage5(this); //pagina.. - m_pPage[5] = new CampoWizardPage6(this); //pagina.. - m_pPage[6] = new CampoWizardPage7(this); //pagina.. - m_pPage[7] = new CampoWizardPage8(this); + m_pPage[4] = new CampoWizardPage5(this); //pagina selezione tipo installazione + m_pPage[5] = new CampoWizardPage6(this); //pagina installazione standard + m_pPage[6] = new CampoWizardPage7(this); //pagina installazione server + m_pPage[7] = new CampoWizardPage8(this); //pagina installazione client m_pPage[8] = new CampoWizardPage9(this); m_pPage[9] = new CampoWizardPage10(this); + m_pPage[10] = new CampoWizardPage11(this); for (int p = 1; p < m_nPages; p++) m_pPage[p]->Chain(m_pPage[p-1], m_pPage[p]);