From 25b7607ba143e73f3b82d4bff8a75fb2ee266996 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 23 Apr 2010 21:21:48 +0000 Subject: [PATCH] - manager: add network quota to advanced prefs dialog svn path=/trunk/boinc/; revision=21270 --- checkin_notes | 9 +++++++++ clientgui/DlgAdvPreferences.cpp | 15 +++++++++++++++ clientgui/DlgAdvPreferencesBase.cpp | 22 ++++++++++++++++++++++ clientgui/DlgAdvPreferencesBase.h | 9 +++++++++ 4 files changed, 55 insertions(+) diff --git a/checkin_notes b/checkin_notes index c746322feb..af0c53aa75 100644 --- a/checkin_notes +++ b/checkin_notes @@ -3136,3 +3136,12 @@ David 23 Apr 2010 prefs.cpp,h client/ cs_prefs.cpp + +David 23 Apr 2010 + - manager: add network quota to advanced prefs dialog + + clientgui/ + DlgAdvPreferences.cpp + DlgAdvPreferencesBase.cpp + DlgAdvPreferencesBase.h + diff --git a/clientgui/DlgAdvPreferences.cpp b/clientgui/DlgAdvPreferences.cpp index c22cee873b..be391351cf 100644 --- a/clientgui/DlgAdvPreferences.cpp +++ b/clientgui/DlgAdvPreferences.cpp @@ -101,6 +101,8 @@ void CDlgAdvPreferences::SetValidators() { //net page m_txtNetConnectInterval->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); m_txtNetDownloadRate->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txt_daily_xfer_limit_mb->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_txt_daily_xfer_period_days->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); m_txtNetUploadRate->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); m_txtNetAdditionalDays->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); //disk and memory page @@ -263,6 +265,12 @@ void CDlgAdvPreferences::ReadPreferenceSettings() { // upload rate buffer.Printf(wxT("%.2f"),prefs.max_bytes_sec_up / 1024); *m_txtNetUploadRate << buffer; + + buffer.Printf(wxT("%.2f"),prefs.daily_xfer_limit_mb); + *m_txt_daily_xfer_limit_mb << buffer; + buffer.Printf(wxT("%.2f"),prefs.daily_xfer_period_days ); + *m_txt_daily_xfer_period_days << buffer; + // buffer.Printf(wxT("%.2f"),prefs.work_buf_additional_days); *m_txtNetAdditionalDays << buffer; @@ -383,6 +391,13 @@ bool CDlgAdvPreferences::SavePreferencesSettings() { td = td * 1024; prefs.max_bytes_sec_up=td; mask.max_bytes_sec_up=true; + + m_txt_daily_xfer_limit_mb->GetValue().ToDouble(&td); + prefs.daily_xfer_limit_mb=td; + mask.daily_xfer_limit_mb=true; + m_txt_daily_xfer_period_days->GetValue().ToDouble(&td); + prefs.daily_xfer_period_days=(int)td; + mask.daily_xfer_period_days=true; // prefs.dont_verify_images=m_chkNetSkipImageVerification->GetValue(); mask.dont_verify_images=true; diff --git a/clientgui/DlgAdvPreferencesBase.cpp b/clientgui/DlgAdvPreferencesBase.cpp index d093fc23d9..8be714294e 100644 --- a/clientgui/DlgAdvPreferencesBase.cpp +++ b/clientgui/DlgAdvPreferencesBase.cpp @@ -328,6 +328,8 @@ CDlgAdvPreferencesBase::CDlgAdvPreferencesBase( wxWindow* parent, int id, wxStri fgSizer7->SetFlexibleDirection( wxHORIZONTAL ); fgSizer7->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + // upload/download rates + m_staticText32 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("Maximum download rate"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer7->Add( m_staticText32, 0, wxALL, 5 ); @@ -346,6 +348,26 @@ CDlgAdvPreferencesBase::CDlgAdvPreferencesBase( wxWindow* parent, int id, wxStri m_staticText35 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("KBytes/sec."), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer7->Add( m_staticText35, 0, wxALL, 5 ); + // long-term quota + + m_staticText_daily_xfer1 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("Transfer at most"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer7->Add( m_staticText_daily_xfer1, 0, wxALL, 5 ); + + m_txt_daily_xfer_limit_mb = new wxTextCtrl( m_panelNetwork, ID_TXTNETDOWNLOADRATE, wxT(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + fgSizer7->Add( m_txt_daily_xfer_limit_mb, 0, wxALL, 1 ); + + m_staticText_daily_xfer2 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("Mbytes every"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer7->Add( m_staticText_daily_xfer2, 0, wxALL, 5 ); + + m_txt_daily_xfer_period_days = new wxTextCtrl( m_panelNetwork, ID_TXTNETUPLOADRATE, wxT(""), wxDefaultPosition, wxSize( 50,-1 ), wxTE_RIGHT ); + fgSizer7->Add( m_txt_daily_xfer_period_days, 0, wxALL, 1 ); + + m_staticText_daily_xfer3 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("days"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer7->Add( m_staticText_daily_xfer3, 0, wxALIGN_RIGHT|wxALL, 5 ); + + + // buffer sizes + m_staticText30 = new wxStaticText( m_panelNetwork, ID_DEFAULT, _("Connect about every"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer7->Add( m_staticText30, 0, wxALL, 5 ); diff --git a/clientgui/DlgAdvPreferencesBase.h b/clientgui/DlgAdvPreferencesBase.h index 2f77c768d0..190ee2a8dd 100644 --- a/clientgui/DlgAdvPreferencesBase.h +++ b/clientgui/DlgAdvPreferencesBase.h @@ -85,6 +85,8 @@ #define ID_TXTPROCWEDNESDAY 20055 #define ID_CHKGPUPROCINUSE 20056 #define ID_TXTMAXLOAD 20057 +#define ID_DAILY_XFER_LIMIT_MB 20058 +#define ID_DAILY_XFER_PERIOD_DAYS 20059 /** * Class CDlgAdvPreferencesBase @@ -142,6 +144,13 @@ class CDlgAdvPreferencesBase : public wxDialog wxStaticText* m_staticText34; wxTextCtrl* m_txtNetUploadRate; wxStaticText* m_staticText35; + + wxStaticText* m_staticText_daily_xfer1; + wxTextCtrl* m_txt_daily_xfer_limit_mb; + wxStaticText* m_staticText_daily_xfer2; + wxTextCtrl* m_txt_daily_xfer_period_days; + wxStaticText* m_staticText_daily_xfer3; + wxStaticText* m_staticText30; wxTextCtrl* m_txtNetConnectInterval; wxStaticText* m_staticText31;