- many fixes + version increase to 0.1.9
This commit is contained in:
parent
6c495b6c7f
commit
21046d9c35
@ -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 8
|
#define QBREAK_VERSION_SUFFIX 9
|
||||||
|
|
||||||
// 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)
|
||||||
@ -12,7 +12,7 @@
|
|||||||
// How often progress bar is updated - interval in milliseconds
|
// How often progress bar is updated - interval in milliseconds
|
||||||
#define INTERVAL_UPDATE_PROGRESS (1000)
|
#define INTERVAL_UPDATE_PROGRESS (1000)
|
||||||
|
|
||||||
// How long notification is shown - in milliseconds
|
// How long notification is shown - in seconds
|
||||||
#define INTERVAL_NOTIFICATION (30000)
|
#define INTERVAL_NOTIFICATION (30)
|
||||||
|
|
||||||
#endif // CONFIG_H
|
#endif // CONFIG_H
|
||||||
|
|||||||
@ -384,6 +384,7 @@ void MainWindow::onLongBreakStart()
|
|||||||
{
|
{
|
||||||
mBreakStartTimer->stop();
|
mBreakStartTimer->stop();
|
||||||
mBreakNotifyTimer->stop();
|
mBreakNotifyTimer->stop();
|
||||||
|
qDebug() << "Stop main and notify timers.";
|
||||||
|
|
||||||
// Reset idle counter
|
// Reset idle counter
|
||||||
mIdleStart.reset();
|
mIdleStart.reset();
|
||||||
@ -418,9 +419,15 @@ void MainWindow::onLongBreakEnd()
|
|||||||
|
|
||||||
// Start new timer
|
// Start new timer
|
||||||
if (!mBreakStartTimer->isActive())
|
if (!mBreakStartTimer->isActive())
|
||||||
|
{
|
||||||
mBreakStartTimer->start(std::chrono::seconds(mAppConfig.longbreak_interval));
|
mBreakStartTimer->start(std::chrono::seconds(mAppConfig.longbreak_interval));
|
||||||
|
qDebug() << "Start main timer for " << mAppConfig.longbreak_interval << " seconds.";
|
||||||
|
}
|
||||||
if (!mBreakNotifyTimer->isActive())
|
if (!mBreakNotifyTimer->isActive())
|
||||||
|
{
|
||||||
mBreakNotifyTimer->start(std::chrono::seconds(mAppConfig.longbreak_interval - 30));
|
mBreakNotifyTimer->start(std::chrono::seconds(mAppConfig.longbreak_interval - 30));
|
||||||
|
qDebug() << "Start notify timer for " << mAppConfig.longbreak_interval - 30 << " seconds.";
|
||||||
|
}
|
||||||
|
|
||||||
// Play selected audio. When break is postponed - audio is not played
|
// Play selected audio. When break is postponed - audio is not played
|
||||||
if (!mPostponeCount)
|
if (!mPostponeCount)
|
||||||
@ -491,11 +498,12 @@ void MainWindow::onIdleStart()
|
|||||||
mIdleStart = std::chrono::steady_clock::now();
|
mIdleStart = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
// How much working time remains
|
// How much working time remains
|
||||||
mWorkInterval = mBreakStartTimer->remainingTime();
|
mRemainingWorkInterval = mBreakStartTimer->remainingTime() / 1000;
|
||||||
|
|
||||||
// Stop main & notify timers
|
// Stop main & notify timers
|
||||||
mBreakStartTimer->stop();
|
mBreakStartTimer->stop();
|
||||||
mBreakNotifyTimer->stop();
|
mBreakNotifyTimer->stop();
|
||||||
|
qDebug() << "Stop main and notify timers.";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onIdleEnd()
|
void MainWindow::onIdleEnd()
|
||||||
@ -506,14 +514,24 @@ void MainWindow::onIdleEnd()
|
|||||||
mIdleStart.reset();
|
mIdleStart.reset();
|
||||||
|
|
||||||
// Update timer(s) duration
|
// Update timer(s) duration
|
||||||
if (mWorkInterval >= 0)
|
if (mRemainingWorkInterval)
|
||||||
{
|
{
|
||||||
mBreakStartTimer->setInterval(mWorkInterval);
|
mBreakStartTimer->setInterval(std::chrono::seconds(*mRemainingWorkInterval));
|
||||||
if (mWorkInterval > INTERVAL_NOTIFICATION)
|
if (mRemainingWorkInterval > INTERVAL_NOTIFICATION)
|
||||||
mBreakNotifyTimer->setInterval(mWorkInterval - INTERVAL_NOTIFICATION);
|
mBreakNotifyTimer->setInterval(std::chrono::seconds(*mRemainingWorkInterval - INTERVAL_NOTIFICATION));
|
||||||
|
mRemainingWorkInterval.reset();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mBreakStartTimer->setInterval(std::chrono::seconds(mAppConfig.longbreak_interval));
|
||||||
|
if (mRemainingWorkInterval > INTERVAL_NOTIFICATION)
|
||||||
|
mBreakNotifyTimer->setInterval(std::chrono::seconds(mAppConfig.longbreak_interval - INTERVAL_NOTIFICATION));
|
||||||
}
|
}
|
||||||
|
|
||||||
mWorkInterval = mAppConfig.longbreak_interval * 1000;
|
if (!mBreakStartTimer->isActive())
|
||||||
|
mBreakStartTimer->start();
|
||||||
|
if (!mBreakNotifyTimer->isActive())
|
||||||
|
mBreakNotifyTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onSettings()
|
void MainWindow::onSettings()
|
||||||
|
|||||||
@ -50,7 +50,7 @@ private:
|
|||||||
std::chrono::steady_clock::time_point mBreakStartTime;
|
std::chrono::steady_clock::time_point mBreakStartTime;
|
||||||
|
|
||||||
// How much milliseconds remains for main break
|
// How much milliseconds remains for main break
|
||||||
int mWorkInterval = -1;
|
std::optional<int> mRemainingWorkInterval;
|
||||||
|
|
||||||
app_settings::config mAppConfig;
|
app_settings::config mAppConfig;
|
||||||
int mPostponeCount;
|
int mPostponeCount;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user