QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
ProjectUsageTracker Class Reference

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>

Collaboration diagram for ProjectUsageTracker:
Collaboration graph

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

Detailed Description

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, ...).

Constructor & Destructor Documentation

◆ ProjectUsageTracker()

ProjectUsageTracker::ProjectUsageTracker ( )
default

Member Function Documentation

◆ fromXml()

void ProjectUsageTracker::fromXml ( const QDomElement & parent_element)

ProjectUsageTracker::fromXml Read the <usage> child element of parent_element, if any.

Parameters
parent_element

◆ isEnabled()

bool ProjectUsageTracker::isEnabled ( ) const
inline
Here is the caller graph for this function:

◆ resetSecondsSpent()

void ProjectUsageTracker::resetSecondsSpent ( )

ProjectUsageTracker::resetSecondsSpent Zero the accumulated time. If the tracker is currently timing, it keeps timing from this point on.

◆ secondsSpent()

qint64 ProjectUsageTracker::secondsSpent ( ) const

ProjectUsageTracker::secondsSpent.

Returns
the total accumulated time, in seconds, including the time elapsed since the tracker was last made active (if it currently is).
Here is the caller graph for this function:

◆ setActive()

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.

Parameters
active

◆ setEnabled()

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.

Parameters
enabled
Here is the caller graph for this function:

◆ toXml()

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.

Parameters
parent_element
Here is the call graph for this function:

Member Data Documentation

◆ m_active

bool ProjectUsageTracker::m_active = false
private

◆ m_elapsed_timer

QElapsedTimer ProjectUsageTracker::m_elapsed_timer
private

◆ m_enabled

bool ProjectUsageTracker::m_enabled = true
private

◆ m_seconds_spent

qint64 ProjectUsageTracker::m_seconds_spent = 0
private

The documentation for this class was generated from the following files: