- fix the strange behavior when user missed break and start of next working interval
This commit is contained in:
parent
24b470cfc6
commit
eed9e13e91
@ -4,7 +4,7 @@
|
|||||||
// App version
|
// App version
|
||||||
#define QBREAK_VERSION_MAJOR 0
|
#define QBREAK_VERSION_MAJOR 0
|
||||||
#define QBREAK_VERSION_MINOR 1
|
#define QBREAK_VERSION_MINOR 1
|
||||||
#define QBREAK_VERSION_SUFFIX 5
|
#define QBREAK_VERSION_SUFFIX 6
|
||||||
|
|
||||||
// How often UI is updated - interval in seconds
|
// How often UI is updated - interval in seconds
|
||||||
#define INTERVAL_UPDATE_UI (60)
|
#define INTERVAL_UPDATE_UI (60)
|
||||||
|
|||||||
@ -271,8 +271,14 @@ void MainWindow::onUpdateUI()
|
|||||||
{
|
{
|
||||||
if (!mIdleStart)
|
if (!mIdleStart)
|
||||||
{
|
{
|
||||||
|
// Idle could start before timer start
|
||||||
|
// Check and shrink the found idle interval if needed
|
||||||
|
auto proposed_idle_start = std::chrono::steady_clock::now() - std::chrono::milliseconds(idle_milliseconds);
|
||||||
|
auto timer_start = std::chrono::steady_clock::now() - (std::chrono::milliseconds(mTimer->interval() - mTimer->remainingTime()));
|
||||||
|
mIdleStart = std::max(timer_start, proposed_idle_start);
|
||||||
|
|
||||||
// Start idle mode. Save idle start time
|
// Start idle mode. Save idle start time
|
||||||
mIdleStart = std::chrono::steady_clock::now() - std::chrono::milliseconds(idle_milliseconds);
|
// mIdleStart = std::chrono::steady_clock::now() - std::chrono::milliseconds(idle_milliseconds);
|
||||||
if (mTimer->isActive())
|
if (mTimer->isActive())
|
||||||
{
|
{
|
||||||
// Save how much time was remaininig when idle was detected + add idle length
|
// Save how much time was remaininig when idle was detected + add idle length
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user