Beispiel #1
0
void wxWizardEx::OnWizEvent(wxWizardExEvent& event)
{
    // the dialogs have wxWS_EX_BLOCK_EVENTS style on by default but we want to
    // propagate wxEVT_WIZARD_XXX to the parent (if any), so do it manually
    if ( !(GetExtraStyle() & wxWS_EX_BLOCK_EVENTS) )
    {
        // the event will be propagated anyhow
        event.Skip();
    }
    else
    {
        wxWindow *parent = GetParent();

        if ( !parent || !parent->GetEventHandler()->ProcessEvent(event) )
        {
            event.Skip();
        }
    }

    if ( ( !m_wasModal ) && event.IsAllowed() &&
         ( event.GetEventType() == wxEVT_WIZARDEX_FINISHED || event.GetEventType() == wxEVT_WIZARDEX_CANCEL )
       )
    {
        Destroy();
    }
}
void CErrProxyPage::OnPageChanging( wxWizardExEvent& event ) {
    CMainDocument* pDoc = wxGetApp().GetDocument();
    wxString       strBuffer = wxEmptyString;
    int            iBuffer = 0;

    wxASSERT(pDoc);
    wxASSERT(wxDynamicCast(pDoc, CMainDocument));

    if (event.GetDirection() == true) {
        // Moving to the next page, save state
        pDoc->proxy_info.use_http_proxy = (m_pProxyHTTPServerCtrl->GetValue().Length() > 0);
        pDoc->proxy_info.http_server_name = (const char*)m_pProxyHTTPServerCtrl->GetValue().mb_str();
        pDoc->proxy_info.http_user_name = (const char*)m_pProxyHTTPUsernameCtrl->GetValue().mb_str();
        pDoc->proxy_info.http_user_passwd = (const char*)m_pProxyHTTPPasswordCtrl->GetValue().mb_str();

        strBuffer = m_pProxyHTTPPortCtrl->GetValue();
        strBuffer.ToLong((long*)&iBuffer);
        pDoc->proxy_info.http_server_port = iBuffer;

        pDoc->proxy_info.use_socks_proxy = (m_pProxySOCKSServerCtrl->GetValue().Length() > 0);
        pDoc->proxy_info.socks_server_name = (const char*)m_pProxySOCKSServerCtrl->GetValue().mb_str();
        pDoc->proxy_info.socks5_user_name = (const char*)m_pProxySOCKSUsernameCtrl->GetValue().mb_str();
        pDoc->proxy_info.socks5_user_passwd = (const char*)m_pProxySOCKSPasswordCtrl->GetValue().mb_str();

        strBuffer = m_pProxySOCKSPortCtrl->GetValue();
        strBuffer.ToLong((long*)&iBuffer);
        pDoc->proxy_info.socks_server_port = iBuffer;

        pDoc->SetProxyConfiguration();
    }
}
void CTermsOfUsePage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;

    PROJECT_CONFIG&        pc = ((CBOINCBaseWizard*)GetParent())->project_config;

    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pDirectionsStaticCtrl);

    m_pTitleStaticCtrl->SetLabel(
        _("Terms of Use")
    );

    m_pDirectionsStaticCtrl->SetLabel(
        _("Please read the following terms of use:")
    );

    m_pTermsOfUseCtrl->SetValue(
        wxString(pc.terms_of_use.c_str(), wxConvUTF8)
    );
    m_pTermsOfUseCtrl->SetSelection(0,0);

    m_pAgreeCtrl->SetLabel(
        _("I agree to the terms of use.")
    );
    m_pAgreeCtrl->SetValue(false);


    m_pDisagreeCtrl->SetLabel(
        _("I do not agree with the terms of use.")
    );
    m_pDisagreeCtrl->SetValue(true);
    SetUserAgrees(false);

    Fit();
}
Beispiel #4
0
void CTermsOfUsePage::OnPageChanging( wxWizardExEvent& event ) {
    CWizardAttach*  pWA = ((CWizardAttach*)GetParent());

    wxASSERT(pWA);
    wxASSERT(wxDynamicCast(pWA, CWizardAttach));

    // If the user has left the terms of use disagree radio button
    // selected, then the next button is disabled and needs to be
    // re-enabled if the back button is pressed.
    pWA->EnableNextButton();

    if (event.GetDirection() == false) return;

    if (!CHECK_CLOSINGINPROGRESS()) {
        // We are leaving this page.

        // Determine if the account settings are already pre-populated.
        //   If so, advance to the Account Manager Processing page or the
        //   Project Processing page.
        if ( pWA->m_bCredentialsCached || pWA->m_bCredentialsDetected) {
            SetCredentialsAlreadyAvailable(true);
        } else {
            SetCredentialsAlreadyAvailable(false);
        }
    }
}
void CAccountManagerInfoPage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;
    wxLogTrace(wxT("Function Start/End"), wxT("CAccountManagerInfoPage::OnPageChanged - Function Begin"));

    unsigned int      i;
    ALL_PROJECTS_LIST pl;
    CMainDocument*    pDoc = wxGetApp().GetDocument();

    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pDescriptionStaticCtrl);
    wxASSERT(m_pProjectUrlStaticCtrl);
    wxASSERT(m_pProjectUrlCtrl);


    m_pTitleStaticCtrl->SetLabel(
        _("Choose an account manager")
    );
    m_pDescriptionStaticCtrl->SetLabel(
        _("To choose an account manager, click its name or \ntype its URL below.")
    );
    m_pProjectUrlStaticCtrl->SetLabel(
        _("Account Manager &URL:")
    );

    // Populate the virtual list control with project information
    //
    if (!m_bAccountManagerListPopulated) {
        pDoc->rpc.get_all_projects_list(pl);
        for (i=0; i<pl.account_managers.size(); i++) {
            wxLogTrace(
                wxT("Function Status"),
                wxT("CAccountManagerInfoPage::OnPageChanged - Name: '%s', URL: '%s', Supported: '%d'"),
                wxString(pl.account_managers[i]->name.c_str(), wxConvUTF8).c_str(),
                wxString(pl.account_managers[i]->url.c_str(), wxConvUTF8).c_str(),
                true
            );

            m_pProjectListCtrl->Append(
                wxString(pl.account_managers[i]->url.c_str(), wxConvUTF8),
                wxString(pl.account_managers[i]->name.c_str(), wxConvUTF8),
                wxString(pl.account_managers[i]->image.c_str(), wxConvUTF8),
                wxString(pl.account_managers[i]->description.c_str(), wxConvUTF8),
                false,
                false,
                false,
                true
            );
        }
        m_bAccountManagerListPopulated = true;
    }

    Layout();
    FitInside();
    m_pProjectListCtrl->SetFocus();

    wxLogTrace(wxT("Function Start/End"), wxT("CAccountManagerInfoPage::OnPageChanged - Function End"));
}
Beispiel #6
0
void CAccountManagerInfoPage::OnPageChanging( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;

    CWizardAttach* pWA = ((CWizardAttach*)GetParent());
	CAcctMgrListItem* pItem = (CAcctMgrListItem*)(m_pProjectListCtrl->GetClientData(m_pProjectListCtrl->GetSelection()));

    // Update authoritative data in CWizardAttach
	pWA->SetProjectURL(pItem->GetURL());
	pWA->SetProjectName(pItem->GetName());
}
void CWizardAttach::_ProcessCancelEvent( wxWizardExEvent& event ) {

    bool bCancelWithoutNextPage = false;
    wxWizardPageEx* page = GetCurrentPage();

    int iRetVal = wxGetApp().SafeMessageBox(
        _("Do you really want to cancel?"), 
        _("Question"),
        wxICON_QUESTION | wxYES_NO,
        this
    );

    // Reenable the next and back buttons if they have been disabled
    GetNextButton()->Enable();
    GetBackButton()->Enable();

    // Page specific rules - Disable the validator(s)
    if (wxYES == iRetVal) {
        if ((page == m_ProjectInfoPage) || (page == m_AccountManagerInfoPage)) {
            m_ProjectInfoPage->m_pProjectUrlCtrl->SetValidator(wxDefaultValidator);
        } else if (page == m_AccountInfoPage) {
            m_AccountInfoPage->m_pAccountEmailAddressCtrl->SetValidator(wxDefaultValidator);
            m_AccountInfoPage->m_pAccountPasswordCtrl->SetValidator(wxDefaultValidator);
            if (IsAttachToProjectWizard) {
                m_AccountInfoPage->m_pAccountConfirmPasswordCtrl->SetValidator(wxDefaultValidator);
            }
        } else if (page == m_ErrProxyPage) {
            m_ErrProxyPage->m_pProxyHTTPServerCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxyHTTPPortCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxyHTTPUsernameCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxyHTTPPasswordCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxySOCKSServerCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxySOCKSPortCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxySOCKSUsernameCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxySOCKSPasswordCtrl->SetValidator(wxDefaultValidator);
        }
    }

    // Generic rules
    bCancelWithoutNextPage |= (page == m_ErrNotDetectedPage);
    bCancelWithoutNextPage |= (page == m_ErrUnavailablePage);
    bCancelWithoutNextPage |= (page == m_ErrNoInternetConnectionPage);
    
    if (IsAttachToProjectWizard) {
        bCancelWithoutNextPage |= (page == m_ErrAlreadyExistsPage);
    } else {
        bCancelWithoutNextPage |= (page == m_WelcomePage);
    }
    if (wxYES != iRetVal) {
        event.Veto();
    }
}
Beispiel #8
0
void CWizardAttach::OnFinished( wxWizardExEvent& event ) {

    if (IsAccountManagerWizard) {
        // Attached to an account manager
        if (!GetReturnURL().empty() && GetAttachedToProjectSuccessfully()) {
            wxLaunchDefaultBrowser(GetReturnURL());
        }
    } else {
        // Attached to a project
        if (GetAccountCreatedSuccessfully() && GetAttachedToProjectSuccessfully()) {
            wxLaunchDefaultBrowser(GetProjectURL() + wxT("account_finish.php?auth=") + GetProjectAuthenticator());
        }
    }

    // Let the framework clean things up.
    event.Skip();
}
void CProjectProcessingPage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;
 
    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pProgressIndicator);

    m_pTitleStaticCtrl->SetLabel(
        _("Communicating with project\nPlease wait...")
    );

    SetProjectCommunitcationsSucceeded(false);
    SetProjectUnavailable(false);
    SetProjectAccountAlreadyExists(false);
    SetNextState(ATTACHPROJECT_INIT);
 
    CProjectProcessingPageEvent TransitionEvent(wxEVT_PROJECTPROCESSING_STATECHANGE, this);
    AddPendingEvent(TransitionEvent);

    Fit();
}
void CAccountManagerProcessingPage::OnPageChanged( wxWizardExEvent& event )
{
    if (event.GetDirection() == false) return;
 
    CWizardAttach* pWA = ((CWizardAttach*)GetParent());
    
    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pPleaseWaitStaticCtrl);
    wxASSERT(m_pProgressIndicator);
    wxASSERT(pWA);
        
    if (!pWA->m_strProjectName.IsEmpty()) {
        wxString str;

        // %s is the project name
        //    i.e. 'BOINC', 'GridRepublic'
        str.Printf(_("Communicating with %s."), pWA->m_strProjectName.c_str());

        m_pTitleStaticCtrl->SetLabel(
            str
        );
    } else {
        m_pTitleStaticCtrl->SetLabel(
            _("Communicating with server.")
        );
    }

    m_pPleaseWaitStaticCtrl->SetLabel(
        _("Please wait...")
    );

    SetProjectCommunicationsSucceeded(false);
    SetProjectUnavailable(false);
    SetProjectAccountAlreadyExists(false);
    SetNextState(ATTACHACCTMGR_INIT);
 
    CAccountManagerProcessingPageEvent TransitionEvent(wxEVT_ACCOUNTMANAGERPROCESSING_STATECHANGE, this);
    AddPendingEvent(TransitionEvent);

    Fit();
}
void CTermsOfUsePage::OnPageChanging( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;

    CWizardAttachProject*  pWAP = ((CWizardAttachProject*)GetParent());

    wxASSERT(pWAP);
    wxASSERT(wxDynamicCast(pWAP, CWizardAttachProject));


    if (!CHECK_CLOSINGINPROGRESS()) {
        // We are leaving this page.

        // Determine if the account settings are already pre-populated.
        //   If so, advance to the Account Manager Processing page or the
        //   Project Processing page.
        if ( pWAP->m_bCredentialsCached || pWAP->m_bCredentialsDetected) {
            SetCredentialsAlreadyAvailable(true);
        } else {
            SetCredentialsAlreadyAvailable(false);
        }
    }
}
Beispiel #12
0
void CErrNotFoundPage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;


    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pDirectionsStaticCtrl);

    m_pTitleStaticCtrl->SetLabel(
        _("Login Failed.")
    );
    if (((CWizardAttach*)GetParent())->project_config.uses_username) {
        m_pDirectionsStaticCtrl->SetLabel(
            _("Check the username and password, and try again.")
        );
    } else {
        m_pDirectionsStaticCtrl->SetLabel(
            _("Check the email address and password, and try again.")
        );
    }

    Fit();
}
Beispiel #13
0
void CProjectWelcomePage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;
    wxLogTrace(wxT("Function Start/End"), wxT("CProjectWelcomePage::OnPageChanged - Function Begin"));

    CWizardAttach* pWA  = ((CWizardAttach*)GetParent());

    wxString buf;
    buf.Printf(_("Welcome to %s."), pWA->GetProjectName().c_str());
    title_ctrl->SetLabel(buf);

    intro_ctrl->SetLabel(_("You have volunteered to compute for this project:"));
    project_name1_ctrl->SetLabel(_("Name:"));
    project_name2_ctrl->SetLabel(pWA->GetProjectName());
    if (!pWA->GetProjectInstitution().IsEmpty()) {
        project_inst1_ctrl->SetLabel(_("Home:"));
        project_inst2_ctrl->SetLabel(pWA->GetProjectInstitution());
    }
    if (!pWA->GetProjectDescription().IsEmpty()) {
        project_desc1_ctrl->SetLabel(_("Description:"));
        project_desc2_ctrl->SetLabel(pWA->GetProjectDescription());
    }
    project_url1_ctrl->SetLabel(_("URL:"));
    project_url2_ctrl->SetLabel(pWA->GetProjectURL());
    if (!pWA->GetProjectUserName().IsEmpty()) {
        user_name1_ctrl->SetLabel(_("User:"******"WARNING: This project is not registered with BOINC.  Make sure you trust it before continuing."));

    }
    continue_ctrl->SetLabel(
        _("To continue, click Next.")
    );

    Layout();
    wxLogTrace(wxT("Function Start/End"), wxT("CProjectWelcomePage::OnPageChanged - Function End"));
}
Beispiel #14
0
void CProjectPropertiesPage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;
 
    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pProgressIndicator);

    m_pTitleStaticCtrl->SetLabel(
        _("Communicating with project\nPlease wait...")
    );

    SetProjectPropertiesSucceeded(false);
    SetProjectPropertiesURLFailure(false);
    SetProjectPropertiesCommunicationFailure(false);
    SetProjectAccountCreationDisabled(false);
    SetProjectClientAccountCreationDisabled(false);
    SetNetworkConnectionNotDetected(false);
    SetNextState(PROJPROP_INIT);

    CProjectPropertiesPageEvent TransitionEvent(wxEVT_PROJECTPROPERTIES_STATECHANGE, this);
    AddPendingEvent(TransitionEvent);

    Fit();
}
Beispiel #15
0
void CWizardAttach::_ProcessCancelEvent( wxWizardExEvent& event ) {

    bool bCancelWithoutNextPage = false;
    wxWizardPageEx* page = GetCurrentPage();

    m_bCancelInProgress = true;

    int iRetVal = wxGetApp().SafeMessageBox(
        _("Do you really want to cancel?"), 
        _("Question"),
        wxICON_QUESTION | wxYES_NO,
        this
    );

    // Reenable the next and back buttons if they have been disabled
    GetNextButton()->Enable();
    GetBackButton()->Enable();

    // Generic rules
    bCancelWithoutNextPage |= (page == m_ErrNotDetectedPage);
    bCancelWithoutNextPage |= (page == m_ErrUnavailablePage);
    bCancelWithoutNextPage |= (page == m_ErrNoInternetConnectionPage);
    
    if (IsAttachToProjectWizard) {
        bCancelWithoutNextPage |= (page == m_ErrAlreadyExistsPage);
    } else {
        bCancelWithoutNextPage |= (page == m_ProjectWelcomePage);
   }

    if (wxYES != iRetVal) {
        event.Veto();
        m_bCancelInProgress = false;
    } else {
        m_bCancelInProgress = true;
    }
}
void CErrAlreadyExistsPage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;

    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pDirectionsStaticCtrl);

    if (((CBOINCBaseWizard*)GetParent())->project_config.uses_username) {
        m_pTitleStaticCtrl->SetLabel(
            _("Username already in use")
        );
        m_pDirectionsStaticCtrl->SetLabel(
            _("An account with that username already exists and has a\ndifferent password than the one you entered.\n\nPlease visit the project's web site and follow the instructions there.")
        );
    } else {
        m_pTitleStaticCtrl->SetLabel(
            _("Email address already in use")
        );
        m_pDirectionsStaticCtrl->SetLabel(
            _("An account with that email address already exists and has a\ndifferent password than the one you entered.\n\nPlease visit the project's web site and follow the instructions there.")
        );
    }

    Fit();
}
Beispiel #17
0
void CAccountInfoPage::OnPageChanging( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;

    CWizardAttach*         pWA = ((CWizardAttach*)GetParent());
    PROJECT_CONFIG&        pc = pWA->project_config;
    wxString               strTitle;
    wxString               strMessage = wxT("");
    bool                   bDisplayError = false;
    wxString               strBaseConfigLocation = wxString(wxT("/Wizards"));
    wxConfigBase*          pConfig = wxConfigBase::Get(FALSE);

    if (!CHECK_CLOSINGINPROGRESS()) {
        // We are leaving this page, so store the email address for future
        // use.
        pConfig->SetPath(strBaseConfigLocation);
        pConfig->Write(wxT("DefaultEmailAddress"), m_strAccountEmailAddress);
        pConfig->Write(wxT("DefaultUsername"), m_strAccountUsername);

        pConfig->Flush();
        
        // Construct potiental dialog title
        if (IS_ATTACHTOPROJECTWIZARD()) {
            strTitle = _("Add project");
        } else if (IS_ACCOUNTMANAGERWIZARD() && IS_ACCOUNTMANAGERUPDATEWIZARD()) {
            strTitle = _("Update account manager");
        } else if (IS_ACCOUNTMANAGERWIZARD()) {
            strTitle = _("Use account manager");
        }
 
        // Verify minimum username length
        if (!m_pAccountUseExistingCtrl->GetValue()) {
            if (!(m_pAccountPasswordCtrl->GetValue().Length() > 0)) {
                if (pc.uses_username) {
                    if (IS_ATTACHTOPROJECTWIZARD()) {
                        strMessage.Printf(
                            _("The minimum username length for this project is 1. Please enter a different username.")
                        );
                    }
                    if (IS_ACCOUNTMANAGERWIZARD()) {
                        strMessage.Printf(
                            _("The minimum username length for this account manager is 1. Please enter a different username.")
                        );
                    }
                } else {
                    if (IS_ATTACHTOPROJECTWIZARD()) {
                        strMessage.Printf(
                            _("The minimum email address length for this project is 1. Please enter a different email address.")
                        );
                    }
                    if (IS_ACCOUNTMANAGERWIZARD()) {
                        strMessage.Printf(
                            _("The minimum email address length for this account manager is 1. Please enter a different email address.")
                        );
                    }
                }
                bDisplayError = true;
            }
        }

        // Verify minimum password length
        if (!m_pAccountUseExistingCtrl->GetValue()) {
            if (m_pAccountPasswordCtrl->GetValue().Length() < (size_t)pc.min_passwd_length) {
                if (IS_ATTACHTOPROJECTWIZARD()) {
                    strMessage.Printf(
                        _("The minimum password length for this project is %d. Please enter a different password."),
                        pc.min_passwd_length
                    );
                }
                if (IS_ACCOUNTMANAGERWIZARD()) {
                    strMessage.Printf(
                        _("The minimum password length for this account manager is %d. Please enter a different password."),
                        pc.min_passwd_length
                    );
                }

                bDisplayError = true;
            }
        }

        // Verify that the password and confirmation password math.
        if (!IS_ACCOUNTMANAGERWIZARD() && m_pAccountCreateCtrl->GetValue()) {
            if (m_pAccountPasswordCtrl->GetValue() != m_pAccountConfirmPasswordCtrl->GetValue()) {
                strMessage = _("The password and confirmation password do not match. Please type them again.");
                bDisplayError = true;
            }
        }
 
        if (bDisplayError) {
            wxGetApp().SafeMessageBox(
                strMessage,
                strTitle,
                wxICON_ERROR | wxOK,
                this
            );
            event.Veto();
        }
    }
}
Beispiel #18
0
void CAccountInfoPage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;

    CWizardAttach*   pWA = ((CWizardAttach*)GetParent());
    CSkinAdvanced*   pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
    CSkinWizardATAM* pSkinWizardATAM = wxGetApp().GetSkinManager()->GetWizards()->GetWizardATAM();
    PROJECT_CONFIG&  pc = pWA->project_config;
    wxString         strBaseConfigLocation = wxString(wxT("/Wizards"));
    wxConfigBase*    pConfig = wxConfigBase::Get(FALSE);
 
    wxASSERT(pSkinAdvanced);
    wxASSERT(pSkinWizardATAM);
    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pCookieDetectionFailedStaticCtrl);
    wxASSERT(m_pCookieDetectionFailedCtrl);
    wxASSERT(m_pAccountQuestionStaticCtrl);
    wxASSERT(m_pAccountInformationStaticCtrl);
    wxASSERT(m_pAccountCreateCtrl);
    wxASSERT(m_pAccountUseExistingCtrl);
    wxASSERT(m_pAccountEmailAddressStaticCtrl);
    wxASSERT(m_pAccountEmailAddressCtrl);
    wxASSERT(m_pAccountUsernameStaticCtrl);
    wxASSERT(m_pAccountUsernameCtrl);
    wxASSERT(m_pAccountPasswordStaticCtrl);
    wxASSERT(m_pAccountPasswordCtrl);
    wxASSERT(m_pAccountConfirmPasswordStaticCtrl);
    wxASSERT(m_pAccountConfirmPasswordCtrl);
    wxASSERT(m_pAccountPasswordRequirmentsStaticCtrl);
    wxASSERT(m_pAccountManagerLinkLabelStaticCtrl);
    wxASSERT(m_pAccountForgotPasswordCtrl);
    wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
    wxASSERT(wxDynamicCast(pSkinWizardATAM, CSkinWizardATAM));


    // We are entering this page, so reterieve the previously used email
    // address and/or username.
    pConfig->SetPath(strBaseConfigLocation);
    m_strAccountEmailAddress = pConfig->Read(wxT("DefaultEmailAddress"));
    m_strAccountUsername = pConfig->Read(wxT("DefaultUsername"));

    // Setup the desired controls and default values.
    static bool bRunOnce = true;
    if (bRunOnce) {
        bRunOnce = false;
        if (!IS_ACCOUNTMANAGERWIZARD()) {
            m_pAccountCreateCtrl->SetValue(true);
            m_pAccountUseExistingCtrl->SetValue(false);
        }
    }

    if (IS_ACCOUNTMANAGERWIZARD()) {
        if (!(pWA->m_bCookieRequired && !pWA->m_bCredentialsDetected)) {
            m_pCookieDetectionFailedStaticCtrl->Hide();
            m_pCookieDetectionFailedCtrl->Hide();
        } else {
            m_pCookieDetectionFailedStaticCtrl->Show();
            m_pCookieDetectionFailedCtrl->Show();
        }

        m_pAccountQuestionStaticCtrl->Hide();
        m_pAccountCreateCtrl->SetValue(false);
        m_pAccountCreateCtrl->Hide();
        m_pAccountUseExistingCtrl->SetValue(true);
        m_pAccountUseExistingCtrl->Hide();
        m_pAccountConfirmPasswordStaticCtrl->Hide();
        m_pAccountConfirmPasswordCtrl->Hide();
        m_pAccountPasswordRequirmentsStaticCtrl->Hide();

        if (pWA->m_bCookieRequired && !pWA->m_bCredentialsDetected) {
            m_pAccountManagerLinkLabelStaticCtrl->Hide();
            m_pAccountForgotPasswordCtrl->Hide();
        }
    } else {
        m_pCookieDetectionFailedStaticCtrl->Hide();
        m_pCookieDetectionFailedCtrl->Hide();
        if (pc.account_creation_disabled || pc.client_account_creation_disabled) {
            m_pAccountCreateCtrl->SetValue(false);
            m_pAccountCreateCtrl->Hide();
            m_pAccountUseExistingCtrl->SetValue(true);
            m_pAccountUseExistingCtrl->Hide();
        } else {
            m_pAccountCreateCtrl->Show();
            m_pAccountCreateCtrl->Enable();
            m_pAccountUseExistingCtrl->Show();
        }
        m_pAccountManagerLinkLabelStaticCtrl->Hide();
    }

    wxString str;
    wxString name = wxString(pc.name.c_str(), wxConvUTF8);
    str.Printf(_("Identify your account at %s"), name.c_str());
    m_pTitleStaticCtrl->SetLabel(str);

    if (!IS_ACCOUNTMANAGERWIZARD() && !IS_ACCOUNTMANAGERUPDATEWIZARD()) {
		if (pc.client_account_creation_disabled) {
			m_pAccountQuestionStaticCtrl->SetLabel(
				_("Please enter your account information\n(to create an account, visit the project's web site)")
			);
		} else if (pc.account_creation_disabled) {
			m_pAccountQuestionStaticCtrl->SetLabel(
				_("This project is not currently accepting new accounts.\nYou can add it only if you already have an account.")
			);
		} else {
			m_pAccountQuestionStaticCtrl->SetLabel(
				_("Are you already running this project?")
			);
		}
        m_pAccountCreateCtrl->SetLabel(
            _("&No, new user")
        );
        m_pAccountUseExistingCtrl->SetLabel(
            _("&Yes, existing user")
        );
    } else {
        if (pWA->m_bCookieRequired && !pWA->m_bCredentialsDetected) {
            m_pCookieDetectionFailedStaticCtrl->SetLabel(
                _("We were not able to set up your account information\nautomatically.\n\nPlease click on the 'Find login information' link\nbelow to find out what to put in the email address and\npassword fields.")
            );
            m_pCookieDetectionFailedCtrl->SetLabel(
                _("Find login information")
            );
            m_pCookieDetectionFailedCtrl->SetURL(
                pWA->m_strCookieFailureURL
            );
        }

        if (pSkinAdvanced->IsBranded() && 
            !pSkinWizardATAM->GetAccountInfoMessage().IsEmpty()) {
            m_pAccountInformationStaticCtrl->SetLabel(
                pSkinWizardATAM->GetAccountInfoMessage()
            );
        }
    }

    if (m_pAccountUseExistingCtrl->GetValue()) {
        m_pAccountConfirmPasswordStaticCtrl->Hide();
        m_pAccountConfirmPasswordCtrl->Hide();
        m_pAccountPasswordRequirmentsStaticCtrl->Hide();
        m_pAccountPasswordStaticCtrl->SetLabel(
            _("&Password:"******"Choose a &password:"******"C&onfirm password:"******"Are you already running %s?"),
            pWA->GetProjectName().c_str()
        );
        m_pAccountQuestionStaticCtrl->SetLabel(strQuestion);
    }

    if (pc.uses_username) {
        if (IS_ACCOUNTMANAGERWIZARD()) {
            if (pSkinAdvanced->IsBranded() && 
                !pSkinWizardATAM->GetAccountInfoMessage().IsEmpty()) {
                m_pAccountInformationStaticCtrl->SetLabel(
                    pSkinWizardATAM->GetAccountInfoMessage()
                );
            }
        }

        m_pAccountEmailAddressCtrl->SetValidator( 
            wxTextValidator(wxFILTER_NONE, &m_strAccountEmailAddress)
        );
        m_pAccountUsernameCtrl->SetValidator(
            wxTextValidator(wxFILTER_ASCII, &m_strAccountUsername)
        );

        m_pAccountEmailAddressStaticCtrl->Hide();
        m_pAccountEmailAddressCtrl->Hide();
        m_pAccountUsernameStaticCtrl->Show();
        m_pAccountUsernameCtrl->Show();

        m_pAccountUsernameStaticCtrl->SetLabel(
            _("&Username:"******"&Email address:")
        );
        m_pAccountEmailAddressCtrl->SetValue(m_strAccountEmailAddress);
    }

    if (pc.min_passwd_length) {
        wxString str;
        str.Printf(_("minimum length %d"), pc.min_passwd_length);
        m_pAccountPasswordRequirmentsStaticCtrl->SetLabel( str );
    }


    if (!IS_ACCOUNTMANAGERWIZARD()) {
        m_pAccountForgotPasswordCtrl->SetLabel(
            _("Forgot your password?")
        );
        m_pAccountForgotPasswordCtrl->SetURL(
            wxString(pWA->m_ProjectInfoPage->GetProjectURL() + _T("get_passwd.php"))
        );
    } else {
        m_pAccountManagerLinkLabelStaticCtrl->SetLabel(
            _("If you have not yet registered with this account manager,\nplease do so before proceeding.  Click on the link below\nto register or to retrieve a forgotten password." )
        );
        m_pAccountForgotPasswordCtrl->SetLabel(
            _("Account manager website")
        );
        m_pAccountForgotPasswordCtrl->SetURL(
            wxString(pWA->m_AccountManagerInfoPage->GetProjectURL())
        );
    }

    if (pc.uses_username) {
        m_pAccountUsernameCtrl->SetFocus();
    } else {
        m_pAccountEmailAddressCtrl->SetFocus();
    }

    Fit();
}
Beispiel #19
0
void CAccountManagerInfoPage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;
    wxLogTrace(wxT("Function Start/End"), wxT("CAccountManagerInfoPage::OnPageChanged - Function Begin"));

    unsigned int      i;
    ALL_PROJECTS_LIST pl;
    CMainDocument*    pDoc = wxGetApp().GetDocument();

    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pDescriptionStaticCtrl);
    wxASSERT(m_pProjectDetailsStaticCtrl);
    wxASSERT(m_pProjectDetailsDescriptionCtrl);
    wxASSERT(m_pOpenWebSiteButton);
    wxASSERT(m_pProjectUrlStaticCtrl);
    wxASSERT(m_pProjectUrlCtrl);


    m_pTitleStaticCtrl->SetLabel(
        _("Choose an account manager")
    );
    m_pDescriptionStaticCtrl->SetLabel(
        _("To choose an account manager, click its name or \ntype its URL below.")
    );

    m_pProjectDetailsStaticCtrl->SetLabel(
        _("Account manager details:")
    );

    m_pProjectUrlStaticCtrl->SetLabel(
        _("Account manager &URL:")
    );

    m_pOpenWebSiteButton->SetLabel(
        _("Open web page")
    );

    m_pOpenWebSiteButton->SetToolTip( _("Visit this account manager's web site"));

    // Populate the list box with project information
    //
    if (!m_bAccountManagerListPopulated) {
        pDoc->rpc.get_all_projects_list(pl);
        for (i=0; i<pl.account_managers.size(); i++) {
            wxLogTrace(
                wxT("Function Status"),
                wxT("CAccountManagerInfoPage::OnPageChanged - Name: '%s', URL: '%s', Supported: '%d'"),
                wxString(pl.account_managers[i]->name.c_str(), wxConvUTF8).c_str(),
                wxString(pl.account_managers[i]->url.c_str(), wxConvUTF8).c_str(),
                true
            );

            CAcctMgrListItem* pItem = new CAcctMgrListItem();

            pItem->SetURL( pl.account_managers[i]->url.c_str() );
            pItem->SetName( pl.account_managers[i]->name.c_str() );
            pItem->SetImage( pl.account_managers[i]->image.c_str() );
            pItem->SetDescription( pl.account_managers[i]->description.c_str() );

            
            m_pProjectListCtrl->Append(
                wxString(pl.account_managers[i]->name.c_str(), wxConvUTF8),
                pItem
            );
        }

        // Pre select the first element
        if (m_pProjectListCtrl->GetCount()) {
            m_pProjectListCtrl->SetSelection(0);
            CAcctMgrListItem* pItem = (CAcctMgrListItem*)(m_pProjectListCtrl->GetClientData(0));
            SetProjectURL(pItem->GetURL());
            m_pProjectDetailsDescriptionCtrl->SetValue(pItem->GetDescription());
        }

        TransferDataToWindow();

        m_bAccountManagerListPopulated = true;
    }

    Layout();
    FitInside();
    m_pProjectListCtrl->SetFocus();

    wxLogTrace(wxT("Function Start/End"), wxT("CAccountManagerInfoPage::OnPageChanged - Function End"));
}
void CProjectInfoPage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;
    wxLogTrace(wxT("Function Start/End"), wxT("CProjectInfoPage::OnPageChanged - Function Begin"));

    unsigned int                i, j, k;
    bool                        bSupportedPlatformFound = false;
    bool                        bProjectSupportsNvidiaGPU = false;
    bool                        bProjectSupportsATIGPU = false;
    bool                        bProjectSupportsMulticore = false;
    ALL_PROJECTS_LIST           pl;
    CMainDocument*              pDoc = wxGetApp().GetDocument();

    wxASSERT(pDoc);
    wxASSERT(wxDynamicCast(pDoc, CMainDocument));
    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pDescriptionStaticCtrl);
    wxASSERT(m_pProjectListCtrl);
    wxASSERT(m_pProjectUrlStaticCtrl);
    wxASSERT(m_pProjectUrlCtrl);

    m_pTitleStaticCtrl->SetLabel(
        _("Choose a project")
    );
    m_pDescriptionStaticCtrl->SetLabel(
        _("To choose a project, click its name or type its URL below.")
    );
    m_pProjectUrlStaticCtrl->SetLabel(
        _("Project &URL:")
    );


    // Populate the virtual list control with project information
    //
    if (!m_bProjectListPopulated) {
        std::vector<std::string> &client_platforms = pDoc->state.platforms;
        pDoc->rpc.get_all_projects_list(pl);

        for (i=0; i<pl.projects.size(); i++) {
            bSupportedPlatformFound = false;
            bProjectSupportsNvidiaGPU = false;
            bProjectSupportsATIGPU = false;
            bProjectSupportsMulticore = false;

            wxLogTrace(
                wxT("Function Status"),
                wxT("CProjectInfoPage::OnPageChanged - Name: '%s', URL: '%s'"),
                wxString(pl.projects[i]->name.c_str(), wxConvUTF8).c_str(),
                wxString(pl.projects[i]->url.c_str(), wxConvUTF8).c_str()
            );

            std::vector<std::string> &project_platforms = pl.projects[i]->platforms;

            // Can the core client support a platform that this project
            //   supports?
            for (j = 0; j < client_platforms.size(); j++) {
                for (k = 0; k < project_platforms.size(); k++) {
                    wxString strClientPlatform = wxString(client_platforms[j].c_str(), wxConvUTF8);
                    wxString strProjectPlatform = wxString(project_platforms[k].c_str(), wxConvUTF8);
                    wxString strRootProjectPlatform = strProjectPlatform.SubString(0, strProjectPlatform.Find(_T("[")) - 1);

                    if (strProjectPlatform.Find(_T("[cuda")) != wxNOT_FOUND) {
                        if ((pDoc->state.have_cuda) && (strClientPlatform == strRootProjectPlatform)) {
                            bProjectSupportsNvidiaGPU = true;
                            bSupportedPlatformFound = true;
                        }
                    }

                    if (strProjectPlatform.Find(_T("[ati")) != wxNOT_FOUND) {
                        if ((pDoc->state.have_ati) && (strClientPlatform == strRootProjectPlatform)) {
                            bProjectSupportsATIGPU = true;
                            bSupportedPlatformFound = true;
                        }
                    }

                    if (strProjectPlatform.Find(_T("[mt")) != wxNOT_FOUND) {
                        if ((pDoc->host.p_ncpus >= 4) && (strClientPlatform == strRootProjectPlatform)) {
                            bProjectSupportsMulticore = true;
                            bSupportedPlatformFound = true;
                        }
                    }

                    if (strClientPlatform == strRootProjectPlatform) {
                        bSupportedPlatformFound = true;
                    }
                }
            }

            wxLogTrace(
                wxT("Function Status"),
                wxT("CProjectInfoPage::OnPageChanged - Nvidia: '%d', ATI: '%d', Multicore: '%d', Platform: '%d'"),
                bProjectSupportsNvidiaGPU,
                bProjectSupportsATIGPU,
                bProjectSupportsMulticore,
                bSupportedPlatformFound
            );

            m_pProjectListCtrl->Append(
                wxString(pl.projects[i]->url.c_str(), wxConvUTF8),
                wxString(pl.projects[i]->name.c_str(), wxConvUTF8),
                wxString(pl.projects[i]->image.c_str(), wxConvUTF8),
                wxString(pl.projects[i]->description.c_str(), wxConvUTF8),
                bProjectSupportsNvidiaGPU,
                bProjectSupportsATIGPU,
                bProjectSupportsMulticore,
                bSupportedPlatformFound
            );
        }

        // Pre select the first element
        if (m_pProjectListCtrl->GetItemCount()) {
            m_pProjectListCtrl->SetSelection(0);
            m_strProjectURL = m_pProjectListCtrl->GetItem(0)->GetURL();
            m_bProjectSupported = m_pProjectListCtrl->GetItem(0)->IsPlatformSupported();
        }

        TransferDataToWindow();

        m_bProjectListPopulated = true;
    }

    Layout();
    FitInside();
    m_pProjectListCtrl->SetFocus();

    wxLogTrace(wxT("Function Start/End"), wxT("CProjectInfoPage::OnPageChanged - Function End"));
}
void CAccountManagerInfoPage::OnPageChanging( wxWizardExEvent& event ) {
    event.Skip();
}
void CProjectInfoPage::OnPageChanging( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;
    wxLogTrace(wxT("Function Start/End"), wxT("CProjectInfoPage::OnPageChanging - Function Begin"));

    CMainDocument* pDoc = wxGetApp().GetDocument();
    CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
    wxString       strTitle;
    int            iAnswer;

    wxASSERT(pDoc);
    wxASSERT(wxDynamicCast(pDoc, CMainDocument));
    wxASSERT(pSkinAdvanced);
    wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));


    strTitle.Printf(
        wxT("%s"),
        pSkinAdvanced->GetApplicationName().c_str()
    );


    // Check to see if the project is supported:
    if ( !GetProjectSupported() ) {

        iAnswer = wxGetApp().SafeMessageBox(
                      _("This project may not have work for your type of computer.  Do you want to add it anyway?"),
                      strTitle,
                      wxCENTER | wxYES_NO | wxICON_INFORMATION
                  );

        // Project is not supported
        if (wxNO == iAnswer) {
            event.Veto();
        }

    } else {

        // Check if we are already attached to that project:
        for (int i = 0; i < pDoc->GetProjectCount(); ++i) {
            PROJECT* project = pDoc->project(i);
            if (project) {
                std::string project_url = project->master_url;
                std::string new_project_url = (const char*)m_strProjectURL.mb_str();

                canonicalize_master_url(project_url);
                canonicalize_master_url(new_project_url);

                if (project_url == new_project_url) {
                    wxGetApp().SafeMessageBox(
                        _("You already added this project. Please choose a different project."),
                        strTitle,
                        wxCENTER | wxICON_INFORMATION
                    );

                    // We are already attached to that project,
                    event.Veto();
                    break;
                }
            }
        }
    }

    wxLogTrace(wxT("Function Start/End"), wxT("CProjectInfoPage::OnPageChanging - Function End"));
}