Changeset View
Changeset View
Standalone View
Standalone View
src/rsitimer.cpp
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Line(s) | 94 | { | |||
---|---|---|---|---|---|
102 | return totalIdle; | 102 | return totalIdle; | ||
103 | } | 103 | } | ||
104 | 104 | | |||
105 | void RSITimer::doBreakNow( const int breakTime, const bool nextBreakIsBig ) | 105 | void RSITimer::doBreakNow( const int breakTime, const bool nextBreakIsBig ) | ||
106 | { | 106 | { | ||
107 | m_state = TimerState::Resting; | 107 | m_state = TimerState::Resting; | ||
108 | m_pauseCounter = std::unique_ptr<RSITimerCounter> { new RSITimerCounter( breakTime, breakTime, INT_MAX ) }; | 108 | m_pauseCounter = std::unique_ptr<RSITimerCounter> { new RSITimerCounter( breakTime, breakTime, INT_MAX ) }; | ||
109 | m_popupCounter = nullptr; | 109 | m_popupCounter = nullptr; | ||
110 | m_shortInputCounter = std::unique_ptr<RSITimerCounter> { new RSITimerCounter( m_intervals[SHORT_INPUT_INTERVAL], 1, 1 ) }; | ||||
110 | if ( nextBreakIsBig ) { | 111 | if ( nextBreakIsBig ) { | ||
111 | emit startLongBreak(); | 112 | emit startLongBreak(); | ||
112 | } else { | 113 | } else { | ||
113 | emit startShortBreak(); | 114 | emit startShortBreak(); | ||
114 | } | 115 | } | ||
115 | emit updateWidget( breakTime ); | 116 | emit updateWidget( breakTime ); | ||
116 | emit breakNow(); | 117 | emit breakNow(); | ||
117 | } | 118 | } | ||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Line(s) | 264 | if ( breakTime > 0 ) { | |||
266 | break; | 267 | break; | ||
267 | } | 268 | } | ||
268 | emit relax( m_pauseCounter->counterLeft(), false ); | 269 | emit relax( m_pauseCounter->counterLeft(), false ); | ||
269 | emit updateWidget( m_pauseCounter->counterLeft() ); | 270 | emit updateWidget( m_pauseCounter->counterLeft() ); | ||
270 | break; | 271 | break; | ||
271 | } | 272 | } | ||
272 | case TimerState::Resting: { | 273 | case TimerState::Resting: { | ||
273 | bool isInputLong = (m_shortInputCounter->tick(idleSeconds) > 0); | 274 | bool isInputLong = (m_shortInputCounter->tick(idleSeconds) > 0); | ||
274 | int inverseTick = ( idleSeconds == 0 && isInputLong > 0 ) ? 1 : 0; // inverting as we account idle seconds here. | 275 | int inverseTick = ( idleSeconds == 0 && isInputLong ) ? 1 : 0; // inverting as we account idle seconds here. | ||
275 | int breakTime = m_pauseCounter->tick( inverseTick ); | 276 | int breakTime = m_pauseCounter->tick( inverseTick ); | ||
276 | if ( breakTime > 0 ) { | 277 | if ( breakTime > 0 ) { | ||
277 | resetAfterBreak(); | 278 | resetAfterBreak(); | ||
278 | } else { | 279 | } else { | ||
279 | emit updateWidget( m_pauseCounter->counterLeft() ); | 280 | emit updateWidget( m_pauseCounter->counterLeft() ); | ||
280 | } | 281 | } | ||
281 | break; | 282 | break; | ||
282 | } | 283 | } | ||
Show All 26 Lines | 291 | { | |||
309 | m_popupCounter = std::unique_ptr<RSITimerCounter> { | 310 | m_popupCounter = std::unique_ptr<RSITimerCounter> { | ||
310 | new RSITimerCounter( m_intervals[PATIENCE_INTERVAL], breakTime, m_intervals[PATIENCE_INTERVAL] / 2 ) | 311 | new RSITimerCounter( m_intervals[PATIENCE_INTERVAL], breakTime, m_intervals[PATIENCE_INTERVAL] / 2 ) | ||
311 | }; | 312 | }; | ||
312 | // Threshold of one means the timer is reset on every non-zero tick. | 313 | // Threshold of one means the timer is reset on every non-zero tick. | ||
313 | m_pauseCounter = std::unique_ptr<RSITimerCounter> { new RSITimerCounter( breakTime, breakTime, 1 ) }; | 314 | m_pauseCounter = std::unique_ptr<RSITimerCounter> { new RSITimerCounter( breakTime, breakTime, 1 ) }; | ||
314 | 315 | | |||
315 | // For measuring input duration in order to limit influence of short inputs on resetting pause counter. | 316 | // For measuring input duration in order to limit influence of short inputs on resetting pause counter. | ||
316 | // Example of short input is: mouse sent input due to accidental touch or desk vibration. | 317 | // Example of short input is: mouse sent input due to accidental touch or desk vibration. | ||
317 | m_shortInputCounter = std::unique_ptr<RSITimerCounter> { new RSITimerCounter( 2, 2, 1 ) }; | 318 | m_shortInputCounter = std::unique_ptr<RSITimerCounter> { new RSITimerCounter( m_intervals[SHORT_INPUT_INTERVAL], 1, 1 ) }; | ||
aacid: So you change this from 2,2,1 to 2,1,1
that ok? | |||||
Yes. Number in the middle has no other meaning than to indicate, that this counter got activated and it does that by showing any positive and non-zero value. wojnilowicz: Yes. Number in the middle has no other meaning than to indicate, that this counter got… | |||||
318 | 319 | | |||
319 | emit relax( breakTime, nextOneIsBig ); | 320 | emit relax( breakTime, nextOneIsBig ); | ||
320 | } | 321 | } | ||
321 | 322 | | |||
322 | void RSITimer::defaultUpdateToolTip() | 323 | void RSITimer::defaultUpdateToolTip() | ||
323 | { | 324 | { | ||
324 | emit updateToolTip( m_tinyBreakCounter->counterLeft(), m_bigBreakCounter->counterLeft() ); | 325 | emit updateToolTip( m_tinyBreakCounter->counterLeft(), m_bigBreakCounter->counterLeft() ); | ||
325 | } | 326 | } |
So you change this from 2,2,1 to 2,1,1
that ok?