2006-07-20 19:33:08 +00:00
|
|
|
// 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 "sg_DlgPreferences.h"
|
|
|
|
#endif
|
2006-07-05 21:36:56 +00:00
|
|
|
|
2006-07-20 19:33:08 +00:00
|
|
|
#include "stdwx.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "diagnostics.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "mfile.h"
|
|
|
|
#include "miofile.h"
|
|
|
|
#include "parse.h"
|
|
|
|
#include "error_numbers.h"
|
2006-08-17 17:36:51 +00:00
|
|
|
#include "BOINCGUIApp.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "SkinManager.h"
|
|
|
|
#include "MainDocument.h"
|
2006-09-14 16:02:55 +00:00
|
|
|
#include "sg_StaticLine.h"
|
2006-10-23 06:48:48 +00:00
|
|
|
#include "sg_DlgPreferences.h"
|
2006-07-05 21:36:56 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
ID_OPENBUTTON = 10001,
|
|
|
|
ID_SAVEBUTTON = 10002,
|
2006-09-14 16:02:55 +00:00
|
|
|
ID_SAVESKINBUTTON = 10003,
|
|
|
|
ID_CANCELBUTTON = 10004,
|
|
|
|
ID_CLEARBUTTON = 10005,
|
|
|
|
ID_SKINPICKERCMBBOX = 10006,
|
|
|
|
ID_DOWORKONLYBGNCMBBOX = 10007,
|
|
|
|
ID_DOCONNECTONLYBGNCMBBOX = 10008,
|
2006-07-05 21:36:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE( CDlgPreferences,wxDialog)
|
2006-08-10 19:32:47 +00:00
|
|
|
EVT_PAINT(CDlgPreferences::OnPaint)
|
2006-07-05 21:36:56 +00:00
|
|
|
EVT_COMBOBOX(-1,CDlgPreferences::OnCmbSelected)
|
|
|
|
EVT_BUTTON(-1,CDlgPreferences::OnBtnClick)
|
|
|
|
EVT_ERASE_BACKGROUND(CDlgPreferences::OnEraseBackground)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
// end events
|
|
|
|
|
2006-10-23 06:48:48 +00:00
|
|
|
CDlgPreferences::CDlgPreferences(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
2006-07-05 21:36:56 +00:00
|
|
|
{
|
2006-08-10 19:32:47 +00:00
|
|
|
m_skinNames.Add(wxT("default"));
|
|
|
|
Create(parent,id,title,pos,size,style,name);
|
2006-07-05 21:36:56 +00:00
|
|
|
|
2006-08-10 19:32:47 +00:00
|
|
|
if((pos==wxDefaultPosition)&&(size==wxDefaultSize)){
|
2006-08-17 17:36:51 +00:00
|
|
|
SetSize(0,0,416,403);
|
2006-08-10 19:32:47 +00:00
|
|
|
}
|
2006-07-05 21:36:56 +00:00
|
|
|
|
2006-08-10 19:32:47 +00:00
|
|
|
if((pos!=wxDefaultPosition)&&(size==wxDefaultSize)){
|
2006-08-17 17:36:51 +00:00
|
|
|
SetSize(416,403);
|
2006-08-10 19:32:47 +00:00
|
|
|
}
|
2006-08-17 17:36:51 +00:00
|
|
|
//
|
|
|
|
m_PrefIndicator = wxT("");
|
2006-08-10 19:32:47 +00:00
|
|
|
initBefore();
|
|
|
|
//Create dialog
|
|
|
|
CreateDialog();
|
|
|
|
initAfter();
|
2006-07-05 21:36:56 +00:00
|
|
|
}
|
|
|
|
CDlgPreferences::~CDlgPreferences()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-24 22:10:28 +00:00
|
|
|
void CDlgPreferences::CreateDialog()
|
2006-07-05 21:36:56 +00:00
|
|
|
{
|
2006-10-23 06:48:48 +00:00
|
|
|
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
|
2006-08-17 17:36:51 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2006-10-23 06:48:48 +00:00
|
|
|
|
2006-08-17 17:36:51 +00:00
|
|
|
wxASSERT(pDoc);
|
2006-10-23 06:48:48 +00:00
|
|
|
wxASSERT(pSkinSimple);
|
|
|
|
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
|
|
|
|
|
2006-08-18 21:45:17 +00:00
|
|
|
// populate values from prefs
|
|
|
|
if(pDoc->rpc.get_global_prefs_override_struct(m_prefs) == 0){
|
2006-10-23 06:48:48 +00:00
|
|
|
m_PrefIndicator = _("Using local preferences");
|
2006-08-18 21:45:17 +00:00
|
|
|
}else{
|
2006-10-23 06:48:48 +00:00
|
|
|
m_PrefIndicator = _("Using global preferences");
|
2006-08-18 21:45:17 +00:00
|
|
|
m_prefs = pDoc->state.global_prefs;
|
|
|
|
}
|
|
|
|
|
2006-10-23 06:48:48 +00:00
|
|
|
//Set Background color
|
|
|
|
SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
2006-09-14 16:02:55 +00:00
|
|
|
|
|
|
|
cmbSkinPicker=new wxComboBox(this,ID_SKINPICKERCMBBOX,wxT(""),wxPoint(206,37),wxSize(140,21),m_skinNames,wxNO_BORDER | wxCB_READONLY);
|
2006-10-23 06:48:48 +00:00
|
|
|
//cmbSkinPicker->SetValue(m_SkinName);
|
2006-09-14 16:02:55 +00:00
|
|
|
|
2006-10-23 06:48:48 +00:00
|
|
|
wxToolTip *ttSaveSkin = new wxToolTip(_("Change skin"));
|
|
|
|
btnSaveSkin=new wxBitmapButton(this,ID_SAVESKINBUTTON,*(pSkinSimple->GetChangeButton()->GetBitmap()),wxPoint(184,82),wxSize(62,16),wxNO_BORDER);
|
|
|
|
btnSaveSkin->SetBitmapSelected(*(pSkinSimple->GetChangeButton()->GetBitmapClicked()));
|
2006-09-14 16:02:55 +00:00
|
|
|
btnSaveSkin->SetToolTip(ttSaveSkin);
|
|
|
|
|
|
|
|
lnMyTop = new CStaticLine(this,wxPoint(16,113),wxSize(378,1));
|
2006-10-23 06:48:48 +00:00
|
|
|
lnMyTop->SetLineColor(pSkinSimple->GetStaticLineColor());
|
2006-09-14 16:02:55 +00:00
|
|
|
|
2006-08-17 17:36:51 +00:00
|
|
|
wxString itmsHourIntervals[]={wxT("0:00"),wxT("1:00"),wxT("2:00"),wxT("3:00"),wxT("4:00"),wxT("5:00"),wxT("6:00"),wxT("7:00"),wxT("8:00"),wxT("9:00"),wxT("10:00"),wxT("11:00"),wxT("12:00"),
|
|
|
|
wxT("13:00"),wxT("14:00"),wxT("15:00"),wxT("16:00"),wxT("17:00"),wxT("18:00"),wxT("19:00"),wxT("20:00"),wxT("21:00"),wxT("22:00"),wxT("23:00")};
|
2006-07-11 23:19:53 +00:00
|
|
|
|
2006-09-14 16:02:55 +00:00
|
|
|
cmbDWBtwnBgn=new wxComboBox(this,ID_DOWORKONLYBGNCMBBOX,wxT(""),wxPoint(206,155),wxSize(75,21),24,itmsHourIntervals,wxNO_BORDER | wxCB_READONLY);
|
2006-08-17 17:36:51 +00:00
|
|
|
//
|
2006-09-14 16:02:55 +00:00
|
|
|
cmbDWBtwnEnd=new wxComboBox(this,-1,wxT(""),wxPoint(307,155),wxSize(75,21),24,itmsHourIntervals,wxNO_BORDER | wxCB_READONLY);
|
2006-08-17 17:36:51 +00:00
|
|
|
//
|
2006-09-14 16:02:55 +00:00
|
|
|
cmbCTIBtwnBgn=new wxComboBox(this,ID_DOCONNECTONLYBGNCMBBOX,wxT(""),wxPoint(206,190),wxSize(75,21),24,itmsHourIntervals,wxNO_BORDER | wxCB_READONLY);
|
2006-08-17 17:36:51 +00:00
|
|
|
//
|
2006-09-14 16:02:55 +00:00
|
|
|
cmbCTIBtwnEnd=new wxComboBox(this,-1,wxT(""),wxPoint(307,190),wxSize(75,21),24,itmsHourIntervals,wxNO_BORDER | wxCB_READONLY);
|
2006-08-17 17:36:51 +00:00
|
|
|
//
|
|
|
|
wxString userValMaxUsed;
|
|
|
|
if(m_prefs.disk_max_used_gb < 1){
|
|
|
|
userValMaxUsed.Printf(_("%d MB"),(int)(0.1*1000));
|
|
|
|
}else{
|
|
|
|
userValMaxUsed.Printf(_("%4.2f GB"),m_prefs.disk_max_used_gb);
|
|
|
|
}
|
2006-08-18 21:45:17 +00:00
|
|
|
wxString itmsUseNoMoreGB[]={wxT("100MB"),wxT("200MB"),wxT("500MB"),wxT("1GB"),wxT("2GB"),wxT("5GB")};
|
|
|
|
int itmUseNoMore = 6;
|
|
|
|
if(!this->CheckIfInArray(itmsUseNoMoreGB,userValMaxUsed,itmUseNoMore)){
|
|
|
|
wxString itmsUseNoMoreGBU[]={wxT("100MB"),wxT("200MB"),wxT("500MB"),wxT("1GB"),wxT("2GB"),wxT("5GB"),userValMaxUsed};
|
2006-09-14 16:02:55 +00:00
|
|
|
cmbUseNoMoreGB=new wxComboBox(this,-1,wxT(""),wxPoint(206,225),wxSize(75,21),itmUseNoMore+1,itmsUseNoMoreGBU,wxNO_BORDER | wxCB_READONLY);
|
2006-08-18 21:45:17 +00:00
|
|
|
}else{
|
2006-09-14 16:02:55 +00:00
|
|
|
cmbUseNoMoreGB=new wxComboBox(this,-1,wxT(""),wxPoint(206,225),wxSize(75,21),itmUseNoMore,itmsUseNoMoreGB,wxNO_BORDER | wxCB_READONLY);
|
2006-08-18 21:45:17 +00:00
|
|
|
}
|
2006-08-17 17:36:51 +00:00
|
|
|
cmbUseNoMoreGB->SetValue(userValMaxUsed);
|
|
|
|
//
|
2006-07-05 21:36:56 +00:00
|
|
|
wxString itmsDWWCInUse[]={wxT("Yes"),wxT("No")};
|
2006-09-14 16:02:55 +00:00
|
|
|
cmbDWWCInUse=new wxComboBox(this,-1,wxT(""),wxPoint(206,260),wxSize(45,21),2,itmsDWWCInUse,wxNO_BORDER | wxCB_READONLY);
|
2006-08-17 17:36:51 +00:00
|
|
|
if(m_prefs.run_if_user_active){
|
|
|
|
cmbDWWCInUse->SetValue(wxT("Yes"));
|
|
|
|
}else{
|
|
|
|
cmbDWWCInUse->SetValue(wxT("No"));
|
|
|
|
}
|
|
|
|
//
|
|
|
|
wxString userValIdleFor;
|
|
|
|
userValIdleFor.Printf(_("%d"),(int)m_prefs.idle_time_to_run);
|
|
|
|
wxString itmsDWACIdleFor[]={wxString("1"),wxString("5"),wxString("10"),wxString("15"),wxString("30"),wxString("60")};
|
2006-08-18 21:45:17 +00:00
|
|
|
int itmIdlCnt = 6;
|
|
|
|
if(!this->CheckIfInArray(itmsDWACIdleFor,userValIdleFor,itmIdlCnt)){
|
|
|
|
wxString itmsDWACIdleForU[]={wxString("1"),wxString("5"),wxString("10"),wxString("15"),wxString("30"),wxString("60"),userValIdleFor};
|
2006-09-14 16:02:55 +00:00
|
|
|
cmbDWACIdleFor=new wxComboBox(this,-1,wxT(""),wxPoint(206,295),wxSize(75,21),itmIdlCnt+1,itmsDWACIdleForU,wxNO_BORDER | wxCB_READONLY);
|
2006-08-18 21:45:17 +00:00
|
|
|
}else{
|
2006-09-14 16:02:55 +00:00
|
|
|
cmbDWACIdleFor=new wxComboBox(this,-1,wxT(""),wxPoint(206,295),wxSize(75,21),itmIdlCnt,itmsDWACIdleFor,wxNO_BORDER | wxCB_READONLY);
|
2006-08-17 17:36:51 +00:00
|
|
|
}
|
|
|
|
cmbDWACIdleFor->SetValue(userValIdleFor);
|
2006-07-05 21:36:56 +00:00
|
|
|
// Btn Save and Cancel
|
2006-10-23 06:48:48 +00:00
|
|
|
wxToolTip *ttSave = new wxToolTip(_("Save preferences locally and close window"));
|
|
|
|
btnSave=new wxBitmapButton(this,ID_SAVEBUTTON,*(pSkinSimple->GetSaveButton()->GetBitmap()),wxPoint(120,340),wxSize(57,16),wxNO_BORDER);
|
|
|
|
btnSave->SetBitmapSelected(*(pSkinSimple->GetSaveButton()->GetBitmapClicked()));
|
2006-08-10 19:32:47 +00:00
|
|
|
btnSave->SetToolTip(ttSave);
|
|
|
|
|
2006-10-23 06:48:48 +00:00
|
|
|
wxToolTip *ttCancel = new wxToolTip(_("Cancel changes and close window"));
|
|
|
|
btnCancel=new wxBitmapButton(this,ID_CANCELBUTTON,*(pSkinSimple->GetCancelButton()->GetBitmap()),wxPoint(187,340),wxSize(57,16),wxNO_BORDER);
|
|
|
|
btnCancel->SetBitmapSelected(*(pSkinSimple->GetCancelButton()->GetBitmapClicked()));
|
2006-08-10 19:32:47 +00:00
|
|
|
btnCancel->SetToolTip(ttCancel);
|
|
|
|
|
2006-10-23 06:48:48 +00:00
|
|
|
wxToolTip *ttClear = new wxToolTip(_("Clear local preferences and use preferences from the web"));
|
|
|
|
btnClear=new wxBitmapButton(this,ID_CLEARBUTTON,*(pSkinSimple->GetClearButton()->GetBitmap()),wxPoint(254,340),wxSize(57,16),wxNO_BORDER);
|
|
|
|
btnClear->SetBitmapSelected(*(pSkinSimple->GetClearButton()->GetBitmapClicked()));
|
2006-08-10 19:32:47 +00:00
|
|
|
btnClear->SetToolTip(ttClear);
|
2006-08-17 17:36:51 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
ReadSettings(m_prefs);
|
2006-08-10 19:32:47 +00:00
|
|
|
|
2006-07-05 21:36:56 +00:00
|
|
|
Refresh();
|
|
|
|
}
|
2006-09-15 20:15:44 +00:00
|
|
|
|
2006-09-15 16:47:04 +00:00
|
|
|
void CDlgPreferences::VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz){
|
2006-07-05 21:36:56 +00:00
|
|
|
event.Skip(false);wxDC *dc;
|
|
|
|
dc=event.GetDC();
|
|
|
|
dc->SetBackground(wxBrush(win->GetBackgroundColour(),wxSOLID));
|
|
|
|
dc->Clear();
|
|
|
|
switch (opz) {
|
|
|
|
case 0:{
|
2006-09-15 16:47:04 +00:00
|
|
|
dc->DrawBitmap(*bitMap, 0, 0);
|
2006-07-05 21:36:56 +00:00
|
|
|
break;}
|
|
|
|
case 1:{
|
|
|
|
wxRect rec=win->GetClientRect();
|
2006-09-15 16:47:04 +00:00
|
|
|
rec.SetLeft((rec.GetWidth()-bitMap->GetWidth()) / 2);
|
|
|
|
rec.SetTop ((rec.GetHeight()-bitMap->GetHeight()) / 2);
|
|
|
|
dc->DrawBitmap(*bitMap,rec.GetLeft(),rec.GetTop(),0);
|
2006-07-05 21:36:56 +00:00
|
|
|
break;}
|
|
|
|
case 2:{
|
|
|
|
wxRect rec=win->GetClientRect();
|
2006-09-15 16:47:04 +00:00
|
|
|
for(int y=0;y < rec.GetHeight();y+=bitMap->GetHeight()){
|
|
|
|
for(int x=0;x < rec.GetWidth();x+=bitMap->GetWidth()){
|
|
|
|
dc->DrawBitmap(*bitMap,x,y,0);
|
2006-07-05 21:36:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void CDlgPreferences::OnEraseBackground(wxEraseEvent& event){
|
2006-10-23 06:48:48 +00:00
|
|
|
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
|
|
|
|
|
|
|
|
wxASSERT(pSkinSimple);
|
|
|
|
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
|
|
|
|
|
2006-07-05 21:36:56 +00:00
|
|
|
wxObject *m_wxWin = event.GetEventObject();
|
2006-10-23 06:48:48 +00:00
|
|
|
if(m_wxWin==this){
|
|
|
|
event.Skip(true);
|
|
|
|
VwXDrawBackImg(
|
|
|
|
event,
|
|
|
|
this,
|
|
|
|
pSkinSimple->GetPreferencesDialogBackgroundImage()->GetBitmap(),
|
|
|
|
0
|
|
|
|
);
|
|
|
|
VwXEvOnEraseBackground(event);
|
|
|
|
return;
|
|
|
|
}
|
2006-07-05 21:36:56 +00:00
|
|
|
event.Skip(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDlgPreferences::OnBtnClick(wxCommandEvent& event){ //init function
|
|
|
|
int btnID = event.GetId();
|
|
|
|
if(btnID==ID_SAVEBUTTON){
|
2006-08-18 21:45:17 +00:00
|
|
|
WriteSettings();
|
2006-07-24 22:10:28 +00:00
|
|
|
EndModal(wxID_OK);
|
2006-09-14 16:02:55 +00:00
|
|
|
} else if(btnID==ID_SAVESKINBUTTON){
|
|
|
|
EndModal(wxID_OK);
|
|
|
|
} else if(btnID==ID_CLEARBUTTON){
|
2006-08-18 21:45:17 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
std::string emptyS = "";
|
|
|
|
pDoc->rpc.set_global_prefs_override(emptyS);
|
|
|
|
// possible re read of global prefs to client
|
|
|
|
EndModal(wxID_CANCEL);
|
2006-07-05 21:36:56 +00:00
|
|
|
}else{
|
|
|
|
//wxMessageBox("OnBtnClick - btnCancel");
|
|
|
|
EndModal(wxID_CANCEL);
|
|
|
|
}
|
|
|
|
} //end function
|
|
|
|
|
|
|
|
void CDlgPreferences::OnCmbSelected(wxCommandEvent& event){ //init function
|
|
|
|
} //end function
|
|
|
|
|
2006-07-21 08:23:26 +00:00
|
|
|
void CDlgPreferences::VwXEvOnEraseBackground(wxEraseEvent& WXUNUSED(event)){ //init function
|
2006-07-05 21:36:56 +00:00
|
|
|
} //end function
|
|
|
|
|
|
|
|
void CDlgPreferences::initBefore(){
|
2006-08-17 17:36:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CDlgPreferences::CheckIfInArray(wxString valArray[],wxString value,int size){
|
|
|
|
|
|
|
|
for(int x=0; x<size; x++){
|
2006-08-18 21:45:17 +00:00
|
|
|
wxString val = valArray[x];
|
|
|
|
if(valArray[x] == value){
|
|
|
|
return true;
|
|
|
|
break;
|
|
|
|
}
|
2006-08-17 17:36:51 +00:00
|
|
|
}
|
2006-08-18 21:45:17 +00:00
|
|
|
return false;
|
2006-08-17 17:36:51 +00:00
|
|
|
}
|
2006-08-18 21:45:17 +00:00
|
|
|
void CDlgPreferences::WriteSettings(){
|
2006-08-17 17:36:51 +00:00
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
m_prefs = pDoc->state.global_prefs;
|
|
|
|
|
2006-08-18 21:45:17 +00:00
|
|
|
int dwBtwnIntB = ConvertToNumber(cmbDWBtwnBgn->GetValue());
|
|
|
|
int dwBtwnIntE = ConvertToNumber(cmbDWBtwnEnd->GetValue());
|
|
|
|
int ctiBtwnIntB = ConvertToNumber(cmbCTIBtwnBgn->GetValue());
|
|
|
|
int ctiBtwnIntE = ConvertToNumber(cmbCTIBtwnEnd->GetValue());
|
|
|
|
|
|
|
|
m_prefs.start_hour = dwBtwnIntB;
|
|
|
|
m_prefs.end_hour = dwBtwnIntE;
|
|
|
|
m_prefs.net_start_hour = ctiBtwnIntB;
|
|
|
|
m_prefs.net_end_hour = ctiBtwnIntE;
|
|
|
|
// Use No More Than GB
|
|
|
|
wxString useNoMoreGB = cmbUseNoMoreGB->GetValue();
|
|
|
|
wxString useNoMoreGBNum = useNoMoreGB.Mid(0,useNoMoreGB.Length()-2);
|
|
|
|
wxString valGBMB = useNoMoreGB.Mid(useNoMoreGB.Length()-2);
|
|
|
|
double dblUseNoMoreGB = 0;
|
|
|
|
if(valGBMB == wxString("GB")){
|
|
|
|
if(useNoMoreGBNum.ToDouble(&dblUseNoMoreGB)){
|
|
|
|
m_prefs.disk_max_used_gb = dblUseNoMoreGB;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if(useNoMoreGBNum.ToDouble(&dblUseNoMoreGB)){
|
|
|
|
m_prefs.disk_max_used_gb = dblUseNoMoreGB/1000;
|
2006-08-17 17:36:51 +00:00
|
|
|
}
|
|
|
|
}
|
2006-08-18 21:45:17 +00:00
|
|
|
//Do Work While Comp In Use
|
|
|
|
wxString doWorkWhileInUse = cmbDWWCInUse->GetValue();
|
|
|
|
if(doWorkWhileInUse == wxString("Yes")){
|
|
|
|
m_prefs.run_if_user_active = true;
|
|
|
|
}else{
|
|
|
|
m_prefs.run_if_user_active = false;
|
|
|
|
}
|
|
|
|
// Do work after connection idle
|
|
|
|
wxString doWorkConnIdleFor = cmbDWACIdleFor->GetValue();
|
|
|
|
double dblDoWorkConnIdleFor = 0;
|
|
|
|
if(doWorkConnIdleFor.ToDouble(&dblDoWorkConnIdleFor)){
|
|
|
|
m_prefs.idle_time_to_run = dblDoWorkConnIdleFor;
|
|
|
|
}
|
|
|
|
//
|
|
|
|
pDoc->rpc.set_global_prefs_override_struct(m_prefs);
|
|
|
|
pDoc->rpc.read_global_prefs_override();
|
2006-07-05 21:36:56 +00:00
|
|
|
|
|
|
|
}
|
2006-08-17 17:36:51 +00:00
|
|
|
void CDlgPreferences::ReadSettings(GLOBAL_PREFS prefs){
|
|
|
|
wxString hoursStrVal[]={wxT("0:00"),wxT("1:00"),wxT("2:00"),wxT("3:00"),wxT("4:00"),wxT("5:00"),wxT("6:00"),wxT("7:00"),wxT("8:00"),wxT("9:00"),wxT("10:00"),wxT("11:00"),wxT("12:00"),
|
|
|
|
wxT("13:00"),wxT("14:00"),wxT("15:00"),wxT("16:00"),wxT("17:00"),wxT("18:00"),wxT("19:00"),wxT("20:00"),wxT("21:00"),wxT("22:00"),wxT("23:00")};
|
2006-07-05 21:36:56 +00:00
|
|
|
|
2006-08-17 17:36:51 +00:00
|
|
|
cmbDWBtwnBgn->SetValue(hoursStrVal[prefs.start_hour]);
|
|
|
|
//
|
|
|
|
cmbDWBtwnEnd->SetValue(hoursStrVal[prefs.end_hour]);
|
|
|
|
//
|
|
|
|
cmbCTIBtwnBgn->SetValue(hoursStrVal[prefs.net_start_hour]);
|
|
|
|
//
|
|
|
|
cmbCTIBtwnEnd->SetValue(hoursStrVal[prefs.net_end_hour]);
|
|
|
|
//
|
|
|
|
|
|
|
|
}
|
|
|
|
int CDlgPreferences::ConvertToNumber(wxString num){
|
|
|
|
wxString hoursStrVal[]={wxT("0:00"),wxT("1:00"),wxT("2:00"),wxT("3:00"),wxT("4:00"),wxT("5:00"),wxT("6:00"),wxT("7:00"),wxT("8:00"),wxT("9:00"),wxT("10:00"),wxT("11:00"),wxT("12:00"),
|
|
|
|
wxT("13:00"),wxT("14:00"),wxT("15:00"),wxT("16:00"),wxT("17:00"),wxT("18:00"),wxT("19:00"),wxT("20:00"),wxT("21:00"),wxT("22:00"),wxT("23:00")};
|
|
|
|
|
2006-08-18 21:45:17 +00:00
|
|
|
for(int ind = 0; ind < 24; ind++){
|
2006-08-17 17:36:51 +00:00
|
|
|
if(hoursStrVal[ind] == num){
|
|
|
|
return ind;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
2006-07-05 21:36:56 +00:00
|
|
|
void CDlgPreferences::initAfter(){
|
|
|
|
//add your code here
|
|
|
|
Centre();
|
|
|
|
}
|
|
|
|
|
2006-08-10 19:32:47 +00:00
|
|
|
void CDlgPreferences::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
wxPaintDC dc(this);
|
2006-09-14 16:02:55 +00:00
|
|
|
dc.SetFont(wxFont(16,74,90,90,0,wxT("Arial")));
|
2006-10-23 06:48:48 +00:00
|
|
|
dc.DrawText(_("Skin"), wxPoint(16,10));
|
2006-09-14 16:02:55 +00:00
|
|
|
dc.SetFont(wxFont(9,74,90,90,0,wxT("Arial")));
|
2006-10-23 06:48:48 +00:00
|
|
|
dc.DrawText(_("Skin XML file:"), wxPoint(133,40));
|
2006-09-14 16:02:55 +00:00
|
|
|
dc.SetFont(wxFont(16,74,90,90,0,wxT("Arial")));
|
2006-10-23 06:48:48 +00:00
|
|
|
dc.DrawText(_("Preferences"), wxPoint(16,122));
|
2006-08-17 17:36:51 +00:00
|
|
|
dc.SetFont(wxFont(8,74,90,90,0,wxT("Arial")));
|
2006-09-14 16:02:55 +00:00
|
|
|
dc.DrawText(m_PrefIndicator, wxPoint(272,128));
|
2006-08-10 19:32:47 +00:00
|
|
|
dc.SetFont(wxFont(9,74,90,90,0,wxT("Arial")));
|
2006-10-23 06:48:48 +00:00
|
|
|
dc.DrawText(_("Do work only between:"), wxPoint(82,158));
|
|
|
|
dc.DrawText(_("and"), wxPoint(284,158));
|
|
|
|
dc.DrawText(_("Connect to internet only between:"), wxPoint(24,193));
|
|
|
|
dc.DrawText(_("and"), wxPoint(284,193));
|
|
|
|
dc.DrawText(_("Use no more than:"), wxPoint(103,228));
|
|
|
|
dc.DrawText(_("of disk space"), wxPoint(284,228));
|
|
|
|
dc.DrawText(_("Do work while computer is in use?"), wxPoint(16,263));
|
|
|
|
dc.DrawText(_("Do work after computer is idle for:"), wxPoint(22,298));
|
|
|
|
dc.DrawText(_("minutes"), wxPoint(284,298));
|
2006-08-10 19:32:47 +00:00
|
|
|
}
|
2006-07-05 21:36:56 +00:00
|
|
|
//[evtFunc]end your code
|
2006-10-23 06:48:48 +00:00
|
|
|
wxDirTraverseResult DirTraverserSkins::OnFile(const wxString& filename){
|
2006-07-24 22:10:28 +00:00
|
|
|
return wxDIR_CONTINUE;
|
|
|
|
}
|
2006-10-23 06:48:48 +00:00
|
|
|
wxDirTraverseResult DirTraverserSkins::OnDir(const wxString& dirname){
|
|
|
|
//wxString skinName = dirname.AfterLast(wxFileName::GetPathSeparator());
|
|
|
|
//if(skinName != wxT("default")){
|
|
|
|
// m_skins.Add(skinName);
|
|
|
|
//}
|
2006-07-24 22:10:28 +00:00
|
|
|
|
|
|
|
return wxDIR_IGNORE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|