From 8fa640cb1f93ac156c135266fefcbbeb33f48f3b Mon Sep 17 00:00:00 2001 From: Vulpine05 Date: Fri, 7 Oct 2022 21:58:47 -0500 Subject: [PATCH 1/2] Add warning message if suspend when idle is less than in use suspension time. --- clientgui/DlgAdvPreferences.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/clientgui/DlgAdvPreferences.cpp b/clientgui/DlgAdvPreferences.cpp index d2eb50a24d..82368d53c7 100644 --- a/clientgui/DlgAdvPreferences.cpp +++ b/clientgui/DlgAdvPreferences.cpp @@ -744,6 +744,7 @@ bool CDlgAdvPreferences::ValidateInput() { wxString invMsgLimit10 = _("Number must be between 0 and 10"); wxString invMsgLimit100 = _("Number must be between 0 and 100"); wxString invMsgLimit1_100 = _("Number must be between 1 and 100"); + wxString invMsgIdle = _("Suspend when no mouse or keyboard input needs to be greater than 'in use' mouse or keyboard input."); wxString buffer; double startTime, endTime; @@ -783,6 +784,31 @@ bool CDlgAdvPreferences::ValidateInput() { } } + // It is possible that the computer will not process tasks + // if the time for no recent input is nonzero and is less than or + // equal to the idle time before computing resumes (ProcIdleFor). + // This will check that condition and return an error. + // + if (m_txtProcIdleFor->IsEnabled() && m_chkNoRecentInput->IsChecked()) { + wxString bufferNRI = m_txtNoRecentInput->GetValue(); + double valueNRI; + bufferNRI.ToDouble(&valueNRI); + // Since these values will be stored rounded to the hundredth, it should + // be evaluated that way. + // + valueNRI = RoundToHundredths(valueNRI); + if (valueNRI > 0) { + wxString bufferPIF = m_txtProcIdleFor->GetValue(); + double valuePIF; + bufferPIF.ToDouble(&valuePIF); + valuePIF = RoundToHundredths(valuePIF); + if (valueNRI <= valuePIF) { + ShowErrorMessage(invMsgIdle, m_txtNoRecentInput); + return false; + } + } + } + if (m_txtMaxLoad->IsEnabled()) { buffer = m_txtMaxLoad->GetValue(); if(!IsValidFloatValueBetween(buffer, 1.0, 100.0)) { From eafec2deeea4724a3518834bf85dddebb7219fae Mon Sep 17 00:00:00 2001 From: Vulpine05 Date: Sun, 9 Oct 2022 21:08:20 -0500 Subject: [PATCH 2/2] Simplified logic in checking niu and in use time overlap. --- clientgui/DlgAdvPreferences.cpp | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/clientgui/DlgAdvPreferences.cpp b/clientgui/DlgAdvPreferences.cpp index 82368d53c7..5755309539 100644 --- a/clientgui/DlgAdvPreferences.cpp +++ b/clientgui/DlgAdvPreferences.cpp @@ -784,28 +784,19 @@ bool CDlgAdvPreferences::ValidateInput() { } } - // It is possible that the computer will not process tasks - // if the time for no recent input is nonzero and is less than or - // equal to the idle time before computing resumes (ProcIdleFor). - // This will check that condition and return an error. + // Checks for a condition where no computing could occur if suspended until idle and + // suspend after being idle overlap. // if (m_txtProcIdleFor->IsEnabled() && m_chkNoRecentInput->IsChecked()) { wxString bufferNRI = m_txtNoRecentInput->GetValue(); + wxString bufferPIF = m_txtProcIdleFor->GetValue(); double valueNRI; bufferNRI.ToDouble(&valueNRI); - // Since these values will be stored rounded to the hundredth, it should - // be evaluated that way. - // - valueNRI = RoundToHundredths(valueNRI); - if (valueNRI > 0) { - wxString bufferPIF = m_txtProcIdleFor->GetValue(); - double valuePIF; - bufferPIF.ToDouble(&valuePIF); - valuePIF = RoundToHundredths(valuePIF); - if (valueNRI <= valuePIF) { - ShowErrorMessage(invMsgIdle, m_txtNoRecentInput); - return false; - } + double valuePIF; + bufferPIF.ToDouble(&valuePIF); + if((valuePIF - valueNRI + 0.005) >=0) { // 0.005 is included to factor in rounding to nearest hundredth + ShowErrorMessage(invMsgIdle, m_txtNoRecentInput); + return false; } }