MGR: Fix bugs specific to MS Windows in Advanced Preferences dialog.

This commit is contained in:
Charlie Fenton 2015-02-28 05:51:59 -08:00
parent 4f4865df73
commit a66a108972
2 changed files with 49 additions and 66 deletions

View File

@ -284,13 +284,13 @@ void CDlgAdvPreferences::ReadPreferenceSettings() {
// 0 means "no retriction" but we don't use a checkbox here
if (prefs.max_ncpus_pct == 0.0) prefs.max_ncpus_pct = 100.0;
buffer.Printf(wxT("%.2f"), prefs.max_ncpus_pct);
*m_txtProcUseProcessors << buffer;
m_txtProcUseProcessors->SetValue(buffer);
//cpu limit
// 0 means "no retriction" but we don't use a checkbox here
if (prefs.cpu_usage_limit == 0.0) prefs.cpu_usage_limit = 100.0;
buffer.Printf(wxT("%.2f"),prefs.cpu_usage_limit);
*m_txtProcUseCPUTime << buffer;
m_txtProcUseCPUTime->SetValue(buffer);
// on batteries
m_chkProcOnBatteries->SetValue(! prefs.run_on_batteries);
@ -299,26 +299,26 @@ void CDlgAdvPreferences::ReadPreferenceSettings() {
m_chkGPUProcInUse->SetValue(! prefs.run_gpu_if_user_active);
// idle for X minutes
buffer.Printf(wxT("%.2f"),prefs.idle_time_to_run);
*m_txtProcIdleFor << buffer;
m_txtProcIdleFor->SetValue(buffer);
buffer.Printf(wxT("%.0f"), prefs.suspend_cpu_usage);
*m_txtMaxLoad << buffer;
m_txtMaxLoad->SetValue(buffer);
m_chkMaxLoad->SetValue(prefs.suspend_cpu_usage > 0.0);
// connection interval
buffer.Printf(wxT("%01.2f"),prefs.work_buf_min_days);
*m_txtNetConnectInterval << buffer;
m_txtNetConnectInterval->SetValue(buffer);
buffer.Printf(wxT("%.2f"),prefs.work_buf_additional_days);
*m_txtNetAdditionalDays << buffer;
m_txtNetAdditionalDays->SetValue(buffer);
// switch every X minutes
buffer.Printf(wxT("%.2f"),prefs.cpu_scheduling_period_minutes);
*m_txtProcSwitchEvery << buffer;
m_txtProcSwitchEvery->SetValue(buffer);
// write to disk every X seconds
buffer.Printf(wxT("%.0f"),prefs.disk_interval);
*m_txtDiskWriteToDisk << buffer;
m_txtDiskWriteToDisk->SetValue(buffer);
// ######### net usage page
@ -326,20 +326,20 @@ void CDlgAdvPreferences::ReadPreferenceSettings() {
m_chkNetDownloadRate->SetValue(prefs.max_bytes_sec_down > 0.0);
if (m_chkNetDownloadRate->IsChecked()) {
buffer.Printf(wxT("%.2f"),prefs.max_bytes_sec_down / 1024);
*m_txtNetDownloadRate << buffer;
m_txtNetDownloadRate->SetValue(buffer);
}
// upload rate
m_chkNetUploadRate->SetValue(prefs.max_bytes_sec_up > 0.0);
if (m_chkNetUploadRate->IsChecked()) {
buffer.Printf(wxT("%.2f"),prefs.max_bytes_sec_up / 1024);
*m_txtNetUploadRate << buffer;
m_txtNetUploadRate->SetValue(buffer);
}
m_chk_daily_xfer_limit->SetValue((prefs.daily_xfer_limit_mb > 0.0) && (prefs.daily_xfer_period_days > 0.0));
if (m_chk_daily_xfer_limit->IsChecked()) {
buffer.Printf(wxT("%.2f"),prefs.daily_xfer_limit_mb);
*m_txt_daily_xfer_limit_mb << buffer;
m_txt_daily_xfer_limit_mb->SetValue(buffer);
buffer.Printf(wxT("%d"),prefs.daily_xfer_period_days );
*m_txt_daily_xfer_period_days << buffer;
m_txt_daily_xfer_period_days->SetValue(buffer);
}
//
@ -355,38 +355,38 @@ void CDlgAdvPreferences::ReadPreferenceSettings() {
m_chkDiskMaxSpace->SetValue(prefs.disk_max_used_gb > 0.0);
if (m_chkDiskMaxSpace->IsChecked()) {
buffer.Printf(wxT("%.2f"),prefs.disk_max_used_gb);
*m_txtDiskMaxSpace << buffer;
m_txtDiskMaxSpace->SetValue(buffer);
}
// min free
m_chkDiskLeastFree->SetValue(prefs.disk_min_free_gb > 0.0);
if (m_chkDiskLeastFree->IsChecked()) {
buffer.Printf(wxT("%.2f"),prefs.disk_min_free_gb);
*m_txtDiskLeastFree << buffer;
m_txtDiskLeastFree->SetValue(buffer);
}
// max used percentage
m_chkDiskMaxOfTotal->SetValue(prefs.disk_max_used_pct < 100.0);
if (m_chkDiskMaxOfTotal->IsChecked()) {
buffer.Printf(wxT("%.2f"),prefs.disk_max_used_pct);
*m_txtDiskMaxOfTotal << buffer;
m_txtDiskMaxOfTotal->SetValue(buffer);
}
// max VM used
buffer.Printf(wxT("%.2f"),prefs.ram_max_used_busy_frac*100.0);
*m_txtMemoryMaxInUse << buffer;
m_txtMemoryMaxInUse->SetValue(buffer);
// max VM idle
buffer.Printf(wxT("%.2f"),prefs.ram_max_used_idle_frac*100.0);
*m_txtMemoryMaxOnIdle << buffer;
m_txtMemoryMaxOnIdle->SetValue(buffer);
// suspend to memory
m_chkMemoryWhileSuspended->SetValue(prefs.leave_apps_in_memory);
// max swap space (virtual memory)
buffer.Printf(wxT("%.2f"),prefs.vm_max_used_frac*100.0);
*m_txtDiskMaxSwap << buffer;
m_txtDiskMaxSwap->SetValue(buffer);
// ######### daily schedules page
// do work between
m_chkProcEveryDay->SetValue(prefs.cpu_times.start_hour != prefs.cpu_times.end_hour);
if (m_chkProcEveryDay->IsChecked()) {
*m_txtProcEveryDayStart << DoubleToTimeString(prefs.cpu_times.start_hour);
*m_txtProcEveryDayStop << DoubleToTimeString(prefs.cpu_times.end_hour);
m_txtProcEveryDayStart->SetValue(DoubleToTimeString(prefs.cpu_times.start_hour));
m_txtProcEveryDayStop->SetValue(DoubleToTimeString(prefs.cpu_times.end_hour));
}
//special day times
@ -402,8 +402,8 @@ void CDlgAdvPreferences::ReadPreferenceSettings() {
// use network between
m_chkNetEveryDay->SetValue(prefs.net_times.start_hour != prefs.net_times.end_hour);
if (m_chkNetEveryDay->IsChecked()) {
*m_txtNetEveryDayStart << DoubleToTimeString(prefs.net_times.start_hour);
*m_txtNetEveryDayStop << DoubleToTimeString(prefs.net_times.end_hour);
m_txtNetEveryDayStart->SetValue(DoubleToTimeString(prefs.net_times.start_hour));
m_txtNetEveryDayStop->SetValue(DoubleToTimeString(prefs.net_times.end_hour));
}
//special net times

View File

@ -185,50 +185,33 @@ void CDlgAdvPreferencesBase::addNewRowToSizer(wxWindow* parent,
wxWindow* fourth, wxWindow* fifth)
{
wxBoxSizer* rowSizer = new wxBoxSizer( wxHORIZONTAL );
wxSize sz(5, 15);
rowSizer->Add(first, 0, wxTOP | wxBOTTOM |wxLEFT, 5 );
#ifdef __WXMSW__
// MSW adds space to the right of checkbox label
if (first->IsKindOf(CLASSINFO(wxCheckBox))) {
rowSizer->Add(first, 0, wxTOP | wxBOTTOM |wxLEFT, 5 );
} else
#endif
rowSizer->Add(first, 0, wxALL, 5 );
first->SetToolTip(toolTipText);
// Add empty wxStaticText controls so tooltip appears continuously across the line
wxWindow* spaces1 = new wxStaticText(
parent, ID_DEFAULT, wxEmptyString, wxDefaultPosition, sz, 0 );
rowSizer->Add(spaces1, 0, wxTOP | wxBOTTOM, 5 );
spaces1->SetToolTip(toolTipText);
rowSizer->Add(second, 0, wxTOP | wxBOTTOM, 2 );
rowSizer->Add(second, 0, wxALL, 2 );
second->SetToolTip(toolTipText);
wxStaticText* spaces2 = new wxStaticText(
parent, ID_DEFAULT, wxEmptyString, wxDefaultPosition, sz, 0 );
rowSizer->Add(spaces2, 0, wxTOP | wxBOTTOM, 5 );
spaces2->SetToolTip(toolTipText);
rowSizer->Add(third, 0, wxTOP | wxBOTTOM, 5 );
rowSizer->Add(third, 0, wxALL, 5 );
third->SetToolTip(toolTipText);
if (fourth) {
wxStaticText* spaces3 = new wxStaticText(
parent, ID_DEFAULT, wxEmptyString, wxDefaultPosition, sz, 0 );
rowSizer->Add(spaces3, 0, wxTOP | wxBOTTOM, 5 );
spaces3->SetToolTip(toolTipText);
rowSizer->Add(fourth, 0, wxTOP | wxBOTTOM, 2 );
rowSizer->Add(fourth, 0, wxALL, 2 );
fourth->SetToolTip(toolTipText);
}
if (fifth) {
wxStaticText* spaces4 = new wxStaticText(
parent, ID_DEFAULT, wxEmptyString, wxDefaultPosition, sz, 0 );
rowSizer->Add(spaces4, 0, wxTOP | wxBOTTOM, 5 );
spaces4->SetToolTip(toolTipText);
rowSizer->Add(fifth, 0, wxTOP | wxBOTTOM, 5 );
rowSizer->Add(fifth, 0, wxALL, 5 );
fifth->SetToolTip(toolTipText);
}
rowSizer->Layout(); // Enables tooltips on spaces1, spaces2. etc.
toSizer->Add( rowSizer, 0, 0, 1 );
}
@ -356,7 +339,7 @@ wxPanel* CDlgAdvPreferencesBase::createProcessorTab(wxNotebook* notebook)
wxString NetConnectIntervalTT(_("Store at least enough tasks to keep the computer busy for this long."));
wxStaticText* staticText30 = new wxStaticText(
miscProcStaticBox, ID_DEFAULT,
_("Store at least"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
_("Store at least"), wxDefaultPosition, wxDefaultSize, 0
);
m_txtNetConnectInterval = new wxTextCtrl(
@ -372,7 +355,7 @@ wxPanel* CDlgAdvPreferencesBase::createProcessorTab(wxNotebook* notebook)
wxString NetAdditionalDaysTT(_("Store additional tasks above the minimum level. Determines how much work is requested when contacting a project."));
wxStaticText* staticText331 = new wxStaticText(
miscProcStaticBox, ID_DEFAULT,
_("Store up to an additional"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
_("Store up to an additional"), wxDefaultPosition, wxDefaultSize, 0
);
staticText331->SetToolTip(NetAdditionalDaysTT);
@ -387,7 +370,7 @@ wxPanel* CDlgAdvPreferencesBase::createProcessorTab(wxNotebook* notebook)
wxString ProcSwitchEveryTT = wxEmptyString;
ProcSwitchEveryTT.Printf(_("If you run several projects, %s may switch between them this often."), pSkinAdvanced->GetApplicationShortName().c_str());
wxStaticText* staticText18 = new wxStaticText( miscProcStaticBox, ID_DEFAULT, _("Switch between tasks every"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
wxStaticText* staticText18 = new wxStaticText( miscProcStaticBox, ID_DEFAULT, _("Switch between tasks every"), wxDefaultPosition, wxDefaultSize, 0 );
m_txtProcSwitchEvery = new wxTextCtrl( miscProcStaticBox, ID_TXTPROCSWITCHEVERY, wxT(""), wxDefaultPosition, textCtrlSize, wxTE_RIGHT );
@ -396,7 +379,7 @@ wxPanel* CDlgAdvPreferencesBase::createProcessorTab(wxNotebook* notebook)
addNewRowToSizer(miscProcStaticBox, miscProcBoxSizer, ProcSwitchEveryTT, staticText18, m_txtProcSwitchEvery, staticText19);
wxString DiskWriteToDiskTT(_("This controls how often tasks save their state to disk, so that they can be restarted later."));
wxStaticText* staticText46 = new wxStaticText( miscProcStaticBox, ID_DEFAULT, _("Request tasks to checkpoint at most every"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
wxStaticText* staticText46 = new wxStaticText( miscProcStaticBox, ID_DEFAULT, _("Request tasks to checkpoint at most every"), wxDefaultPosition, wxDefaultSize, 0 );
m_txtDiskWriteToDisk = new wxTextCtrl( miscProcStaticBox, ID_TXTDISKWRITETODISK, wxT(""), wxDefaultPosition, textCtrlSize, wxTE_RIGHT );
@ -533,9 +516,9 @@ wxPanel* CDlgAdvPreferencesBase::createDiskAndMemoryTab(wxNotebook* notebook)
DiskMaxSpaceTT.Printf(_("Limit the total amount of disk space used by %s."), pSkinAdvanced->GetApplicationShortName().c_str());
m_chkDiskMaxSpace = new wxCheckBox (
diskUsageStaticBox, ID_CHKDISKMAXSPACE, _("Use no more than"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
diskUsageStaticBox, ID_CHKDISKMAXSPACE, _("Use no more than"), wxDefaultPosition, wxDefaultSize, 0 );
m_txtDiskMaxSpace = new wxTextCtrl( diskUsageStaticBox, ID_TXTDISKMAXSPACE, wxT(""), wxDefaultPosition, textCtrlSize, wxTE_RIGHT );
m_txtDiskMaxSpace = new wxTextCtrl( diskUsageStaticBox, ID_TXTDISKMAXSPACE,wxT("9999.99"), wxDefaultPosition, textCtrlSize, wxTE_RIGHT );
wxStaticText* staticText41 = new wxStaticText( diskUsageStaticBox, ID_DEFAULT, _("GB"), wxDefaultPosition, wxDefaultSize, 0 );
@ -545,9 +528,9 @@ wxPanel* CDlgAdvPreferencesBase::createDiskAndMemoryTab(wxNotebook* notebook)
DiskLeastFreeTT.Printf(_("Limit disk usage to leave this much free space on the volume where %s stores data."), pSkinAdvanced->GetApplicationShortName().c_str());
m_chkDiskLeastFree = new wxCheckBox (
diskUsageStaticBox, ID_CHKDISKLEASTFREE, _("Leave at least"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
diskUsageStaticBox, ID_CHKDISKLEASTFREE, _("Leave at least"), wxDefaultPosition, wxDefaultSize, 0 );
m_txtDiskLeastFree = new wxTextCtrl( diskUsageStaticBox, ID_TXTDISKLEASTFREE, wxT(""), wxDefaultPosition, textCtrlSize, wxTE_RIGHT );
m_txtDiskLeastFree = new wxTextCtrl( diskUsageStaticBox, ID_TXTDISKLEASTFREE, wxT("9999.99"), wxDefaultPosition, textCtrlSize, wxTE_RIGHT );
wxStaticText* staticText43 = new wxStaticText( diskUsageStaticBox, ID_DEFAULT, _("GB free"), wxDefaultPosition, wxDefaultSize, 0 );
@ -557,9 +540,9 @@ wxPanel* CDlgAdvPreferencesBase::createDiskAndMemoryTab(wxNotebook* notebook)
DiskMaxOfTotalTT.Printf(_("Limit the percentage of disk space used by %s on the volume where it stores data."), pSkinAdvanced->GetApplicationShortName().c_str());
m_chkDiskMaxOfTotal = new wxCheckBox (
diskUsageStaticBox, ID_CHKDISKMAXOFTOTAL, _("Use no more than"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
diskUsageStaticBox, ID_CHKDISKMAXOFTOTAL, _("Use no more than"), wxDefaultPosition, wxDefaultSize, 0 );
m_txtDiskMaxOfTotal = new wxTextCtrl( diskUsageStaticBox, ID_TXTDISKMAXOFTOTAL, wxT(""), wxDefaultPosition, textCtrlSize, wxTE_RIGHT );
m_txtDiskMaxOfTotal = new wxTextCtrl( diskUsageStaticBox, ID_TXTDISKMAXOFTOTAL, wxT("9999.99"), wxDefaultPosition, textCtrlSize, wxTE_RIGHT );
/*xgettext:no-c-format*/
wxStaticText* staticText45 = new wxStaticText( diskUsageStaticBox, ID_DEFAULT, _("% of total"), wxDefaultPosition, wxDefaultSize, 0 );
@ -575,7 +558,7 @@ wxPanel* CDlgAdvPreferencesBase::createDiskAndMemoryTab(wxNotebook* notebook)
wxString MemoryMaxInUseTT = wxEmptyString;
MemoryMaxInUseTT.Printf(_("Limit the memory used by %s when you're using the computer."), pSkinAdvanced->GetApplicationShortName().c_str());
wxStaticText* staticText50 = new wxStaticText( memoryUsageStaticBox, ID_DEFAULT, _("When computer is in use, use at most"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
wxStaticText* staticText50 = new wxStaticText( memoryUsageStaticBox, ID_DEFAULT, _("When computer is in use, use at most"), wxDefaultPosition, wxDefaultSize, 0 );
textCtrlSize = getTextCtrlSize(wxT("100.00"));
m_txtMemoryMaxInUse = new wxTextCtrl( memoryUsageStaticBox, ID_TXTMEMORYMAXINUSE, wxT(""), wxDefaultPosition, textCtrlSize, wxTE_RIGHT );
@ -588,7 +571,7 @@ wxPanel* CDlgAdvPreferencesBase::createDiskAndMemoryTab(wxNotebook* notebook)
wxString MemoryMaxOnIdleTT = wxEmptyString;
MemoryMaxOnIdleTT.Printf(_("Limit the memory used by %s when you're not using the computer."), pSkinAdvanced->GetApplicationShortName().c_str());
wxStaticText* staticText52 = new wxStaticText( memoryUsageStaticBox, ID_DEFAULT, _("When computer is not in use, use at most"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
wxStaticText* staticText52 = new wxStaticText( memoryUsageStaticBox, ID_DEFAULT, _("When computer is not in use, use at most"), wxDefaultPosition, wxDefaultSize, 0 );
m_txtMemoryMaxOnIdle = new wxTextCtrl( memoryUsageStaticBox, ID_TXTMEMORYMAXONIDLE, wxT(""), wxDefaultPosition, textCtrlSize, wxTE_RIGHT );
@ -604,7 +587,7 @@ wxPanel* CDlgAdvPreferencesBase::createDiskAndMemoryTab(wxNotebook* notebook)
wxString DiskMaxSwapTT = wxEmptyString;
DiskMaxSwapTT.Printf(_("Limit the swap space (page file) used by %s."), pSkinAdvanced->GetApplicationShortName().c_str());
wxStaticText* staticText48 = new wxStaticText( memoryUsageStaticBox, ID_DEFAULT, _("Page/swap file: use at most"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
wxStaticText* staticText48 = new wxStaticText( memoryUsageStaticBox, ID_DEFAULT, _("Page/swap file: use at most"), wxDefaultPosition, wxDefaultSize, 0 );
m_txtDiskMaxSwap = new wxTextCtrl( memoryUsageStaticBox, ID_TXTDISKWRITETODISK, wxT(""), wxDefaultPosition, textCtrlSize, wxTE_RIGHT );
@ -625,7 +608,7 @@ wxPanel* CDlgAdvPreferencesBase::createDiskAndMemoryTab(wxNotebook* notebook)
wxPanel* CDlgAdvPreferencesBase::createDailySchedulesTab(wxNotebook* notebook)
{
wxSize textCtrlSize = getTextCtrlSize(wxT("23:59"));
wxSize textCtrlSize = getTextCtrlSize(wxT("23:59 "));
wxString andString(_("and"));
wxString toString(wxT(" ")+_("to")+wxT(" "));