diff --git a/checkin_notes b/checkin_notes index e6c0c0eef7..1ac269ec00 100755 --- a/checkin_notes +++ b/checkin_notes @@ -685,3 +685,20 @@ David 17 Jan 2007 ViewWork.cpp ViewWorkGrid.cpp sg_ViewTabPage.cpp + +David 17 Jan 2007 + - core client: reset 5-minute timer for network activity + is user explicitly changes network mode + - Manager: initial checkin of Advanced Prefs dialog + (from Frank Weiler) + + client/ + gui_rpc_server_ops.C + clientgui/ + AdvancedFrame.cpp,h + DlgAdvPreferences.cpp,h + DlgAdvPreferencesBase.cpp,h + Events.h + sg_ViewTabPage.cpp + win_build/ + boincmgr_curl.vcproj diff --git a/client/gui_rpc_server_ops.C b/client/gui_rpc_server_ops.C index 7a98558a5d..457f18199c 100644 --- a/client/gui_rpc_server_ops.C +++ b/client/gui_rpc_server_ops.C @@ -301,6 +301,11 @@ static void handle_set_network_mode(char* buf, MIOFILE& fout) { fout.printf("Missing mode\n"); return; } + // user is turning network on/off explicitly, + // so disable the "5 minute grace period" mechanism + // + gstate.gui_rpcs.time_of_last_rpc_needing_network = 0; + gstate.network_mode.set(mode, duration); fout.printf("\n"); } diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp index ea9967ab17..b9608dd0cd 100644 --- a/clientgui/AdvancedFrame.cpp +++ b/clientgui/AdvancedFrame.cpp @@ -58,6 +58,7 @@ #include "BOINCBaseWizard.h" #include "WizardAttachProject.h" #include "WizardAccountManager.h" +#include "DlgAdvPreferences.h" #ifdef __WXMAC__ #include "mac/MacGUI.pch" #endif @@ -174,6 +175,7 @@ BEGIN_EVENT_TABLE (CAdvancedFrame, CBOINCBaseFrame) EVT_MENU(ID_PROJECTSATTACHPROJECT, CAdvancedFrame::OnProjectsAttachToProject) EVT_MENU(ID_COMMANDSRETRYCOMMUNICATIONS, CAdvancedFrame::OnCommandsRetryCommunications) EVT_MENU(ID_OPTIONSOPTIONS, CAdvancedFrame::OnOptionsOptions) + EVT_MENU(ID_ADVPREFSDLG, CAdvancedFrame::OnDlgPreferences) EVT_HELP(wxID_ANY, CAdvancedFrame::OnHelp) EVT_MENU(ID_HELPBOINCMANAGER, CAdvancedFrame::OnHelpBOINCManager) EVT_MENU(ID_HELPBOINC, CAdvancedFrame::OnHelpBOINCWebsite) @@ -415,6 +417,12 @@ bool CAdvancedFrame::CreateMenu() { _("&Options..."), _("Configure GUI options and proxy settings") ); + menuAdvanced->Append( + ID_ADVPREFSDLG, + _("&Preferences..."), + _("Configure local preferences") + ); + // %s is the project name // i.e. 'BOINC', 'GridRepublic' strMenuDescription.Printf( @@ -1268,6 +1276,13 @@ void CAdvancedFrame::OnCommandsRetryCommunications( wxCommandEvent& WXUNUSED(eve } +void CAdvancedFrame::OnDlgPreferences(wxCommandEvent& WXUNUSED(event)) { + wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnDlgPreferences - Function Begin")); + CDlgAdvPreferences dlg(this); + dlg.ShowModal(); + wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnDlgPreferences - Function End")); +} + void CAdvancedFrame::OnOptionsOptions(wxCommandEvent& WXUNUSED(event)) { wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnOptionsOptions - Function Begin")); diff --git a/clientgui/AdvancedFrame.h b/clientgui/AdvancedFrame.h index c6856ae95b..bb6dc1bcd7 100644 --- a/clientgui/AdvancedFrame.h +++ b/clientgui/AdvancedFrame.h @@ -72,6 +72,7 @@ public: void OnProjectsAttachToProject( wxCommandEvent& event ); void OnOptionsOptions( wxCommandEvent& event ); + void OnDlgPreferences( wxCommandEvent& event ); void OnHelp( wxHelpEvent& event ); void OnHelpBOINCManager( wxCommandEvent& event ); diff --git a/clientgui/DlgAdvPreferences.cpp b/clientgui/DlgAdvPreferences.cpp new file mode 100644 index 0000000000..28a16a74c4 --- /dev/null +++ b/clientgui/DlgAdvPreferences.cpp @@ -0,0 +1,705 @@ +// Berkeley Open Infrastructure for Network Computing +// http://boinc.berkeley.edu +// Copyright (C) 2005 University of California +// +// This 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 2.1 of the License, or (at your option) any later version. +// +// This software 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. +// +// To view the GNU Lesser General Public License visit +// http://www.gnu.org/copyleft/lesser.html +// or write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma implementation "DlgAdvPreferences.h" +#endif + +#include "stdwx.h" +#include "DlgAdvPreferences.h" +#include "res/usage.xpm" +#include "res/xfer.xpm" +#include "res/proj.xpm" +#include "BOINCGUIApp.h" +#include "MainDocument.h" +#include "SkinManager.h" +#include "hyperlink.h" + +IMPLEMENT_DYNAMIC_CLASS(CDlgAdvPreferences, wxDialog) + +BEGIN_EVENT_TABLE(CDlgAdvPreferences, wxDialog) + EVT_COMMAND_RANGE(20000,21000,wxEVT_COMMAND_CHECKBOX_CLICKED,CDlgAdvPreferences::OnHandleCommandEvent) + EVT_COMMAND_RANGE(20000,21000,wxEVT_COMMAND_RADIOBUTTON_SELECTED,CDlgAdvPreferences::OnHandleCommandEvent) + EVT_COMMAND_RANGE(20000,21000,wxEVT_COMMAND_TEXT_UPDATED,CDlgAdvPreferences::OnHandleCommandEvent) + //buttons + EVT_BUTTON(wxID_OK,CDlgAdvPreferences::OnOK) + EVT_BUTTON(wxID_HELP,CDlgAdvPreferences::OnHelp) +END_EVENT_TABLE() + +/* Constructor */ +CDlgAdvPreferences::CDlgAdvPreferences(wxWindow* parent) : CDlgAdvPreferencesBase(parent) { + m_bInInit=false; + m_bDataChanged=false; + m_arrTabPageIds.Add(ID_TABPAGE_PROC); + m_arrTabPageIds.Add(ID_TABPAGE_NET); + m_arrTabPageIds.Add(ID_TABPAGE_DISK); + + //setting tab page images (not handled by generated code) + int iImageIndex = 0; + wxImageList* pImageList = m_Notebook->GetImageList(); + if (!pImageList) { + pImageList = new wxImageList(16, 16, true, 0); + wxASSERT(pImageList != NULL); + m_Notebook->SetImageList(pImageList); + } + iImageIndex = pImageList->Add(wxBitmap(proj_xpm)); + m_Notebook->SetPageImage(0,iImageIndex); + + iImageIndex = pImageList->Add(wxBitmap(xfer_xpm)); + m_Notebook->SetPageImage(1,iImageIndex); + + iImageIndex = pImageList->Add(wxBitmap(usage_xpm)); + m_Notebook->SetPageImage(2,iImageIndex); + // init special tooltips + SetSpecialTooltips(); + //setting the validators for correct input handling + SetValidators(); + //read in settings and initialisze controls + ReadPreferenceSettings(); + // + RestoreState(); +} + +/* destructor */ +CDlgAdvPreferences::~CDlgAdvPreferences() { + SaveState(); +} + +/* set validators for input filtering purposes only */ +void CDlgAdvPreferences::SetValidators() { + //proc page + m_txtProcIdleFor->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txtProcSwitchEvery->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txtProcUseProcessors->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txtProcUseCPUTime->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + //net page + m_txtNetConnectInterval->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txtNetDownloadRate->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txtNetUploadRate->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + //disk and memory page + m_txtDiskMaxSpace->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txtDiskLeastFree->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txtDiskMaxOfTotal->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txtDiskWriteToDisk->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txtDiskMaxSwap->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txtMemoryMaxInUse->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txtMemoryMaxOnIdle->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); +} + +/* some controls share the same tooltip, set them here */ +void CDlgAdvPreferences::SetSpecialTooltips() { + m_txtProcMonday->SetToolTip(TXT_PROC_TIME_TOOLTIP); + m_txtProcTuesday->SetToolTip(TXT_PROC_TIME_TOOLTIP); + m_txtProcWednesday->SetToolTip(TXT_PROC_TIME_TOOLTIP); + m_txtProcThursday->SetToolTip(TXT_PROC_TIME_TOOLTIP); + m_txtProcFriday->SetToolTip(TXT_PROC_TIME_TOOLTIP); + m_txtProcSaturday->SetToolTip(TXT_PROC_TIME_TOOLTIP); + m_txtProcSunday->SetToolTip(TXT_PROC_TIME_TOOLTIP); + // + m_txtNetMonday->SetToolTip(TXT_NET_TIME_TOOLTIP); + m_txtNetTuesday->SetToolTip(TXT_NET_TIME_TOOLTIP); + m_txtNetWednesday->SetToolTip(TXT_NET_TIME_TOOLTIP); + m_txtNetThursday->SetToolTip(TXT_NET_TIME_TOOLTIP); + m_txtNetFriday->SetToolTip(TXT_NET_TIME_TOOLTIP); + m_txtNetSaturday->SetToolTip(TXT_NET_TIME_TOOLTIP); + m_txtNetSunday->SetToolTip(TXT_NET_TIME_TOOLTIP); +} + +/* saves selected tab page */ +bool CDlgAdvPreferences::SaveState() { + wxString strBaseConfigLocation = wxString(wxT("/DlgAdvPreferences/")); + wxConfigBase* pConfig = wxConfigBase::Get(FALSE); + + wxASSERT(pConfig); + if (!pConfig) return false; + + pConfig->SetPath(strBaseConfigLocation); + pConfig->Write(wxT("CurrentPage"),m_Notebook->GetSelection()); + return true; +} + +/* restores former selected tab page */ +bool CDlgAdvPreferences::RestoreState() { + wxString strBaseConfigLocation = wxString(wxT("/DlgAdvPreferences/")); + wxConfigBase* pConfig = wxConfigBase::Get(FALSE); + int iCurrentPage; + + wxASSERT(pConfig); + + if (!pConfig) return false; + + pConfig->SetPath(strBaseConfigLocation); + + pConfig->Read(wxT("CurrentPage"), &iCurrentPage,0); + m_Notebook->SetSelection(iCurrentPage); + + return true; +} + +/* read preferences from core client and initialize control values */ +void CDlgAdvPreferences::ReadPreferenceSettings() { + m_bInInit=true;//prevent dialog handlers from doing anything + CMainDocument* pDoc = wxGetApp().GetDocument(); + wxString buffer; + + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + + //get currently global prefs from core client + prefs = pDoc->state.global_prefs; + + //override the global prefs with values in global_prefs_override.xml, if this file exists + //mask.clear(); + //pDoc->rpc.get_global_prefs_override_struct(prefs, mask); + + // ######### proc usage page + // do work between + m_rbtProcEveryDay->SetValue(true); + buffer.Printf(wxT("%02d:00"),prefs.start_hour); + *m_txtProcEveryDayStart << buffer; + buffer.Printf(wxT("%02d:00"),prefs.end_hour); + *m_txtProcEveryDayStop << buffer; + // on batteries + m_chkProcOnBatteries->SetValue(prefs.run_on_batteries); + // in use + m_chkProcInUse->SetValue(prefs.run_if_user_active); + // idle for X minutes + buffer.Printf(wxT("%.2f"),prefs.idle_time_to_run); + *m_txtProcIdleFor << buffer; + // siwtch every X minutes + buffer.Printf(wxT("%.2f"),prefs.cpu_scheduling_period_minutes); + *m_txtProcSwitchEvery << buffer; + // max cpus + buffer.Printf(wxT("%d"),prefs.max_cpus); + *m_txtProcUseProcessors << buffer; + //cpu limit + buffer.Printf(wxT("%.2f"),prefs.cpu_usage_limit); + *m_txtProcUseCPUTime << buffer; + + // ######### net usage page + // use network between + m_rbtNetEveryDay->SetValue(true); + buffer.Printf(wxT("%02d:00"),prefs.net_start_hour); + *m_txtNetEveryDayStart << buffer; + buffer.Printf(wxT("%02d:00"),prefs.net_end_hour); + *m_txtNetEveryDayStop << buffer; + // connection interval + buffer.Printf(wxT("%01.4f"),prefs.work_buf_min_days); + *m_txtNetConnectInterval << buffer; + //download rate + buffer.Printf(wxT("%.2f"),prefs.max_bytes_sec_down / 1024); + *m_txtNetDownloadRate << buffer; + // upload rate + buffer.Printf(wxT("%.2f"),prefs.max_bytes_sec_up / 1024); + *m_txtNetUploadRate << buffer; + // skip image verification + m_chkNetSkipImageVerification->SetValue(prefs.dont_verify_images); + // confirm before connect + m_chkNetConfirmBeforeConnect->SetValue(prefs.confirm_before_connecting); + // disconnect when done + m_chkNetDisconnectWhenDone->SetValue(prefs.hangup_if_dialed); + + // ######### disk and memory usage page + //max space used + buffer.Printf(wxT("%.2f"),prefs.disk_max_used_gb); + *m_txtDiskMaxSpace << buffer; + // min free + buffer.Printf(wxT("%.2f"),prefs.disk_min_free_gb); + *m_txtDiskLeastFree << buffer; + // max used percentage + buffer.Printf(wxT("%.2f"),prefs.disk_max_used_pct); + *m_txtDiskMaxOfTotal << buffer; + // write to disk every X seconds + buffer.Printf(wxT("%.0f"),prefs.disk_interval); + *m_txtDiskWriteToDisk << buffer; + // max swap space (virtual memory) + buffer.Printf(wxT("%.2f"),prefs.vm_max_used_frac*100.0); + *m_txtDiskMaxSwap << buffer; + // max VM used + buffer.Printf(wxT("%.2f"),prefs.ram_max_used_busy_frac*100.0); + *m_txtMemoryMaxInUse << buffer; + // max VM idle + buffer.Printf(wxT("%.2f"),prefs.ram_max_used_idle_frac*100.0); + *m_txtMemoryMaxOnIdle << buffer; + // suspend to memory + m_chkMemoryWhileSuspended->SetValue(prefs.leave_apps_in_memory); + m_bInInit=false; + //update control states + this->UpdateControlStates(); +} + +/* write overridden preferences to disk (global_prefs_override.xml) */ +bool CDlgAdvPreferences::SavePreferencesSettings() { + bool ret=false; + //check if something changed + if(m_bDataChanged) { + double td; + long tl; + mask.clear(); + //something was changed, take a closer look if and what exactly has changed + //proc page + if(m_chkProcOnBatteries->GetValue()!= prefs.run_on_batteries) { + ret=true; + prefs.run_on_batteries=m_chkProcOnBatteries->GetValue(); + mask.run_on_batteries=true; + } + // + if(m_chkProcInUse->GetValue()!= prefs.run_if_user_active) { + ret=true; + prefs.run_if_user_active=m_chkProcInUse->GetValue(); + mask.run_if_user_active=true; + } + // + if(m_txtProcIdleFor->IsEnabled()) { + m_txtProcIdleFor->GetValue().ToLong(&tl); + if(tl!=prefs.idle_time_to_run) { + ret=true; + prefs.idle_time_to_run=tl; + mask.idle_time_to_run=true; + } + } + // + if(m_txtProcEveryDayStart->IsEnabled()) { + m_txtProcEveryDayStart->GetValue().ToLong(&tl); + if(tl != prefs.start_hour) { + ret=true; + prefs.start_hour=tl; + mask.start_hour = true; + } + } + // + if(m_txtProcEveryDayStop->IsEnabled()) { + m_txtProcEveryDayStop->GetValue().ToLong(&tl); + if(tl != prefs.end_hour) { + ret=true; + prefs.end_hour=tl; + mask.end_hour = true; + } + } + // + m_txtProcSwitchEvery->GetValue().ToDouble(&td); + if(td!=prefs.cpu_scheduling_period_minutes) { + ret=true; + prefs.cpu_scheduling_period_minutes=td; + mask.cpu_scheduling_period_minutes=true; + } + // + m_txtProcUseProcessors->GetValue().ToLong(&tl); + if(tl!=prefs.max_cpus) { + ret=true; + prefs.max_cpus=tl;; + mask.max_cpus=true; + } + // + m_txtProcUseCPUTime->GetValue().ToDouble(&td); + if(td!=prefs.cpu_usage_limit) { + ret=true; + prefs.cpu_usage_limit=td; + mask.cpu_usage_limit=true; + } + // network page + m_txtNetConnectInterval->GetValue().ToDouble(&td); + if(td!=prefs.work_buf_min_days) { + ret=true; + prefs.work_buf_min_days=td; + mask.work_buf_min_days=true; + } + // + m_txtNetDownloadRate->GetValue().ToDouble(&td); + td = td * 1024; + if(td != prefs.max_bytes_sec_down) { + ret=true; + prefs.max_bytes_sec_down=td; + mask.max_bytes_sec_down=true; + } + // + m_txtNetUploadRate->GetValue().ToDouble(&td); + td = td * 1024; + if(td != prefs.max_bytes_sec_up) { + ret=true; + prefs.max_bytes_sec_up=td; + mask.max_bytes_sec_up=true; + } + // + if(m_chkNetSkipImageVerification->GetValue() != prefs.dont_verify_images) { + ret=true; + prefs.dont_verify_images=m_chkNetSkipImageVerification->GetValue(); + mask.dont_verify_images=true; + } + // + if(m_chkNetConfirmBeforeConnect->GetValue() != prefs.confirm_before_connecting) { + ret=true; + prefs.confirm_before_connecting= m_chkNetConfirmBeforeConnect->GetValue(); + mask.confirm_before_connecting=true; + } + // + if(m_chkNetDisconnectWhenDone->GetValue() != prefs.hangup_if_dialed) { + ret=true; + prefs.hangup_if_dialed= m_chkNetDisconnectWhenDone->GetValue(); + mask.hangup_if_dialed=true; + } + // + if(m_txtNetEveryDayStart->IsEnabled()) { + m_txtNetEveryDayStart->GetValue().ToLong(&tl); + if(tl != prefs.net_start_hour) { + ret=true; + prefs.net_start_hour=tl; + mask.net_start_hour = true; + } + } + // + if(m_txtNetEveryDayStop->IsEnabled()) { + m_txtNetEveryDayStop->GetValue().ToLong(&tl); + if(tl != prefs.net_end_hour) { + ret=true; + prefs.net_end_hour=tl; + mask.net_end_hour = true; + } + } + //disk usage + m_txtDiskMaxSpace->GetValue().ToDouble(&td); + if(td != prefs.disk_max_used_gb) { + ret=true; + prefs.disk_max_used_gb=td; + mask.disk_max_used_gb=true; + } + // + m_txtDiskLeastFree->GetValue().ToDouble(&td); + if(td != prefs.disk_min_free_gb) { + ret=true; + prefs.disk_min_free_gb=td; + mask.disk_min_free_gb=true; + } + // + m_txtDiskMaxOfTotal->GetValue().ToDouble(&td); + if(td != prefs.disk_max_used_pct) { + ret=true; + prefs.disk_max_used_pct=td; + mask.disk_max_used_pct=true; + } + // + m_txtDiskWriteToDisk->GetValue().ToDouble(&td); + if(td != prefs.disk_interval) { + ret=true; + prefs.disk_interval=td; + mask.disk_interval=true; + } + // + m_txtDiskMaxSwap->GetValue().ToDouble(&td); + td = td / 100.0 ; + if(td != prefs.vm_max_used_frac) { + ret=true; + prefs.vm_max_used_frac=td; + mask.vm_max_used_frac=true; + } + //Memory + m_txtMemoryMaxInUse->GetValue().ToDouble(&td); + td = td / 100.0; + if(td != prefs.ram_max_used_busy_frac) { + ret=true; + prefs.ram_max_used_busy_frac=td; + mask.ram_max_used_busy_frac=true; + } + // + m_txtMemoryMaxOnIdle->GetValue().ToDouble(&td); + td = td / 100.0; + if(td != prefs.ram_max_used_idle_frac) { + ret=true; + prefs.ram_max_used_idle_frac=td; + mask.ram_max_used_idle_frac=true; + } + // + if(m_chkMemoryWhileSuspended->GetValue() != prefs.leave_apps_in_memory) { + ret = true; + prefs.leave_apps_in_memory = m_chkMemoryWhileSuspended->GetValue(); + mask.leave_apps_in_memory=true; + } + } + return ret; +} + +/* set state of control depending on other control's state */ +void CDlgAdvPreferences::UpdateControlStates() { + //proc usage page + if(m_rbtProcEveryDay->GetValue()) { + m_panelProcSpecialTimes->Disable(); + m_txtProcEveryDayStart->Enable(); + m_txtProcEveryDayStop->Enable(); + } + else { + m_panelProcSpecialTimes->Enable(); + m_txtProcEveryDayStart->Disable(); + m_txtProcEveryDayStop->Disable(); + } + m_txtProcIdleFor->Enable(!m_chkProcInUse->IsChecked()); + m_txtProcMonday->Enable(m_chkProcMonday->IsChecked()); + m_txtProcTuesday->Enable(m_chkProcTuesday->IsChecked()); + m_txtProcWednesday->Enable(m_chkProcWednesday->IsChecked()); + m_txtProcThursday->Enable(m_chkProcThursday->IsChecked()); + m_txtProcFriday->Enable(m_chkProcFriday->IsChecked()); + m_txtProcSaturday->Enable(m_chkProcSaturday->IsChecked()); + m_txtProcSunday->Enable(m_chkProcSunday->IsChecked()); + + //net usage page + if(m_rbtNetEveryDay->GetValue()) { + m_panelNetSpecialTimes->Disable(); + m_txtNetEveryDayStart->Enable(); + m_txtNetEveryDayStop->Enable(); + } + else { + m_panelNetSpecialTimes->Enable(); + m_txtNetEveryDayStart->Disable(); + m_txtNetEveryDayStop->Disable(); + } + m_txtNetMonday->Enable(m_chkNetMonday->IsChecked()); + m_txtNetTuesday->Enable(m_chkNetTuesday->IsChecked()); + m_txtNetWednesday->Enable(m_chkNetWednesday->IsChecked()); + m_txtNetThursday->Enable(m_chkNetThursday->IsChecked()); + m_txtNetFriday->Enable(m_chkNetFriday->IsChecked()); + m_txtNetSaturday->Enable(m_chkNetSaturday->IsChecked()); + m_txtNetSunday->Enable(m_chkNetSunday->IsChecked()); +} + +/* validates the entered informations */ +bool CDlgAdvPreferences::ValidateInput() { + wxString buffer; + //proc page + if(m_txtProcIdleFor->IsEnabled()) { + buffer = m_txtProcIdleFor->GetValue(); + if(!IsValidFloatValue(buffer)) { + ShowErrorMessage(m_txtProcIdleFor); + return false; + } + } + if(m_txtProcEveryDayStart->IsEnabled()) { + buffer = m_txtProcEveryDayStart->GetValue(); + if(!IsValidTimeValue(buffer)) { + ShowErrorMessage(m_txtProcEveryDayStart); + return false; + } + } + if(m_txtProcEveryDayStop->IsEnabled()) { + buffer = m_txtProcEveryDayStop->GetValue(); + if(!IsValidTimeValue(buffer)) { + ShowErrorMessage(m_txtProcEveryDayStop); + return false; + } + } + //all text ctrls in proc special time panel + if(m_panelProcSpecialTimes->IsEnabled()) { + wxWindowList children = m_panelProcSpecialTimes->GetChildren(); + wxWindowListNode* node = children.GetFirst(); + while(node) { + if(node->GetData()->IsKindOf(CLASSINFO(wxTextCtrl))) { + wxTextCtrl* txt = wxDynamicCast(node->GetData(),wxTextCtrl); + if(txt) { + if(txt->IsEnabled()) { + buffer = txt->GetValue(); + if(!IsValidTimeIntervalValue(buffer)) { + ShowErrorMessage(txt); + return false; + } + } + } + } + node = node->GetNext(); + } + } + //net page + if(m_txtNetEveryDayStart->IsEnabled()) { + buffer = m_txtNetEveryDayStart->GetValue(); + if(!IsValidTimeValue(buffer)) { + ShowErrorMessage(m_txtNetEveryDayStart); + return false; + } + } + if(m_txtNetEveryDayStop->IsEnabled()) { + buffer = m_txtNetEveryDayStop->GetValue(); + if(!IsValidTimeValue(buffer)) { + ShowErrorMessage(m_txtNetEveryDayStop); + return false; + } + } + //all text ctrls in net special time panel + if(m_panelNetSpecialTimes->IsEnabled()) { + wxWindowList children = m_panelNetSpecialTimes->GetChildren(); + wxWindowListNode* node = children.GetFirst(); + while(node) { + if(node->GetData()->IsKindOf(CLASSINFO(wxTextCtrl))) { + wxTextCtrl* txt = wxDynamicCast(node->GetData(),wxTextCtrl); + if(txt) { + if(txt->IsEnabled()) { + buffer = txt->GetValue(); + if(!IsValidTimeIntervalValue(buffer)) { + ShowErrorMessage(txt); + return false; + } + }//if(txt->IsEnabled()) + }//if(txt) + }//if(node->GetData() + node = node->GetNext(); + } + } + + return true; +} + +/* ensures that the page whioch contains txtCtrl is selected */ +bool CDlgAdvPreferences::EnsureTabPageVisible(wxTextCtrl* txtCtrl) { + wxWindow* parent = txtCtrl->GetParent(); + wxASSERT(parent); + int parentid = parent->GetId(); + int index = m_arrTabPageIds.Index(parentid); + if(index == wxNOT_FOUND) { + //some controls are containe din a additional panel, so look at its parent + parent = parent->GetParent(); + wxASSERT(parent); + parentid = parent->GetId(); + index = m_arrTabPageIds.Index(parentid); + if(index == wxNOT_FOUND) { + //this should never happen + return false; + } + } + m_Notebook->SetSelection(index); + return true; +} + +/* show an error message and set the focus to the control that caused the error */ +void CDlgAdvPreferences::ShowErrorMessage(wxTextCtrl* errorCtrl) { + wxASSERT(this->EnsureTabPageVisible(errorCtrl)); + errorCtrl->SetFocus(); + // + wxMessageBox(_("invalid value detected"),_("Validation Error"),wxOK | wxCENTRE | wxICON_ERROR,this); +} + +/* checks if ch is a valid character for float values */ +bool CDlgAdvPreferences::IsValidFloatChar(const wxChar& ch) { + //don't accept the e + return wxIsdigit(ch) || ch=='.' || ch==',' || ch=='+' || ch=='-'; +} + +/* checks if ch is a valid character for time values */ +bool CDlgAdvPreferences::IsValidTimeChar(const wxChar& ch) { + return wxIsdigit(ch) || ch==':'; +} + +/* checks if ch is a valid character for time interval values */ +bool CDlgAdvPreferences::IsValidTimeIntervalChar(const wxChar& ch) { + return IsValidTimeChar(ch) || ch=='-'; +} + +/* checks if the value contains a valid float */ +bool CDlgAdvPreferences::IsValidFloatValue(const wxString& value) { + for(unsigned int i=0; i < value.Length();i++) { + if(!IsValidFloatChar(value[i])) { + return false; + } + } + //all chars are valid, now what is with the value as a whole ? + double td; + if(!value.ToDouble(&td)) { + return false; + } + return true; +} + +/* checks if the value is a valid time */ +bool CDlgAdvPreferences::IsValidTimeValue(const wxString& value) { + for(unsigned int i=0; i < value.Length();i++) { + if(!IsValidTimeChar(value[i])) { + return false; + } + } + //all chars are valid, now what is with the value as a whole ? + wxDateTime dt; + const wxChar* stopChar = dt.ParseFormat(value,wxT("%H:%M")); + if(stopChar==NULL) {//conversion failed + return false; + } + return true; +} + +/* checks if the value is a valid time interval, format HH:MM-HH:MM */ +bool CDlgAdvPreferences::IsValidTimeIntervalValue(const wxString& value) { + for(unsigned int i=0; i < value.Length();i++) { + if(!IsValidTimeIntervalChar(value[i])) { + return false; + } + } + //all chars are valid, now what is with the value as a whole ? + //check for - + if(value.Find('-')<0) { + return false; + } + //split up into start and stop + wxString start = value.BeforeFirst('-'); + wxString stop = value.AfterFirst('-'); + //validate start and stop parts + if(!IsValidTimeValue(start) || !IsValidTimeValue(stop)) { + return false; + } + //ensure that start is lower than stop + wxDateTime dtStart,dtStop; + dtStart.ParseFormat(start,wxT("%H:%M")); + dtStop.ParseFormat(stop,wxT("%H:%M")); + if(dtStart>=dtStop) { + return false; + } + return true; +} + +// ------------ Event handlers starts here +// -------- generic command handler +// handles all control command events +void CDlgAdvPreferences::OnHandleCommandEvent(wxCommandEvent& ev) { + ev.Skip(); + if(!m_bInInit) { + m_bDataChanged=true; + } + UpdateControlStates(); +} + +// ---- command buttons handlers +// handles OK button clicked +void CDlgAdvPreferences::OnOK(wxCommandEvent& ev) { + CMainDocument* pDoc = wxGetApp().GetDocument(); + + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + + if(!ValidateInput()) { + return; + } + if(SavePreferencesSettings()) { + pDoc->rpc.set_global_prefs_override_struct(prefs,mask); + pDoc->rpc.read_global_prefs_override(); + //force update to pDoc->state.global_prefs member + pDoc->ForceCacheUpdate(); + } + ev.Skip(); +} + +// handles Help button clicked +void CDlgAdvPreferences::OnHelp(wxCommandEvent& ev) { + wxString url = wxGetApp().GetSkinManager()->GetAdvanced()->GetCompanyWebsite(); + url += wxT("/prefs.php");//this seems not the right url, but which instead ? + wxHyperLink::ExecuteLink(url); + ev.Skip(); +} diff --git a/clientgui/DlgAdvPreferences.h b/clientgui/DlgAdvPreferences.h new file mode 100644 index 0000000000..40db8b5fa3 --- /dev/null +++ b/clientgui/DlgAdvPreferences.h @@ -0,0 +1,69 @@ +// Berkeley Open Infrastructure for Network Computing +// http://boinc.berkeley.edu +// Copyright (C) 2005 University of California +// +// This 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 2.1 of the License, or (at your option) any later version. +// +// This software 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. +// +// To view the GNU Lesser General Public License visit +// http://www.gnu.org/copyleft/lesser.html +// or write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +#ifndef _DLGADVPREFERENCES_H_ +#define _DLGADVPREFERENCES_H_ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma interface "DlgAdvPreferences.cpp" +#endif + + +#include "DlgAdvPreferencesBase.h" +#include "prefs.h" + +#define TXT_PROC_TIME_TOOLTIP _("specify work start and stop hours in format HH:MM-HH:MM\nstart must be lower than stop") +#define TXT_NET_TIME_TOOLTIP _("specify network usage start and stop hours in format HH:MM-HH:MM\nstart must be lower than stop") + +class CDlgAdvPreferences : public CDlgAdvPreferencesBase { + DECLARE_DYNAMIC_CLASS( CDlgAdvPreferences ) + DECLARE_EVENT_TABLE() + void ReadPreferenceSettings(); + bool SavePreferencesSettings(); + void UpdateControlStates(); + void SetSpecialTooltips(); + bool SaveState(); + bool RestoreState(); + bool ValidateInput(); + void SetValidators(); + bool IsValidFloatChar(const wxChar& ch); + bool IsValidFloatValue(const wxString& value); + bool IsValidTimeChar(const wxChar& ch); + bool IsValidTimeValue(const wxString& value); + bool IsValidTimeIntervalChar(const wxChar& ch); + bool IsValidTimeIntervalValue(const wxString& value); + void ShowErrorMessage(wxTextCtrl* errorCtrl); + bool EnsureTabPageVisible(wxTextCtrl* txtCtrl); +public: + CDlgAdvPreferences(wxWindow* parent=NULL);//to act as standard constructor set a default value + virtual ~CDlgAdvPreferences(); + //generic event handler + void OnHandleCommandEvent(wxCommandEvent& ev); + // + void OnOK(wxCommandEvent& event); + void OnHelp(wxCommandEvent& event); +private: + GLOBAL_PREFS prefs; + GLOBAL_PREFS_MASK mask; + bool m_bDataChanged; + bool m_bInInit; + wxArrayInt m_arrTabPageIds; +}; + +#endif // _DLGADVPREFERENCES_H_ diff --git a/clientgui/DlgAdvPreferencesBase.cpp b/clientgui/DlgAdvPreferencesBase.cpp new file mode 100644 index 0000000000..bbe5520f34 --- /dev/null +++ b/clientgui/DlgAdvPreferencesBase.cpp @@ -0,0 +1,575 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 13 2006) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif //__BORLANDC__ + +#ifndef WX_PRECOMP +#include +#endif //WX_PRECOMP + +#include "DlgAdvPreferencesBase.h" + +/////////////////////////////////////////////////////////////////////////// + +CDlgAdvPreferencesBase::CDlgAdvPreferencesBase( wxWindow* parent, int id, wxString title, wxPoint pos, wxSize size, int style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + this->Centre( wxBOTH ); + + wxBoxSizer* bSizer1; + bSizer1 = new wxBoxSizer( wxVERTICAL ); + + m_panelControls = new wxPanel( this, ID_DEFAULT, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panelControls->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + wxBoxSizer* bSizer3; + bSizer3 = new wxBoxSizer( wxVERTICAL ); + + m_Notebook = new wxNotebook( m_panelControls, ID_DEFAULT, wxDefaultPosition, wxDefaultSize, wxNB_FLAT|wxNB_TOP ); + m_Notebook->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + m_panelProcessor = new wxPanel( m_Notebook, ID_TABPAGE_PROC, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panelProcessor->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + wxBoxSizer* bSizer7; + bSizer7 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer4; + sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_panelProcessor, -1, _("when do work") ), wxVERTICAL ); + + m_chkProcOnBatteries = new wxCheckBox( m_panelProcessor, ID_CHKPROCONBATTERIES, _("while computer is on batteries"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkProcOnBatteries->SetToolTip( wxT("check this, if you want that this host does work while it runs on batteries") ); + + sbSizer4->Add( m_chkProcOnBatteries, 0, wxALL, 5 ); + + m_chkProcInUse = new wxCheckBox( m_panelProcessor, ID_CHKPROCINUSE, _("while computer is in use"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkProcInUse->SetToolTip( wxT("check this, if work should be done while you are working at this host") ); + + sbSizer4->Add( m_chkProcInUse, 0, wxALL, 5 ); + + wxFlexGridSizer* fgSizer5; + fgSizer5 = new wxFlexGridSizer( 2, 4, 0, 0 ); + fgSizer5->AddGrowableCol( 3 ); + fgSizer5->SetFlexibleDirection( wxHORIZONTAL ); + fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText26 = new wxStaticText( m_panelProcessor, ID_DEFAULT, _("only if computer is idle for"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer5->Add( m_staticText26, 0, wxALL, 5 ); + + m_txtProcIdleFor = new wxTextCtrl( m_panelProcessor, ID_TXTPROCIDLEFOR, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + m_txtProcIdleFor->SetToolTip( wxT("work is done after this amount of minutes idle time (no mouse movement and/or keyboard input)") ); + + fgSizer5->Add( m_txtProcIdleFor, 0, wxALL, 5 ); + + m_staticText27 = new wxStaticText( m_panelProcessor, ID_DEFAULT, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer5->Add( m_staticText27, 0, wxALL, 5 ); + + m_staticText28 = new wxStaticText( m_panelProcessor, ID_DEFAULT, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer5->Add( m_staticText28, 0, wxALL, 5 ); + + sbSizer4->Add( fgSizer5, 0, wxEXPAND, 5 ); + + bSizer7->Add( sbSizer4, 0, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer91; + sbSizer91 = new wxStaticBoxSizer( new wxStaticBox( m_panelProcessor, -1, _("work time restrictions") ), wxVERTICAL ); + + wxBoxSizer* bSizer111; + bSizer111 = new wxBoxSizer( wxHORIZONTAL ); + + m_rbtProcEveryDay = new wxRadioButton( m_panelProcessor, ID_RBTPROCEVERYDAY, _("every day between hours of"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); + m_rbtProcEveryDay->SetToolTip( wxT("sets worktime restrictions for every day of the week\n(no restrictions if values are equal)") ); + + bSizer111->Add( m_rbtProcEveryDay, 0, wxALL, 5 ); + + m_txtProcEveryDayStart = new wxTextCtrl( m_panelProcessor, ID_TXTPROCEVERYDAYSTART, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + m_txtProcEveryDayStart->SetToolTip( wxT("start work at this time") ); + + bSizer111->Add( m_txtProcEveryDayStart, 0, wxALL, 5 ); + + m_staticText25 = new wxStaticText( m_panelProcessor, ID_DEFAULT, _("and"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE ); + bSizer111->Add( m_staticText25, 0, wxALL|wxEXPAND, 5 ); + + m_txtProcEveryDayStop = new wxTextCtrl( m_panelProcessor, ID_TXTPROCEVERYDAYSTOP, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + m_txtProcEveryDayStop->SetToolTip( wxT("stop work at this time") ); + + bSizer111->Add( m_txtProcEveryDayStop, 0, wxALL, 5 ); + + sbSizer91->Add( bSizer111, 0, wxEXPAND, 5 ); + + m_rbtProcSpecialTimes = new wxRadioButton( m_panelProcessor, ID_RBTPROCSPECIALTIMES, _("as specified here:"), wxDefaultPosition, wxDefaultSize, 0); + m_rbtProcSpecialTimes->SetToolTip( wxT("set special work time restrictions for checked days") ); + + sbSizer91->Add( m_rbtProcSpecialTimes, 0, wxALL, 5 ); + + m_panelProcSpecialTimes = new wxPanel( m_panelProcessor, ID_DEFAULT, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); + m_panelProcSpecialTimes->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + wxBoxSizer* bSizer11; + bSizer11 = new wxBoxSizer( wxVERTICAL ); + + wxFlexGridSizer* fgSizer6; + fgSizer6 = new wxFlexGridSizer( 4, 4, 0, 0 ); + fgSizer6->SetFlexibleDirection( wxHORIZONTAL ); + fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_chkProcMonday = new wxCheckBox( m_panelProcSpecialTimes, ID_CHKPROCMONDAY, _("Monday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkProcMonday->SetToolTip( wxT("check this, if you want that work is done on monday") ); + + fgSizer6->Add( m_chkProcMonday, 0, wxALL, 5 ); + + m_txtProcMonday = new wxTextCtrl( m_panelProcSpecialTimes, ID_TXTPROCMONDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer6->Add( m_txtProcMonday, 0, wxALL, 5 ); + + m_chkProcTuesday = new wxCheckBox( m_panelProcSpecialTimes, ID_CHKPROCTUESDAY, _("Tuesday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkProcTuesday->SetToolTip( wxT("check this, if you want that work is done on tuesday") ); + + fgSizer6->Add( m_chkProcTuesday, 0, wxALL, 5 ); + + m_txtProcTuesday = new wxTextCtrl( m_panelProcSpecialTimes, ID_TXTPROCTUESDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer6->Add( m_txtProcTuesday, 0, wxALL, 5 ); + + m_chkProcWednesday = new wxCheckBox( m_panelProcSpecialTimes, ID_CHKPROCWEDNESDAY, _("Wednesday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkProcWednesday->SetToolTip( wxT("check this, if you want that work is done on wednesday") ); + + fgSizer6->Add( m_chkProcWednesday, 0, wxALL, 5 ); + + m_txtProcWednesday = new wxTextCtrl( m_panelProcSpecialTimes, ID_TXTPROCWEDNESDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer6->Add( m_txtProcWednesday, 0, wxALL, 5 ); + + m_chkProcThursday = new wxCheckBox( m_panelProcSpecialTimes, ID_CHKPROCTHURSDAY, _("Thursday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkProcThursday->SetToolTip( wxT("check this, if you want that work is done on thursday") ); + + fgSizer6->Add( m_chkProcThursday, 0, wxALL, 5 ); + + m_txtProcThursday = new wxTextCtrl( m_panelProcSpecialTimes, ID_TXTPROCTHURSDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer6->Add( m_txtProcThursday, 0, wxALL, 5 ); + + m_chkProcFriday = new wxCheckBox( m_panelProcSpecialTimes, ID_CHKPROCFRIDAY, _("Friday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkProcFriday->SetToolTip( wxT("check this, if you want that work is done on friday") ); + + fgSizer6->Add( m_chkProcFriday, 0, wxALL, 5 ); + + m_txtProcFriday = new wxTextCtrl( m_panelProcSpecialTimes, ID_TXTPROCFRIDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer6->Add( m_txtProcFriday, 0, wxALL, 5 ); + + m_chkProcSaturday = new wxCheckBox( m_panelProcSpecialTimes, ID_CHKPROCSATURDAY, _("Saturday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkProcSaturday->SetToolTip( wxT("check this, if you want that work is done on saturday") ); + + fgSizer6->Add( m_chkProcSaturday, 0, wxALL, 5 ); + + m_txtProcSaturday = new wxTextCtrl( m_panelProcSpecialTimes, ID_TXTPROCSATURDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer6->Add( m_txtProcSaturday, 0, wxALL, 5 ); + + m_chkProcSunday = new wxCheckBox( m_panelProcSpecialTimes, ID_CHKPROCSUNDAY, _("Sunday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkProcSunday->SetToolTip( wxT("check this, if you want that work is done on sunday") ); + + fgSizer6->Add( m_chkProcSunday, 0, wxALL, 5 ); + + m_txtProcSunday = new wxTextCtrl( m_panelProcSpecialTimes, ID_TXTPROCSUNDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer6->Add( m_txtProcSunday, 0, wxALL, 5 ); + + bSizer11->Add( fgSizer6, 1, wxEXPAND, 5 ); + + m_panelProcSpecialTimes->SetSizer( bSizer11 ); + m_panelProcSpecialTimes->Layout(); + bSizer11->Fit( m_panelProcSpecialTimes ); + sbSizer91->Add( m_panelProcSpecialTimes, 1, wxEXPAND | wxALL, 5 ); + + bSizer7->Add( sbSizer91, 0, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer3; + sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_panelProcessor, -1, _("other options") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer3; + fgSizer3 = new wxFlexGridSizer( 3, 3, 0, 0 ); + fgSizer3->AddGrowableCol( 2 ); + fgSizer3->SetFlexibleDirection( wxHORIZONTAL ); + fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText18 = new wxStaticText( m_panelProcessor, ID_DEFAULT, _("switch between applications between every"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + fgSizer3->Add( m_staticText18, 0, wxALL|wxEXPAND, 5 ); + + m_txtProcSwitchEvery = new wxTextCtrl( m_panelProcessor, ID_TXTPROCSWITCHEVERY, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + fgSizer3->Add( m_txtProcSwitchEvery, 0, wxALL, 5 ); + + m_staticText19 = new wxStaticText( m_panelProcessor, ID_DEFAULT, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer3->Add( m_staticText19, 0, wxALL, 5 ); + + m_staticText20 = new wxStaticText( m_panelProcessor, ID_DEFAULT, _("on multiprocessor systems, use at most"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + fgSizer3->Add( m_staticText20, 0, wxALL|wxEXPAND, 5 ); + + m_txtProcUseProcessors = new wxTextCtrl( m_panelProcessor, ID_TXTPROCUSEPROCESSORS, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + fgSizer3->Add( m_txtProcUseProcessors, 0, wxALL, 5 ); + + m_staticText21 = new wxStaticText( m_panelProcessor, ID_DEFAULT, _("processors"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer3->Add( m_staticText21, 0, wxALL, 5 ); + + m_staticText22 = new wxStaticText( m_panelProcessor, ID_DEFAULT, _("use at most"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + fgSizer3->Add( m_staticText22, 0, wxALL|wxEXPAND, 5 ); + + m_txtProcUseCPUTime = new wxTextCtrl( m_panelProcessor, ID_TXTPOCUSECPUTIME, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + fgSizer3->Add( m_txtProcUseCPUTime, 0, wxALL, 5 ); + + m_staticText23 = new wxStaticText( m_panelProcessor, ID_DEFAULT, _("% CPU time"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer3->Add( m_staticText23, 0, wxALL, 5 ); + + sbSizer3->Add( fgSizer3, 1, wxEXPAND, 5 ); + + bSizer7->Add( sbSizer3, 1, wxEXPAND, 5 ); + + m_panelProcessor->SetSizer( bSizer7 ); + m_panelProcessor->Layout(); + bSizer7->Fit( m_panelProcessor ); + m_Notebook->AddPage( m_panelProcessor, _("processor usage"), false ); + m_panelNetwork = new wxPanel( m_Notebook, ID_TABPAGE_NET, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panelNetwork->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + wxBoxSizer* bSizer12; + bSizer12 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer8; + sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( m_panelNetwork, -1, _("general options") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer7; + fgSizer7 = new wxFlexGridSizer( 3, 3, 0, 0 ); + fgSizer7->AddGrowableCol( 2 ); + fgSizer7->SetFlexibleDirection( wxHORIZONTAL ); + fgSizer7->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText30 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("connect about every"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer7->Add( m_staticText30, 0, wxALL, 5 ); + + m_txtNetConnectInterval = new wxTextCtrl( m_panelNetwork, ID_TXTNETCONNECTINTERVAL, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + m_txtNetConnectInterval->SetToolTip( wxT("specify the connect-to-server frequency\n(this influences the amount of work is requested from projects)") ); + + fgSizer7->Add( m_txtNetConnectInterval, 0, wxALL, 5 ); + + m_staticText31 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("days"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer7->Add( m_staticText31, 0, wxALL, 5 ); + + m_staticText32 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("maximum download rate"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer7->Add( m_staticText32, 0, wxALL, 5 ); + + m_txtNetDownloadRate = new wxTextCtrl( m_panelNetwork, ID_TXTNETDOWNLOADRATE, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + fgSizer7->Add( m_txtNetDownloadRate, 0, wxALL, 5 ); + + m_staticText33 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("KBytes/second"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer7->Add( m_staticText33, 0, wxALL, 5 ); + + m_staticText34 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("maximum upload rate"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer7->Add( m_staticText34, 0, wxALL, 5 ); + + m_txtNetUploadRate = new wxTextCtrl( m_panelNetwork, ID_TXTNETUPLOADRATE, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + fgSizer7->Add( m_txtNetUploadRate, 0, wxALL, 5 ); + + m_staticText35 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("KBytes/second"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer7->Add( m_staticText35, 0, wxALL, 5 ); + + m_chkNetSkipImageVerification = new wxCheckBox( m_panelNetwork, ID_CHKNETSKIPIMAGEVERIFICATION, _("skip image file verification"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkNetSkipImageVerification->SetToolTip( wxT("check this only if your internet provider modifies image files") ); + + fgSizer7->Add( m_chkNetSkipImageVerification, 0, wxALL, 5 ); + + sbSizer8->Add( fgSizer7, 1, wxEXPAND, 5 ); + + bSizer12->Add( sbSizer8, 0, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer7; + sbSizer7 = new wxStaticBoxSizer( new wxStaticBox( m_panelNetwork, -1, _("connect options") ), wxVERTICAL ); + + m_chkNetConfirmBeforeConnect = new wxCheckBox( m_panelNetwork, ID_CHKNETCONFIRMBEFORECONNECT, _("confirm before connecting to internet"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkNetConfirmBeforeConnect->SetToolTip( wxT("if checked, a confirmation dialog is displayed before trying to connect to the internet") ); + + sbSizer7->Add( m_chkNetConfirmBeforeConnect, 0, wxALL, 5 ); + + m_chkNetDisconnectWhenDone = new wxCheckBox( m_panelNetwork, ID_CHKNETDISCONNECTWHENDONE, _("disconnect when done"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkNetDisconnectWhenDone->SetToolTip( wxT("if checked, BOINC hangs up when netwrok transfer is done\n(only relevant for dialup-connection)") ); + + sbSizer7->Add( m_chkNetDisconnectWhenDone, 0, wxALL, 5 ); + + bSizer12->Add( sbSizer7, 0, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer9; + sbSizer9 = new wxStaticBoxSizer( new wxStaticBox( m_panelNetwork, -1, _("usage restrictions") ), wxVERTICAL ); + + wxBoxSizer* bSizer14; + bSizer14 = new wxBoxSizer( wxHORIZONTAL ); + + m_rbtNetEveryDay = new wxRadioButton( m_panelNetwork, ID_RBTNETEVERYDAY, _("use network only between the hours of"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); + m_rbtNetEveryDay->SetToolTip( wxT("sets network usage restriction for every day of the week") ); + + bSizer14->Add( m_rbtNetEveryDay, 0, wxALL, 5 ); + + m_txtNetEveryDayStart = new wxTextCtrl( m_panelNetwork, ID_TXTNETEVERYDAYSTART, _(""), wxDefaultPosition, wxSize( 50,-1 ), 0 ); + m_txtNetEveryDayStart->SetToolTip( wxT("network usage start hour") ); + + bSizer14->Add( m_txtNetEveryDayStart, 0, wxALL, 5 ); + + m_staticText37 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("and"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer14->Add( m_staticText37, 0, wxALL, 5 ); + + m_txtNetEveryDayStop = new wxTextCtrl( m_panelNetwork, ID_TXTNETEVERYDAYSTOP, _(""), wxDefaultPosition, wxSize( 50,-1 ), 0 ); + m_txtNetEveryDayStop->SetToolTip( wxT("network usage stop hour") ); + + bSizer14->Add( m_txtNetEveryDayStop, 0, wxALL, 5 ); + + sbSizer9->Add( bSizer14, 1, wxEXPAND, 5 ); + + m_rbtNetSpecialTimes = new wxRadioButton( m_panelNetwork, ID_RBTNETSPECIALTIMES, _("use network only as specified here:"), wxDefaultPosition, wxDefaultSize, 0); + m_rbtNetSpecialTimes->SetToolTip( wxT("sets special network usage restrictions for checked days") ); + + sbSizer9->Add( m_rbtNetSpecialTimes, 0, wxALL, 5 ); + + m_panelNetSpecialTimes = new wxPanel( m_panelNetwork, ID_DEFAULT, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); + m_panelNetSpecialTimes->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + m_panelNetSpecialTimes->SetToolTip( wxT("use network on thursday") ); + + wxBoxSizer* bSizer15; + bSizer15 = new wxBoxSizer( wxVERTICAL ); + + wxFlexGridSizer* fgSizer8; + fgSizer8 = new wxFlexGridSizer( 4, 4, 0, 0 ); + fgSizer8->SetFlexibleDirection( wxHORIZONTAL ); + fgSizer8->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_chkNetMonday = new wxCheckBox( m_panelNetSpecialTimes, ID_CHKNETMONDAY, _("Monday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkNetMonday->SetToolTip( wxT("use network on monday") ); + + fgSizer8->Add( m_chkNetMonday, 0, wxALL, 5 ); + + m_txtNetMonday = new wxTextCtrl( m_panelNetSpecialTimes, ID_TXTNETMONDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer8->Add( m_txtNetMonday, 0, wxALL, 5 ); + + m_chkNetTuesday = new wxCheckBox( m_panelNetSpecialTimes, ID_CHKNETTUESDAY, _("Tuesday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkNetTuesday->SetToolTip( wxT("use network on tuesday") ); + + fgSizer8->Add( m_chkNetTuesday, 0, wxALL, 5 ); + + m_txtNetTuesday = new wxTextCtrl( m_panelNetSpecialTimes, ID_TXTNETTUESDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer8->Add( m_txtNetTuesday, 0, wxALL, 5 ); + + m_chkNetWednesday = new wxCheckBox( m_panelNetSpecialTimes, ID_CHKNETWEDNESDAY, _("Wednesday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkNetWednesday->SetToolTip( wxT("use network on wednesday") ); + + fgSizer8->Add( m_chkNetWednesday, 0, wxALL, 5 ); + + m_txtNetWednesday = new wxTextCtrl( m_panelNetSpecialTimes, ID_TXTNETWEDNESDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer8->Add( m_txtNetWednesday, 0, wxALL, 5 ); + + m_chkNetThursday = new wxCheckBox( m_panelNetSpecialTimes, ID_CHKNETTHURSDAY, _("Thursday"), wxDefaultPosition, wxDefaultSize, 0 ); + + fgSizer8->Add( m_chkNetThursday, 0, wxALL, 5 ); + + m_txtNetThursday = new wxTextCtrl( m_panelNetSpecialTimes, ID_TXTNETTHURSDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer8->Add( m_txtNetThursday, 0, wxALL, 5 ); + + m_chkNetFriday = new wxCheckBox( m_panelNetSpecialTimes, ID_CHKNETFRIDAY, _("Friday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkNetFriday->SetToolTip( wxT("use network on friday") ); + + fgSizer8->Add( m_chkNetFriday, 0, wxALL, 5 ); + + m_txtNetFriday = new wxTextCtrl( m_panelNetSpecialTimes, ID_TXTNETFRIDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer8->Add( m_txtNetFriday, 0, wxALL, 5 ); + + m_chkNetSaturday = new wxCheckBox( m_panelNetSpecialTimes, ID_CHKNETSATURDAY, _("Saturday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkNetSaturday->SetToolTip( wxT("use network on saturday") ); + + fgSizer8->Add( m_chkNetSaturday, 0, wxALL, 5 ); + + m_txtNetSaturday = new wxTextCtrl( m_panelNetSpecialTimes, ID_TXTNETSATURDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer8->Add( m_txtNetSaturday, 0, wxALL, 5 ); + + m_chkNetSunday = new wxCheckBox( m_panelNetSpecialTimes, ID_CHKNETSUNDAY, _("Sunday"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkNetSunday->SetToolTip( wxT("use network on sunday") ); + + fgSizer8->Add( m_chkNetSunday, 0, wxALL, 5 ); + + m_txtNetSunday = new wxTextCtrl( m_panelNetSpecialTimes, ID_TXTNETSUNDAY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer8->Add( m_txtNetSunday, 0, wxALL, 5 ); + + bSizer15->Add( fgSizer8, 0, wxEXPAND, 5 ); + + m_panelNetSpecialTimes->SetSizer( bSizer15 ); + m_panelNetSpecialTimes->Layout(); + bSizer15->Fit( m_panelNetSpecialTimes ); + sbSizer9->Add( m_panelNetSpecialTimes, 0, wxEXPAND | wxALL, 5 ); + + bSizer12->Add( sbSizer9, 0, wxEXPAND, 5 ); + + m_panelNetwork->SetSizer( bSizer12 ); + m_panelNetwork->Layout(); + bSizer12->Fit( m_panelNetwork ); + m_Notebook->AddPage( m_panelNetwork, _("network usage"), false ); + m_panelDiskAndMemory = new wxPanel( m_Notebook, ID_TABPAGE_DISK, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panelDiskAndMemory->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + wxBoxSizer* bSizer25; + bSizer25 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizerDiskUsage; + sbSizerDiskUsage = new wxStaticBoxSizer( new wxStaticBox( m_panelDiskAndMemory, -1, _("disk usage") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizerDiskUsage; + fgSizerDiskUsage = new wxFlexGridSizer( 5, 3, 0, 0 ); + fgSizerDiskUsage->AddGrowableCol( 2 ); + fgSizerDiskUsage->SetFlexibleDirection( wxHORIZONTAL ); + fgSizerDiskUsage->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText40 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("use at most"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + fgSizerDiskUsage->Add( m_staticText40, 0, wxALL|wxEXPAND, 5 ); + + m_txtDiskMaxSpace = new wxTextCtrl( m_panelDiskAndMemory, ID_TXTDISKMAXSPACE, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + m_txtDiskMaxSpace->SetToolTip( wxT("the maximum amount diskspace used by BOINC (in Gigabytes)") ); + + fgSizerDiskUsage->Add( m_txtDiskMaxSpace, 0, wxALL, 5 ); + + m_staticText41 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("Gigabytes disk space"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerDiskUsage->Add( m_staticText41, 0, wxALL, 5 ); + + m_staticText42 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("leave at least"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + fgSizerDiskUsage->Add( m_staticText42, 0, wxALL|wxEXPAND, 5 ); + + m_txtDiskLeastFree = new wxTextCtrl( m_panelDiskAndMemory, ID_TXTDISKLEASTFREE, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + m_txtDiskLeastFree->SetToolTip( wxT("BOINC leaves at least this amount of diskspace free (in Gigagytes)") ); + + fgSizerDiskUsage->Add( m_txtDiskLeastFree, 0, wxALL, 5 ); + + m_staticText43 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("Gigabytes disk space free"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerDiskUsage->Add( m_staticText43, 0, wxALL, 5 ); + + m_staticText44 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("use at most"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + fgSizerDiskUsage->Add( m_staticText44, 0, wxALL|wxEXPAND, 5 ); + + m_txtDiskMaxOfTotal = new wxTextCtrl( m_panelDiskAndMemory, ID_TXTDISKMAXOFTOTAL, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + m_txtDiskMaxOfTotal->SetToolTip( wxT("BOINC uses at most this percentage of total diskspace") ); + + fgSizerDiskUsage->Add( m_txtDiskMaxOfTotal, 0, wxALL, 5 ); + + m_staticText45 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("% of total disk space"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerDiskUsage->Add( m_staticText45, 0, wxALL, 5 ); + + m_staticText46 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("write to disk at most every"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + fgSizerDiskUsage->Add( m_staticText46, 0, wxALL|wxEXPAND, 5 ); + + m_txtDiskWriteToDisk = new wxTextCtrl( m_panelDiskAndMemory, ID_TXTDISKWRITETODISK, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + fgSizerDiskUsage->Add( m_txtDiskWriteToDisk, 0, wxALL, 5 ); + + m_staticText47 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("seconds"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerDiskUsage->Add( m_staticText47, 0, wxALL, 5 ); + + m_staticText48 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("use at most"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + fgSizerDiskUsage->Add( m_staticText48, 0, wxALL|wxEXPAND, 5 ); + + m_txtDiskMaxSwap = new wxTextCtrl( m_panelDiskAndMemory, ID_TXTDISKWRITETODISK, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + fgSizerDiskUsage->Add( m_txtDiskMaxSwap, 0, wxALL, 5 ); + + m_staticText49 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("% of page file (swap space)"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerDiskUsage->Add( m_staticText49, 0, wxALL, 5 ); + + sbSizerDiskUsage->Add( fgSizerDiskUsage, 1, wxEXPAND, 5 ); + + bSizer25->Add( sbSizerDiskUsage, 0, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizerMemoryUsage; + sbSizerMemoryUsage = new wxStaticBoxSizer( new wxStaticBox( m_panelDiskAndMemory, -1, _("memory usage") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizerMemoryUsage; + fgSizerMemoryUsage = new wxFlexGridSizer( 3, 3, 0, 0 ); + fgSizerMemoryUsage->AddGrowableCol( 2 ); + fgSizerMemoryUsage->SetFlexibleDirection( wxHORIZONTAL ); + fgSizerMemoryUsage->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText50 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("use at most"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + fgSizerMemoryUsage->Add( m_staticText50, 0, wxALL|wxEXPAND, 5 ); + + m_txtMemoryMaxInUse = new wxTextCtrl( m_panelDiskAndMemory, ID_TXTMEMORYMAXINUSE, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + fgSizerMemoryUsage->Add( m_txtMemoryMaxInUse, 0, wxALL, 5 ); + + m_staticText51 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("% when computer is in use"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerMemoryUsage->Add( m_staticText51, 0, wxALL, 5 ); + + m_staticText52 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("use at most"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + fgSizerMemoryUsage->Add( m_staticText52, 0, wxALL|wxEXPAND, 5 ); + + m_txtMemoryMaxOnIdle = new wxTextCtrl( m_panelDiskAndMemory, ID_TXTMEMORYMAXONIDLE, _(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + fgSizerMemoryUsage->Add( m_txtMemoryMaxOnIdle, 0, wxALL, 5 ); + + m_staticText53 = new wxStaticText( m_panelDiskAndMemory, ID_DEFAULT, _("% when computer is idle"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerMemoryUsage->Add( m_staticText53, 0, wxALL, 5 ); + + sbSizerMemoryUsage->Add( fgSizerMemoryUsage, 1, wxEXPAND, 5 ); + + m_chkMemoryWhileSuspended = new wxCheckBox( m_panelDiskAndMemory, ID_CHKMEMORYWHILESUSPENDED, _("leave applications in memory while suspended"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_chkMemoryWhileSuspended->SetToolTip( wxT("if checked, suspended work units leave in memory") ); + + sbSizerMemoryUsage->Add( m_chkMemoryWhileSuspended, 0, wxALL, 5 ); + + bSizer25->Add( sbSizerMemoryUsage, 0, wxALL|wxEXPAND, 5 ); + + m_panelDiskAndMemory->SetSizer( bSizer25 ); + m_panelDiskAndMemory->Layout(); + bSizer25->Fit( m_panelDiskAndMemory ); + m_Notebook->AddPage( m_panelDiskAndMemory, _("disk and memory usage"), true ); + + bSizer3->Add( m_Notebook, 3, wxEXPAND | wxALL, 5 ); + + m_panelControls->SetSizer( bSizer3 ); + m_panelControls->Layout(); + bSizer3->Fit( m_panelControls ); + bSizer1->Add( m_panelControls, 1, wxEXPAND | wxALL, 5 ); + + m_panelButtons = new wxPanel( this, ID_DEFAULT, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer5; + bSizer5 = new wxBoxSizer( wxHORIZONTAL ); + + m_btnOK = new wxButton( m_panelButtons, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); + m_btnOK->SetToolTip( wxT("save all changes and close the dialog") ); + + bSizer5->Add( m_btnOK, 0, wxALL, 5 ); + + m_btnCancel = new wxButton( m_panelButtons, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + m_btnCancel->SetToolTip( wxT("close the dialog without saving changed values") ); + + bSizer5->Add( m_btnCancel, 0, wxALL, 5 ); + + m_btnHelp = new wxButton( m_panelButtons, wxID_HELP, _("Help"), wxDefaultPosition, wxDefaultSize, 0 ); + m_btnHelp->SetToolTip( wxT("shows the preferences web page") ); + + bSizer5->Add( m_btnHelp, 0, wxALL, 5 ); + + m_panelButtons->SetSizer( bSizer5 ); + m_panelButtons->Layout(); + bSizer5->Fit( m_panelButtons ); + bSizer1->Add( m_panelButtons, 0, wxALIGN_CENTER|wxALL, 5 ); + + this->SetSizer( bSizer1 ); + this->Layout(); +} diff --git a/clientgui/DlgAdvPreferencesBase.h b/clientgui/DlgAdvPreferencesBase.h new file mode 100644 index 0000000000..4c9c2827bb --- /dev/null +++ b/clientgui/DlgAdvPreferencesBase.h @@ -0,0 +1,202 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 13 2006) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DlgAdvPreferencesBase__ +#define __DlgAdvPreferencesBase__ + +// Define WX_GCH in order to support precompiled headers with GCC compiler. +// You have to create the header "wx_pch.h" and include all files needed +// for compile your gui inside it. +// Then, compile it and place the file "wx_pch.h.gch" into the same +// directory that "wx_pch.h". +#ifdef WX_GCH +#include +#else +#include +#endif + +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +#define ID_DEFAULT wxID_ANY // Default +#define ID_CHKMEMORYWHILESUSPENDED 20000 +#define ID_CHKNETCONFIRMBEFORECONNECT 20001 +#define ID_CHKNETDISCONNECTWHENDONE 20002 +#define ID_CHKNETFRIDAY 20003 +#define ID_CHKNETMONDAY 20004 +#define ID_CHKNETSATURDAY 20005 +#define ID_CHKNETSKIPIMAGEVERIFICATION 20006 +#define ID_CHKNETSUNDAY 20007 +#define ID_CHKNETTHURSDAY 20008 +#define ID_CHKNETTUESDAY 20009 +#define ID_CHKNETWEDNESDAY 20010 +#define ID_CHKPROCFRIDAY 20011 +#define ID_CHKPROCINUSE 20012 +#define ID_CHKPROCMONDAY 20013 +#define ID_CHKPROCONBATTERIES 20014 +#define ID_CHKPROCSATURDAY 20015 +#define ID_CHKPROCSUNDAY 20016 +#define ID_CHKPROCTHURSDAY 20017 +#define ID_CHKPROCTUESDAY 20018 +#define ID_CHKPROCWEDNESDAY 20019 +#define ID_DLGADVPREFS 20020 +#define ID_RBTNETEVERYDAY 20021 +#define ID_RBTNETSPECIALTIMES 20022 +#define ID_RBTPROCEVERYDAY 20023 +#define ID_RBTPROCSPECIALTIMES 20024 +#define ID_TABPAGE_DISK 20025 +#define ID_TABPAGE_NET 20026 +#define ID_TABPAGE_PROC 20027 +#define ID_TXTDISKLEASTFREE 20028 +#define ID_TXTDISKMAXOFTOTAL 20029 +#define ID_TXTDISKMAXSPACE 20030 +#define ID_TXTDISKWRITETODISK 20031 +#define ID_TXTMEMORYMAXINUSE 20032 +#define ID_TXTMEMORYMAXONIDLE 20033 +#define ID_TXTNETCONNECTINTERVAL 20034 +#define ID_TXTNETDOWNLOADRATE 20035 +#define ID_TXTNETEVERYDAYSTART 20036 +#define ID_TXTNETEVERYDAYSTOP 20037 +#define ID_TXTNETFRIDAY 20038 +#define ID_TXTNETMONDAY 20039 +#define ID_TXTNETSATURDAY 20040 +#define ID_TXTNETSUNDAY 20041 +#define ID_TXTNETTHURSDAY 20042 +#define ID_TXTNETTUESDAY 20043 +#define ID_TXTNETUPLOADRATE 20044 +#define ID_TXTNETWEDNESDAY 20045 +#define ID_TXTPOCUSECPUTIME 20046 +#define ID_TXTPROCEVERYDAYSTART 20047 +#define ID_TXTPROCEVERYDAYSTOP 20048 +#define ID_TXTPROCFRIDAY 20049 +#define ID_TXTPROCIDLEFOR 20050 +#define ID_TXTPROCMONDAY 20051 +#define ID_TXTPROCSATURDAY 20052 +#define ID_TXTPROCSUNDAY 20053 +#define ID_TXTPROCSWITCHEVERY 20054 +#define ID_TXTPROCTHURSDAY 20055 +#define ID_TXTPROCTUESDAY 20056 +#define ID_TXTPROCUSEPROCESSORS 20057 +#define ID_TXTPROCWEDNESDAY 20058 + +/** + * Class CDlgAdvPreferencesBase + */ +class CDlgAdvPreferencesBase : public wxDialog +{ + private: + + protected: + wxPanel* m_panelControls; + wxNotebook* m_Notebook; + wxPanel* m_panelProcessor; + wxCheckBox* m_chkProcOnBatteries; + wxCheckBox* m_chkProcInUse; + wxStaticText* m_staticText26; + wxTextCtrl* m_txtProcIdleFor; + wxStaticText* m_staticText27; + wxStaticText* m_staticText28; + wxRadioButton* m_rbtProcEveryDay; + wxTextCtrl* m_txtProcEveryDayStart; + wxStaticText* m_staticText25; + wxTextCtrl* m_txtProcEveryDayStop; + wxRadioButton* m_rbtProcSpecialTimes; + wxPanel* m_panelProcSpecialTimes; + wxCheckBox* m_chkProcMonday; + wxTextCtrl* m_txtProcMonday; + wxCheckBox* m_chkProcTuesday; + wxTextCtrl* m_txtProcTuesday; + wxCheckBox* m_chkProcWednesday; + wxTextCtrl* m_txtProcWednesday; + wxCheckBox* m_chkProcThursday; + wxTextCtrl* m_txtProcThursday; + wxCheckBox* m_chkProcFriday; + wxTextCtrl* m_txtProcFriday; + wxCheckBox* m_chkProcSaturday; + wxTextCtrl* m_txtProcSaturday; + wxCheckBox* m_chkProcSunday; + wxTextCtrl* m_txtProcSunday; + wxStaticText* m_staticText18; + wxTextCtrl* m_txtProcSwitchEvery; + wxStaticText* m_staticText19; + wxStaticText* m_staticText20; + wxTextCtrl* m_txtProcUseProcessors; + wxStaticText* m_staticText21; + wxStaticText* m_staticText22; + wxTextCtrl* m_txtProcUseCPUTime; + wxStaticText* m_staticText23; + wxPanel* m_panelNetwork; + wxStaticText* m_staticText30; + wxTextCtrl* m_txtNetConnectInterval; + wxStaticText* m_staticText31; + wxStaticText* m_staticText32; + wxTextCtrl* m_txtNetDownloadRate; + wxStaticText* m_staticText33; + wxStaticText* m_staticText34; + wxTextCtrl* m_txtNetUploadRate; + wxStaticText* m_staticText35; + wxCheckBox* m_chkNetSkipImageVerification; + wxCheckBox* m_chkNetConfirmBeforeConnect; + wxCheckBox* m_chkNetDisconnectWhenDone; + wxRadioButton* m_rbtNetEveryDay; + wxTextCtrl* m_txtNetEveryDayStart; + wxStaticText* m_staticText37; + wxTextCtrl* m_txtNetEveryDayStop; + wxRadioButton* m_rbtNetSpecialTimes; + wxPanel* m_panelNetSpecialTimes; + wxCheckBox* m_chkNetMonday; + wxTextCtrl* m_txtNetMonday; + wxCheckBox* m_chkNetTuesday; + wxTextCtrl* m_txtNetTuesday; + wxCheckBox* m_chkNetWednesday; + wxTextCtrl* m_txtNetWednesday; + wxCheckBox* m_chkNetThursday; + wxTextCtrl* m_txtNetThursday; + wxCheckBox* m_chkNetFriday; + wxTextCtrl* m_txtNetFriday; + wxCheckBox* m_chkNetSaturday; + wxTextCtrl* m_txtNetSaturday; + wxCheckBox* m_chkNetSunday; + wxTextCtrl* m_txtNetSunday; + wxPanel* m_panelDiskAndMemory; + wxStaticText* m_staticText40; + wxTextCtrl* m_txtDiskMaxSpace; + wxStaticText* m_staticText41; + wxStaticText* m_staticText42; + wxTextCtrl* m_txtDiskLeastFree; + wxStaticText* m_staticText43; + wxStaticText* m_staticText44; + wxTextCtrl* m_txtDiskMaxOfTotal; + wxStaticText* m_staticText45; + wxStaticText* m_staticText46; + wxTextCtrl* m_txtDiskWriteToDisk; + wxStaticText* m_staticText47; + wxStaticText* m_staticText48; + wxTextCtrl* m_txtDiskMaxSwap; + wxStaticText* m_staticText49; + wxStaticText* m_staticText50; + wxTextCtrl* m_txtMemoryMaxInUse; + wxStaticText* m_staticText51; + wxStaticText* m_staticText52; + wxTextCtrl* m_txtMemoryMaxOnIdle; + wxStaticText* m_staticText53; + wxCheckBox* m_chkMemoryWhileSuspended; + wxPanel* m_panelButtons; + wxButton* m_btnOK; + wxButton* m_btnCancel; + wxButton* m_btnHelp; + + public: + CDlgAdvPreferencesBase( wxWindow* parent, int id = -1, wxString title = wxT("BOINC Manager - Preferences"), wxPoint pos = wxDefaultPosition, wxSize size = wxSize( 603,561 ), int style = wxDEFAULT_DIALOG_STYLE ); + +}; + +#endif //__DlgAdvPreferencesBase__ diff --git a/clientgui/Events.h b/clientgui/Events.h index a7467ed861..9bd651a068 100644 --- a/clientgui/Events.h +++ b/clientgui/Events.h @@ -54,6 +54,7 @@ #define ID_REFRESHMESSAGESTIMER 6030 #define ID_ACTIVITYMENUSEPARATOR 6031 #define ID_FILECLOSEWINDOW 6032 +#define ID_ADVPREFSDLG 6033 #define ID_SIMPLEFRAME 6100 #define ID_SIMPLEMESSAGECHECKTIMER 6101 #define ID_SIMPLE_ATTACHTOPROJECT 6600 diff --git a/clientgui/sg_ViewTabPage.cpp b/clientgui/sg_ViewTabPage.cpp index 757ef0b887..f63d8fa872 100644 --- a/clientgui/sg_ViewTabPage.cpp +++ b/clientgui/sg_ViewTabPage.cpp @@ -111,7 +111,7 @@ void CViewTabPage::CreatePage() if (resState->app->user_friendly_name.size()) { projectFrName = wxString(resState->app->user_friendly_name.c_str(), wxConvUTF8); } else { - projectFrName = wxString(resState->wup->avp->name.c_str(), wxConvUTF8); + projectFrName = wxString(resState->wup->avp->app_name.c_str(), wxConvUTF8); } } else { projName = wxString("Not Available", wxConvUTF8 ); diff --git a/win_build/boincmgr_curl.vcproj b/win_build/boincmgr_curl.vcproj index 6603fa0bf0..bc5a58a9ff 100644 --- a/win_build/boincmgr_curl.vcproj +++ b/win_build/boincmgr_curl.vcproj @@ -1671,6 +1671,22 @@ RelativePath="..\clientgui\DlgAbout.h" > + + + + + + + +