Skip to content

Commit

Permalink
Refactor: rename functions
Browse files Browse the repository at this point in the history
* getIntervalDurationCompleteTime -> getIntervalDuration
* getIntervalDurationRunningTime -> getIntervalElapsedTime

Ticket: #5
  • Loading branch information
Sebastian Hahn committed Jan 20, 2022
1 parent 3aeab97 commit 3e43014
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
15 changes: 5 additions & 10 deletions src/Intervaltimer/intervaltimer/PlanRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,21 @@
PlanRunner::PlanRunner(QObject* object)
: QObject(object) {}

int PlanRunner::getPlanDurationCompleteTime() const { return planTimer->getDuration().count(); }

int PlanRunner::getPlanDurationCompleteTime() const { return plan->getDuration().count(); }

int PlanRunner::getPlanDurationRunningTime() const {
return getPlanDurationCompleteTime() - planTimer->remainingTimeAsDuration().count();
}
int PlanRunner::getPlanDurationRunningTime() const { return planTimer->getElapsedTime().count(); }

QString PlanRunner::getDescriptionOfInterval() const {
Q_ASSERT(iterator != PlanIterator{});
return iterator->getDescription();
}

int PlanRunner::getIntervalDurationCompleteTime() const {
int PlanRunner::getIntervalDuration() const {
Q_ASSERT(iterator != PlanIterator{});
return iterator->getDuration<std::chrono::milliseconds>().count();
}

int PlanRunner::getIntervalDurationRunningTime() const {
return getIntervalDurationCompleteTime() - intervalTimer->remainingTimeAsDuration().count();
}
int PlanRunner::getIntervalElapsedTime() const { return intervalTimer->getElapsedTime().count(); }

std::weak_ptr<Plan> PlanRunner::getPlan() const { return plan; }

Expand All @@ -47,7 +42,7 @@ void PlanRunner::start() {
connect(intervalRefreshingTimer.get(), SIGNAL(timeout()), this, SLOT(changedIntervalRunningTime()));
connect(planRefreshingTimer.get(), SIGNAL(timeout()), this, SLOT(changedPlanRunningTime()));
planRefreshingTimer->start(refreshingTimeForRunningPlan);
planTimer->start(getPlanDurationCompleteTime());
planTimer->start(plan->getDuration());
isRunning = true;
iterator = plan->begin();
startInterval();
Expand Down
8 changes: 4 additions & 4 deletions src/Intervaltimer/intervaltimer/PlanRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class PlanRunner : public QObject {
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(QString intervalDescription READ getDescriptionOfInterval NOTIFY changedDescriptionOfInterval);
Q_PROPERTY(int intervalDurationCompleteTime READ getIntervalDurationCompleteTime NOTIFY
Q_PROPERTY(int intervalDurationCompleteTime READ getIntervalDuration NOTIFY
changedIntervalDurationCompleteTime);
Q_PROPERTY(
int intervalDurationRunningTime READ getIntervalDurationRunningTime NOTIFY changedIntervalDurationRunningTime);
int intervalDurationRunningTime READ getIntervalElapsedTime NOTIFY changedIntervalDurationRunningTime);
Q_PROPERTY(int refreshingTimeForInterval READ getRefreshingTimeInterval WRITE setRefreshingTimeInterval);
Q_PROPERTY(int planDurationCompleteTime READ getPlanDurationCompleteTime CONSTANT)
Q_PROPERTY(int planDurationRunningTime READ getPlanDurationRunningTime NOTIFY changedPlanDurationRunningTime)
Expand All @@ -31,8 +31,8 @@ class PlanRunner : public QObject {

QString getDescriptionOfInterval() const;

int getIntervalDurationCompleteTime() const;
int getIntervalDurationRunningTime() const;
int getIntervalDuration() const;
int getIntervalElapsedTime() const;

std::weak_ptr<Plan> getPlan() const;
void setPlan(std::shared_ptr<Plan>);
Expand Down

0 comments on commit 3e43014

Please sign in to comment.