![]() |
QElectroTech 0.200.1-dev
|
The ProjectUsageTracker class Accumulates how long a project has been the active tab, purely locally: the value lives only in the project's own file (a <usage> element next to <properties>) and is never transmitted anywhere. More...
#include <projectusagetracker.h>
Public Member Functions | |
| ProjectUsageTracker ()=default | |
| qint64 | secondsSpent () const |
| ProjectUsageTracker::secondsSpent. | |
| void | resetSecondsSpent () |
| ProjectUsageTracker::resetSecondsSpent Zero the accumulated time. If the tracker is currently timing, it keeps timing from this point on. | |
| bool | isEnabled () const |
| void | setEnabled (bool enabled) |
| ProjectUsageTracker::setEnabled Enable or disable time tracking for this project. Disabling while currently timing flushes the elapsed time first; re-enabling while the project is the active tab resumes timing immediately. | |
| void | setActive (bool active) |
| ProjectUsageTracker::setActive Tell the tracker whether this project's tab is currently the active one. No-op if tracking is disabled or the state doesn't change. | |
| void | toXml (QDomElement &parent_element) const |
ProjectUsageTracker::toXml Append a <usage> child element to parent_element with the current accumulated time and enabled state. | |
| void | fromXml (const QDomElement &parent_element) |
ProjectUsageTracker::fromXml Read the <usage> child element of parent_element, if any. | |
Private Attributes | |
| qint64 | m_seconds_spent = 0 |
| bool | m_enabled = true |
| bool | m_active = false |
| QElapsedTimer | m_elapsed_timer |
The ProjectUsageTracker class Accumulates how long a project has been the active tab, purely locally: the value lives only in the project's own file (a <usage> element next to <properties>) and is never transmitted anywhere.
The owning code (QETDiagramEditor) is expected to call setActive(true) when this project's tab becomes the current one, and setActive(false) when it stops being current (tab switch, project closed, ...).
|
default |
| void ProjectUsageTracker::fromXml | ( | const QDomElement & | parent_element | ) |
ProjectUsageTracker::fromXml Read the <usage> child element of parent_element, if any.
| parent_element |
|
inline |
| void ProjectUsageTracker::resetSecondsSpent | ( | ) |
ProjectUsageTracker::resetSecondsSpent Zero the accumulated time. If the tracker is currently timing, it keeps timing from this point on.
| qint64 ProjectUsageTracker::secondsSpent | ( | ) | const |
ProjectUsageTracker::secondsSpent.
| void ProjectUsageTracker::setActive | ( | bool | active | ) |
ProjectUsageTracker::setActive Tell the tracker whether this project's tab is currently the active one. No-op if tracking is disabled or the state doesn't change.
| active |
| void ProjectUsageTracker::setEnabled | ( | bool | enabled | ) |
ProjectUsageTracker::setEnabled Enable or disable time tracking for this project. Disabling while currently timing flushes the elapsed time first; re-enabling while the project is the active tab resumes timing immediately.
| enabled |
| void ProjectUsageTracker::toXml | ( | QDomElement & | parent_element | ) | const |
ProjectUsageTracker::toXml Append a <usage> child element to parent_element with the current accumulated time and enabled state.
| parent_element |
|
private |
|
private |
|
private |
|
private |