Merge pull request #4955 from Vulpine05/Vulpine05-4939_Mgr

[Manager] [Advanced View] Add warning message in preferences for suspension
This commit is contained in:
Vitalii Koshura 2022-11-28 13:38:20 +01:00 committed by GitHub
commit d238b9bab3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -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,22 @@ bool CDlgAdvPreferences::ValidateInput() {
}
}
// 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);
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;
}
}
if (m_txtMaxLoad->IsEnabled()) {
buffer = m_txtMaxLoad->GetValue();
if(!IsValidFloatValueBetween(buffer, 1.0, 100.0)) {