MGR: Don't allow user to enter start time = end time for time-of-day or day-of-week preferences

This commit is contained in:
Charlie Fenton 2015-04-07 00:33:09 -07:00
parent 37ae3de469
commit 18538bce7c
2 changed files with 42 additions and 2 deletions

View File

@ -396,7 +396,7 @@ void CDlgAdvPreferences::ReadPreferenceSettings() {
//special day times
for(int i=0; i< 7;i++) {
TIME_SPAN& cpu = prefs.cpu_times.week.days[i];
if(cpu.present) {
if(cpu.present && (cpu.start_hour != cpu.end_hour)) {
procDayChks[i]->SetValue(true);
procDayStartTxts[i]->ChangeValue(DoubleToTimeString(cpu.start_hour));
procDayStopTxts[i]->ChangeValue(DoubleToTimeString(cpu.end_hour));
@ -413,7 +413,7 @@ void CDlgAdvPreferences::ReadPreferenceSettings() {
//special net times
for(int i=0; i< 7;i++) {
TIME_SPAN& net = prefs.net_times.week.days[i];
if(net.present) {
if(net.present && (net.start_hour != net.end_hour)) {
netDayChks[i]->SetValue(true);
netDayStartTxts[i]->ChangeValue(DoubleToTimeString(net.start_hour));
netDayStopTxts[i]->ChangeValue(DoubleToTimeString(net.end_hour));
@ -668,9 +668,11 @@ void CDlgAdvPreferences::UpdateControlStates() {
bool CDlgAdvPreferences::ValidateInput() {
wxString invMsgFloat = _("Invalid number");
wxString invMsgTime = _("Invalid time, value must be between 0:00 and 24:00, format is HH:MM");
wxString invMsgTimeSpan = _("Start time must be different from end time");
wxString invMsgLimit10 = _("Number must be between 0 and 10");
wxString invMsgLimit100 = _("Number must be between 0 and 100");
wxString buffer;
double startTime, endTime;
// ######### proc usage page
buffer = m_txtProcUseProcessors->GetValue();
@ -819,6 +821,12 @@ bool CDlgAdvPreferences::ValidateInput() {
ShowErrorMessage(invMsgTime,m_txtProcEveryDayStop);
return false;
}
startTime = TimeStringToDouble(m_txtProcEveryDayStart->GetValue());
endTime = TimeStringToDouble(m_txtProcEveryDayStop->GetValue());
if (startTime == endTime) {
ShowErrorMessage(invMsgTimeSpan,m_txtProcEveryDayStop);
return false;
}
}
//all text ctrls in proc special time textBox
@ -834,6 +842,12 @@ bool CDlgAdvPreferences::ValidateInput() {
ShowErrorMessage(invMsgTime,procDayStopTxts[i]);
return false;
}
startTime = TimeStringToDouble(procDayStartTxts[i]->GetValue());
endTime = TimeStringToDouble(procDayStopTxts[i]->GetValue());
if (startTime == endTime) {
ShowErrorMessage(invMsgTimeSpan,procDayStopTxts[i]);
return false;
}
}
}
@ -848,6 +862,12 @@ bool CDlgAdvPreferences::ValidateInput() {
ShowErrorMessage(invMsgTime,m_txtNetEveryDayStop);
return false;
}
startTime = TimeStringToDouble(m_txtNetEveryDayStart->GetValue());
endTime = TimeStringToDouble(m_txtNetEveryDayStop->GetValue());
if (startTime == endTime) {
ShowErrorMessage(invMsgTimeSpan,m_txtNetEveryDayStop);
return false;
}
}
//all text ctrls in net special time textBox
@ -863,6 +883,12 @@ bool CDlgAdvPreferences::ValidateInput() {
ShowErrorMessage(invMsgTime,netDayStopTxts[i]);
return false;
}
startTime = TimeStringToDouble(netDayStartTxts[i]->GetValue());
endTime = TimeStringToDouble(netDayStopTxts[i]->GetValue());
if (startTime == endTime) {
ShowErrorMessage(invMsgTimeSpan,netDayStopTxts[i]);
return false;
}
}
}
return true;

View File

@ -750,7 +750,9 @@ bool CPanelPreferences::SavePreferenceSettings() {
bool CPanelPreferences::ValidateInput() {
wxString invMsgFloat = _("Invalid number");
wxString invMsgTime = _("Invalid time, value must be between 0:00 and 24:00, format is HH:MM");
wxString invMsgTimeSpan = _("Start time must be different from end time");
wxString invMsgLimit100 = _("Number must be between 0 and 100");
double startTime, endTime;
wxString buffer;
if(m_txtProcIdleFor->IsEnabled()) {
@ -772,6 +774,12 @@ bool CPanelPreferences::ValidateInput() {
ShowErrorMessage(invMsgTime,m_txtProcEveryDayStop);
return false;
}
startTime = TimeStringToDouble(m_txtProcEveryDayStart->GetValue());
endTime = TimeStringToDouble(m_txtProcEveryDayStop->GetValue());
if (startTime == endTime) {
ShowErrorMessage(invMsgTimeSpan,m_txtProcEveryDayStop);
return false;
}
}
buffer = m_txtProcUseCPUTime->GetValue();
@ -791,6 +799,12 @@ bool CPanelPreferences::ValidateInput() {
ShowErrorMessage(invMsgTime,m_txtNetEveryDayStop);
return false;
}
startTime = TimeStringToDouble(m_txtNetEveryDayStart->GetValue());
endTime = TimeStringToDouble(m_txtNetEveryDayStop->GetValue());
if (startTime == endTime) {
ShowErrorMessage(invMsgTimeSpan,m_txtNetEveryDayStop);
return false;
}
}
if (m_chkDiskMaxSpace->IsChecked()) {