Commit a7a27168 authored by Volker Krause's avatar Volker Krause
Browse files

Unify time units used in the Provider API

Avoid minutes, we only use seconds and days now.
parent 336bb2ac
...@@ -191,7 +191,7 @@ MainWindow::MainWindow() : ...@@ -191,7 +191,7 @@ MainWindow::MainWindow() :
m_feedbackProvider->setEncouragementDelay(60); m_feedbackProvider->setEncouragementDelay(60);
m_feedbackProvider->setEncouragementInterval(5); m_feedbackProvider->setEncouragementInterval(5);
m_feedbackProvider->setApplicationStartsUntilEncouragement(5); m_feedbackProvider->setApplicationStartsUntilEncouragement(5);
m_feedbackProvider->setApplicationUsageTimeUntilEncouragement(10); m_feedbackProvider->setApplicationUsageTimeUntilEncouragement(600); // 10 mins
auto notifyPopup = new UserFeedback::NotificationPopup(this); auto notifyPopup = new UserFeedback::NotificationPopup(this);
notifyPopup->setFeedbackProvider(m_feedbackProvider); notifyPopup->setFeedbackProvider(m_feedbackProvider);
......
...@@ -363,7 +363,7 @@ void ProviderPrivate::scheduleEncouragement() ...@@ -363,7 +363,7 @@ void ProviderPrivate::scheduleEncouragement()
Q_ASSERT(encouragementDelay >= 0); Q_ASSERT(encouragementDelay >= 0);
int timeToEncouragement = encouragementDelay; int timeToEncouragement = encouragementDelay;
if (encouragementTime > 0) if (encouragementTime > 0)
timeToEncouragement = std::max(timeToEncouragement, (encouragementTime * 60) - currentApplicationTime()); timeToEncouragement = std::max(timeToEncouragement, encouragementTime - currentApplicationTime());
if (lastEncouragementTime.isValid()) { if (lastEncouragementTime.isValid()) {
Q_ASSERT(encouragementInterval > 0); Q_ASSERT(encouragementInterval > 0);
const auto targetTime = lastEncouragementTime.addDays(encouragementDelay); const auto targetTime = lastEncouragementTime.addDays(encouragementDelay);
...@@ -492,9 +492,9 @@ void Provider::setApplicationStartsUntilEncouragement(int starts) ...@@ -492,9 +492,9 @@ void Provider::setApplicationStartsUntilEncouragement(int starts)
d->scheduleEncouragement(); d->scheduleEncouragement();
} }
void Provider::setApplicationUsageTimeUntilEncouragement(int minutes) void Provider::setApplicationUsageTimeUntilEncouragement(int secs)
{ {
d->encouragementTime = minutes; d->encouragementTime = secs;
d->scheduleEncouragement(); d->scheduleEncouragement();
} }
......
...@@ -113,8 +113,10 @@ public: ...@@ -113,8 +113,10 @@ public:
/*! Set the amount of application starts until the encouragement message should be shown. */ /*! Set the amount of application starts until the encouragement message should be shown. */
void setApplicationStartsUntilEncouragement(int starts); void setApplicationStartsUntilEncouragement(int starts);
/*! Set the amount of usage time until the encouragement message should be shown. */ /*! Set the amount of usage time until the encouragement message should be shown.
void setApplicationUsageTimeUntilEncouragement(int minutes); * @param secs Amount of seconds until the encouragement should be shown.
*/
void setApplicationUsageTimeUntilEncouragement(int secs);
/*! Set the delay after application start for the earliest display of the encouragement message. */ /*! Set the delay after application start for the earliest display of the encouragement message. */
void setEncouragementDelay(int secs); void setEncouragementDelay(int secs);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment