Skip to content

Commit

Permalink
Manager: fix handling when disabled items are enabled
Browse files Browse the repository at this point in the history
 - replace code lost from commit 27aff32
 - restore previous values from global_prefs.xml or global_prefs_override.xml
  • Loading branch information
Charlie Fenton committed Sep 6, 2022
1 parent 28e9114 commit f627b09
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions clientgui/DlgAdvPreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@ void CDlgAdvPreferences::EnableDisableInUseItem(wxTextCtrl* textCtrl, bool doEna
void CDlgAdvPreferences::EnableDisableInUseItems() {
bool doEnable = !(m_chkProcInUse->IsChecked());
EnableDisableInUseItem(m_txtProcUseProcessors, doEnable,
defaultPrefs.max_ncpus_pct > 0.0 ? defaultPrefs.max_ncpus_pct : 100.0);
EnableDisableInUseItem(m_txtProcUseCPUTime, doEnable, defaultPrefs.cpu_usage_limit);
prefs.max_ncpus_pct > 0.0 ? prefs.max_ncpus_pct : 100.0);
EnableDisableInUseItem(m_txtProcUseCPUTime, doEnable, prefs.cpu_usage_limit);
m_chkMaxLoad->Enable(doEnable);
EnableDisableInUseItem(m_txtMaxLoad, doEnable && m_chkMaxLoad->IsChecked(), defaultPrefs.suspend_cpu_usage);
EnableDisableInUseItem(m_txtMemoryMaxInUse, doEnable, defaultPrefs.ram_max_used_busy_frac*100.0);
EnableDisableInUseItem(m_txtMaxLoad, doEnable && m_chkMaxLoad->IsChecked(), prefs.suspend_cpu_usage);
EnableDisableInUseItem(m_txtMemoryMaxInUse, doEnable, prefs.ram_max_used_busy_frac*100.0);
}

// read preferences from core client and initialize control values
Expand Down Expand Up @@ -748,10 +748,12 @@ bool CDlgAdvPreferences::ValidateInput() {
double startTime, endTime;

// ######### proc usage page
buffer = m_txtProcUseProcessors->GetValue();
if(!IsValidFloatValueBetween(buffer, 0.0, 100.0)) {
ShowErrorMessage(invMsgLimit100, m_txtProcUseProcessors);
return false;
if (m_txtProcUseProcessors->IsEnabled()) {
buffer = m_txtProcUseProcessors->GetValue();
if(!IsValidFloatValueBetween(buffer, 0.0, 100.0)) {
ShowErrorMessage(invMsgLimit100, m_txtProcUseProcessors);
return false;
}
}
buffer = m_txtProcUseProcessorsNotInUse->GetValue();
if(!IsValidFloatValueBetween(buffer, 0.0, 100.0)) {
Expand Down Expand Up @@ -879,10 +881,12 @@ bool CDlgAdvPreferences::ValidateInput() {
}
}

buffer = m_txtMemoryMaxInUse->GetValue();
if(!IsValidFloatValueBetween(buffer, 1.0, 100.0)) {
ShowErrorMessage(invMsgLimit1_100, m_txtMemoryMaxInUse);
return false;
if(m_txtMemoryMaxInUse->IsEnabled()) {
buffer = m_txtMemoryMaxInUse->GetValue();
if(!IsValidFloatValueBetween(buffer, 1.0, 100.0)) {
ShowErrorMessage(invMsgLimit1_100, m_txtMemoryMaxInUse);
return false;
}
}

buffer = m_txtMemoryMaxOnIdle->GetValue();
Expand Down

0 comments on commit f627b09

Please sign in to comment.