Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Concept/includes/timerUI.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

//timerUI.h
#ifndef TIMERUI_H
#define TIMERUI_H
Expand Down Expand Up @@ -31,8 +32,8 @@ class timerStart : public QObject

timerStart(QObject *parent = nullptr);

Timer timer = CountUpTimer();
Timer break_timer = CountUpTimer();
Timer *timer = new CountUpTimer();
Timer *break_timer = new CountUpTimer();

QString time_string = "00:00";

Expand Down Expand Up @@ -74,13 +75,19 @@ public slots:
std::chrono::system_clock::time_point currentTime = std::chrono::system_clock::now();
time_t currentTime_t = std::chrono::system_clock::to_time_t(currentTime);
return currentTime_t;
}
}

bool update_time(Timer *timer);

void set_time_string(Timer *timer) {
time_string = createTimeString(timer->hour, timer->minute, timer->second);
emit timeChanged();
}

bool update_time(Timer &timer);

QString createTimeString(int hours, int minutes, int seconds) {
QString timeString = "";
if (break_timer.counting) {
if (break_timer->counting) {
timeString = "Break: ";
}
if (hours != 0) {
Expand All @@ -89,7 +96,7 @@ public slots:
timeString += QString("%1:%2").arg(minutes, 2, 10, QChar('0')).arg(seconds, 2, 10, QChar('0'));
}
return timeString;
}
}



Expand Down
Loading