Skip to content

Commit 6fcc1a2

Browse files
committed
Expanded Min & Max interval values, with constexpr defs
1 parent 3313591 commit 6fcc1a2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

StayAwake/StayAwakeDlg.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ BOOL CStayAwakeDlg::OnInitDialog()
7070
SetIcon(m_hIcon, TRUE); // Set big icon
7171
SetIcon(m_hIcon, FALSE); // Set small icon
7272

73-
Utils::addTooltip(theApp.m_hInstance, m_hWnd, IDC_INTERVAL, L"", L"Number between 30 and 3600", 3, TRUE);
73+
Utils::addTooltip(theApp.m_hInstance, m_hWnd, IDC_INTERVAL, L"",
74+
wstring{ L"Number between " } + to_wstring(MIN_PERIOD) + L" and " + to_wstring(MAX_PERIOD), 3, TRUE);
7475
Utils::addTooltip(theApp.m_hInstance, m_hWnd, IDC_ABOUT_BUTTON, L"", L"About StayAwake", 3, TRUE);
7576
Utils::loadBitmap(theApp.m_hInstance, m_hWnd, IDC_ABOUT_BUTTON, IDB_ABOUT_BITMAP);
7677

@@ -148,9 +149,10 @@ void CStayAwakeDlg::OnKillfocusInterval()
148149

149150
nInterval = GetDlgItemInt(IDC_INTERVAL, nullptr, FALSE);
150151

151-
if (nInterval < 30 || nInterval > 3600)
152+
if (nInterval < MIN_PERIOD || nInterval > MAX_PERIOD)
152153
{
153-
Utils::showEditBalloonTip(GetDlgItem(IDC_INTERVAL)->m_hWnd, L"Timer Interval in seconds", L"Please enter a value between 30 and 3600");
154+
Utils::showEditBalloonTip(GetDlgItem(IDC_INTERVAL)->m_hWnd, L"Timer Interval in seconds",
155+
(wstring{ L"Please enter a value between " } + to_wstring(MIN_PERIOD) + L" and " + to_wstring(MAX_PERIOD)).c_str());
154156
SetDlgItemInt(IDC_INTERVAL, m_TimerSeconds, FALSE);
155157
return;
156158
}

StayAwake/StayAwakeDlg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ constexpr auto PREF_DEFAULTS = L"Defaults";
1010
constexpr auto PREF_MULTI_INSTANCE = L"MultipleInstancesAllowed";
1111
constexpr auto PREF_TIMER_INTERVAL = L"TimerIntervalInSeconds";
1212

13+
constexpr auto MIN_PERIOD{ 10 };
14+
constexpr auto MAX_PERIOD{ 9990 };
1315

1416
class CStayAwakeDlg : public CDialogEx
1517
{

0 commit comments

Comments
 (0)