2008-11-25 22:58:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "TermsOfUsePage.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
|
|
|
#include "diagnostics.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "mfile.h"
|
|
|
|
#include "miofile.h"
|
|
|
|
#include "parse.h"
|
|
|
|
#include "error_numbers.h"
|
|
|
|
#include "wizardex.h"
|
|
|
|
#include "error_numbers.h"
|
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "SkinManager.h"
|
|
|
|
#include "MainDocument.h"
|
|
|
|
#include "BOINCBaseWizard.h"
|
2010-08-02 16:01:09 +00:00
|
|
|
#include "WizardAttach.h"
|
2008-11-25 22:58:14 +00:00
|
|
|
#include "TermsOfUsePage.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CTermsOfUsePage type definition
|
|
|
|
*/
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS( CTermsOfUsePage, wxWizardPageEx )
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CTermsOfUsePage event table definition
|
|
|
|
*/
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE( CTermsOfUsePage, wxWizardPageEx )
|
|
|
|
|
|
|
|
////@begin CTermsOfUsePage event table entries
|
|
|
|
EVT_WIZARDEX_PAGE_CHANGED( -1, CTermsOfUsePage::OnPageChanged )
|
2009-06-19 16:30:08 +00:00
|
|
|
EVT_WIZARDEX_PAGE_CHANGING( -1, CTermsOfUsePage::OnPageChanging )
|
2008-11-25 22:58:14 +00:00
|
|
|
EVT_WIZARDEX_CANCEL( -1, CTermsOfUsePage::OnCancel )
|
2009-06-19 16:30:08 +00:00
|
|
|
EVT_RADIOBUTTON( ID_TERMSOFUSEAGREECTRL, CTermsOfUsePage::OnTermsOfUseStatusChange )
|
|
|
|
EVT_RADIOBUTTON( ID_TERMSOFUSEDISAGREECTRL, CTermsOfUsePage::OnTermsOfUseStatusChange )
|
2008-11-25 22:58:14 +00:00
|
|
|
////@end CTermsOfUsePage event table entries
|
|
|
|
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CTermsOfUsePage constructors
|
|
|
|
*/
|
|
|
|
|
|
|
|
CTermsOfUsePage::CTermsOfUsePage( )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CTermsOfUsePage::CTermsOfUsePage( CBOINCBaseWizard* parent )
|
|
|
|
{
|
|
|
|
Create( parent );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CTermsOfUsePage creator
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool CTermsOfUsePage::Create( CBOINCBaseWizard* parent )
|
|
|
|
{
|
|
|
|
////@begin CTermsOfUsePage member initialisation
|
|
|
|
m_pTitleStaticCtrl = NULL;
|
|
|
|
m_pDirectionsStaticCtrl = NULL;
|
|
|
|
m_pTermsOfUseCtrl = NULL;
|
|
|
|
m_pAgreeCtrl = NULL;
|
|
|
|
m_pDisagreeCtrl = NULL;
|
|
|
|
////@end CTermsOfUsePage member initialisation
|
2010-03-30 20:44:13 +00:00
|
|
|
m_bUserAgrees = false;
|
|
|
|
m_bCredentialsAlreadyAvailable = false;
|
|
|
|
|
2008-11-25 22:58:14 +00:00
|
|
|
////@begin CTermsOfUsePage creation
|
2009-11-17 19:19:50 +00:00
|
|
|
wxWizardPageEx::Create( parent, ID_TERMSOFUSEPAGE );
|
2008-11-25 22:58:14 +00:00
|
|
|
|
|
|
|
CreateControls();
|
|
|
|
GetSizer()->Fit(this);
|
|
|
|
////@end CTermsOfUsePage creation
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Control creation for CTermsOfUsePage
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CTermsOfUsePage::CreateControls()
|
|
|
|
{
|
|
|
|
////@begin CTermsOfUsePage content construction
|
|
|
|
CTermsOfUsePage* itemWizardPage96 = this;
|
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer97 = new wxBoxSizer(wxVERTICAL);
|
|
|
|
itemWizardPage96->SetSizer(itemBoxSizer97);
|
|
|
|
|
|
|
|
m_pTitleStaticCtrl = new wxStaticText;
|
|
|
|
m_pTitleStaticCtrl->Create( itemWizardPage96, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
m_pTitleStaticCtrl->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
|
|
|
|
itemBoxSizer97->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
|
|
|
|
|
|
|
|
itemBoxSizer97->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
|
|
|
|
|
|
|
|
m_pDirectionsStaticCtrl = new wxStaticText;
|
|
|
|
m_pDirectionsStaticCtrl->Create( itemWizardPage96, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemBoxSizer97->Add(m_pDirectionsStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
|
|
|
|
|
|
|
|
m_pTermsOfUseCtrl = new wxTextCtrl;
|
2008-11-26 01:54:48 +00:00
|
|
|
m_pTermsOfUseCtrl->Create( itemWizardPage96, ID_TERMSOFUSECTRL, wxEmptyString, wxDefaultPosition, wxSize(300, 125), wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH );
|
2008-11-25 22:58:14 +00:00
|
|
|
itemBoxSizer97->Add(m_pTermsOfUseCtrl, 0, wxGROW|wxALL, 5);
|
|
|
|
|
|
|
|
m_pAgreeCtrl = new wxRadioButton;
|
|
|
|
m_pAgreeCtrl->Create( itemWizardPage96, ID_TERMSOFUSEAGREECTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
m_pAgreeCtrl->SetValue(false);
|
|
|
|
itemBoxSizer97->Add(m_pAgreeCtrl, 0, wxALIGN_LEFT|wxALL, 5);
|
|
|
|
|
|
|
|
m_pDisagreeCtrl = new wxRadioButton;
|
|
|
|
m_pDisagreeCtrl->Create( itemWizardPage96, ID_TERMSOFUSEDISAGREECTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
m_pDisagreeCtrl->SetValue(true);
|
|
|
|
itemBoxSizer97->Add(m_pDisagreeCtrl, 0, wxALIGN_LEFT|wxALL, 5);
|
|
|
|
|
|
|
|
////@end CTermsOfUsePage content construction
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Gets the previous page.
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxWizardPageEx* CTermsOfUsePage::GetPrev() const
|
|
|
|
{
|
|
|
|
return PAGE_TRANSITION_BACK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Gets the next page.
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxWizardPageEx* CTermsOfUsePage::GetNext() const
|
|
|
|
{
|
|
|
|
if (CHECK_CLOSINGINPROGRESS()) {
|
|
|
|
// Cancel Event Detected
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE);
|
2009-06-19 16:30:08 +00:00
|
|
|
} else if (IS_ATTACHTOPROJECTWIZARD() && GetUserAgrees() && GetCredentialsAlreadyAvailable()) {
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_PROJECTPROCESSINGPAGE);
|
|
|
|
} else if (IS_ACCOUNTMANAGERWIZARD() && GetUserAgrees() && GetCredentialsAlreadyAvailable()) {
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_ACCOUNTMANAGERPROCESSINGPAGE);
|
2008-11-25 22:58:14 +00:00
|
|
|
} else if (GetUserAgrees()) {
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_ACCOUNTINFOPAGE);
|
|
|
|
} else {
|
2011-03-29 19:28:27 +00:00
|
|
|
return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE);
|
2008-11-25 22:58:14 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Should we show tooltips?
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool CTermsOfUsePage::ShowToolTips()
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Get bitmap resources
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxBitmap CTermsOfUsePage::GetBitmapResource( const wxString& WXUNUSED(name) )
|
|
|
|
{
|
|
|
|
// Bitmap retrieval
|
|
|
|
|
|
|
|
////@begin CTermsOfUsePage bitmap retrieval
|
|
|
|
return wxNullBitmap;
|
|
|
|
////@end CTermsOfUsePage bitmap retrieval
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Get icon resources
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxIcon CTermsOfUsePage::GetIconResource( const wxString& WXUNUSED(name) )
|
|
|
|
{
|
|
|
|
// Icon retrieval
|
|
|
|
|
|
|
|
////@begin CTermsOfUsePage icon retrieval
|
|
|
|
return wxNullIcon;
|
|
|
|
////@end CTermsOfUsePage icon retrieval
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_WIZARD_PAGE_CHANGED event handler for ID_TERMSOFUSEPAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CTermsOfUsePage::OnPageChanged( wxWizardExEvent& event ) {
|
|
|
|
if (event.GetDirection() == false) return;
|
|
|
|
|
2010-08-02 16:01:09 +00:00
|
|
|
PROJECT_CONFIG& pc = ((CWizardAttach*)GetParent())->project_config;
|
2008-11-25 22:58:14 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
);
|
2008-12-09 15:25:47 +00:00
|
|
|
m_pTermsOfUseCtrl->SetSelection(0,0);
|
2008-11-25 22:58:14 +00:00
|
|
|
|
|
|
|
m_pAgreeCtrl->SetLabel(
|
|
|
|
_("I agree to the terms of use.")
|
|
|
|
);
|
2008-12-09 15:25:47 +00:00
|
|
|
m_pAgreeCtrl->SetValue(false);
|
|
|
|
|
2008-11-25 22:58:14 +00:00
|
|
|
|
|
|
|
m_pDisagreeCtrl->SetLabel(
|
2008-12-09 15:25:47 +00:00
|
|
|
_("I do not agree with the terms of use.")
|
2008-11-25 22:58:14 +00:00
|
|
|
);
|
2008-12-09 15:25:47 +00:00
|
|
|
m_pDisagreeCtrl->SetValue(true);
|
2011-03-29 19:28:27 +00:00
|
|
|
|
2008-12-09 15:25:47 +00:00
|
|
|
SetUserAgrees(false);
|
2011-03-29 19:28:27 +00:00
|
|
|
((CWizardAttach*)GetParent())->DisableNextButton();
|
|
|
|
|
2008-11-25 22:58:14 +00:00
|
|
|
|
|
|
|
Fit();
|
|
|
|
}
|
|
|
|
|
2009-06-19 16:30:08 +00:00
|
|
|
/*!
|
|
|
|
* wxEVT_WIZARD_PAGE_CHANGING event handler for ID_TERMSOFUSEPAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CTermsOfUsePage::OnPageChanging( wxWizardExEvent& event ) {
|
2010-08-02 16:01:09 +00:00
|
|
|
CWizardAttach* pWA = ((CWizardAttach*)GetParent());
|
2009-06-19 16:30:08 +00:00
|
|
|
|
2010-08-02 16:01:09 +00:00
|
|
|
wxASSERT(pWA);
|
|
|
|
wxASSERT(wxDynamicCast(pWA, CWizardAttach));
|
2009-06-19 16:30:08 +00:00
|
|
|
|
2011-04-13 16:32:58 +00:00
|
|
|
// 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;
|
2009-06-19 16:30:08 +00:00
|
|
|
|
|
|
|
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.
|
2010-08-02 16:01:09 +00:00
|
|
|
if ( pWA->m_bCredentialsCached || pWA->m_bCredentialsDetected) {
|
2009-06-19 16:30:08 +00:00
|
|
|
SetCredentialsAlreadyAvailable(true);
|
|
|
|
} else {
|
|
|
|
SetCredentialsAlreadyAvailable(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-25 22:58:14 +00:00
|
|
|
/*!
|
|
|
|
* wxEVT_WIZARD_CANCEL event handler for ID_TERMSOFUSEPAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CTermsOfUsePage::OnCancel( wxWizardExEvent& event ) {
|
|
|
|
PROCESS_CANCELEVENT(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_TERMSOFUSEAGREECTRL
|
2009-06-19 16:30:08 +00:00
|
|
|
* or ID_TERMSOFUSEDISAGREECTRL
|
2008-11-25 22:58:14 +00:00
|
|
|
*/
|
|
|
|
|
2009-06-19 16:30:08 +00:00
|
|
|
void CTermsOfUsePage::OnTermsOfUseStatusChange( wxCommandEvent& event ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CTermsOfUsePage::OnTermsOfUseStatusChange - Function Begin"));
|
|
|
|
|
|
|
|
if ((ID_TERMSOFUSEAGREECTRL == event.GetId()) && event.IsChecked()){
|
|
|
|
wxLogTrace(wxT("Function Status"), wxT("CTermsOfUsePage::OnTermsOfUseStatusChange - SetUserAgrees(true)"));
|
|
|
|
SetUserAgrees(true);
|
2011-03-29 19:28:27 +00:00
|
|
|
((CWizardAttach*)GetParent())->EnableNextButton();
|
2009-06-19 16:30:08 +00:00
|
|
|
} else {
|
|
|
|
wxLogTrace(wxT("Function Status"), wxT("CTermsOfUsePage::OnTermsOfUseStatusChange - SetUserAgrees(false)"));
|
2010-03-30 20:44:13 +00:00
|
|
|
SetUserAgrees(false);
|
2011-03-29 19:28:27 +00:00
|
|
|
((CWizardAttach*)GetParent())->DisableNextButton();
|
2008-12-09 15:25:47 +00:00
|
|
|
}
|
2008-11-25 22:58:14 +00:00
|
|
|
|
2009-06-19 16:30:08 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CTermsOfUsePage::OnTermsOfUseStatusChange - Function End"));
|
2008-11-25 22:58:14 +00:00
|
|
|
}
|