.TH "ProjectUsageTracker" 3 "Version 0.200.1-dev" "QElectroTech" \" -*- nroff -*-
.ad l
.nh
.SH NAME
ProjectUsageTracker \- The \fBProjectUsageTracker\fP 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\&.  

.SH SYNOPSIS
.br
.PP
.PP
\fR#include <projectusagetracker\&.h>\fP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBProjectUsageTracker\fP ()=default"
.br
.ti -1c
.RI "qint64 \fBsecondsSpent\fP () const"
.br
.RI "\fBProjectUsageTracker::secondsSpent\fP\&. "
.ti -1c
.RI "void \fBresetSecondsSpent\fP ()"
.br
.RI "\fBProjectUsageTracker::resetSecondsSpent\fP Zero the accumulated time\&. If the tracker is currently timing, it keeps timing from this point on\&. "
.ti -1c
.RI "bool \fBisEnabled\fP () const"
.br
.ti -1c
.RI "void \fBsetEnabled\fP (bool enabled)"
.br
.RI "\fBProjectUsageTracker::setEnabled\fP 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\&. "
.ti -1c
.RI "void \fBsetActive\fP (bool active)"
.br
.RI "\fBProjectUsageTracker::setActive\fP 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\&. "
.ti -1c
.RI "void \fBtoXml\fP (QDomElement &parent_element) const"
.br
.RI "\fBProjectUsageTracker::toXml\fP Append a <usage> child element to \fRparent_element\fP with the current accumulated time and enabled state\&. "
.ti -1c
.RI "void \fBfromXml\fP (const QDomElement &parent_element)"
.br
.RI "\fBProjectUsageTracker::fromXml\fP Read the <usage> child element of \fRparent_element\fP, if any\&. "
.in -1c
.SS "Private Attributes"

.in +1c
.ti -1c
.RI "qint64 \fBm_seconds_spent\fP = 0"
.br
.ti -1c
.RI "bool \fBm_enabled\fP = true"
.br
.ti -1c
.RI "bool \fBm_active\fP = false"
.br
.ti -1c
.RI "QElapsedTimer \fBm_elapsed_timer\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
The \fBProjectUsageTracker\fP 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 (\fBQETDiagramEditor\fP) 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, \&.\&.\&.)\&. 
.SH "Constructor & Destructor Documentation"
.PP 
.SS "ProjectUsageTracker::ProjectUsageTracker ()\fR [default]\fP"

.SH "Member Function Documentation"
.PP 
.SS "void ProjectUsageTracker::fromXml (const QDomElement & parent_element)"

.PP
\fBProjectUsageTracker::fromXml\fP Read the <usage> child element of \fRparent_element\fP, if any\&. 
.PP
\fBParameters\fP
.RS 4
\fIparent_element\fP 
.RE
.PP

.SS "bool ProjectUsageTracker::isEnabled () const\fR [inline]\fP"

.SS "void ProjectUsageTracker::resetSecondsSpent ()"

.PP
\fBProjectUsageTracker::resetSecondsSpent\fP Zero the accumulated time\&. If the tracker is currently timing, it keeps timing from this point on\&. 
.SS "qint64 ProjectUsageTracker::secondsSpent () const"

.PP
\fBProjectUsageTracker::secondsSpent\fP\&. 
.PP
\fBReturns\fP
.RS 4
the total accumulated time, in seconds, including the time elapsed since the tracker was last made active (if it currently is)\&. 
.RE
.PP

.SS "void ProjectUsageTracker::setActive (bool active)"

.PP
\fBProjectUsageTracker::setActive\fP 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\&. 
.PP
\fBParameters\fP
.RS 4
\fIactive\fP 
.RE
.PP

.SS "void ProjectUsageTracker::setEnabled (bool enabled)"

.PP
\fBProjectUsageTracker::setEnabled\fP 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\&. 
.PP
\fBParameters\fP
.RS 4
\fIenabled\fP 
.RE
.PP

.SS "void ProjectUsageTracker::toXml (QDomElement & parent_element) const"

.PP
\fBProjectUsageTracker::toXml\fP Append a <usage> child element to \fRparent_element\fP with the current accumulated time and enabled state\&. 
.PP
\fBParameters\fP
.RS 4
\fIparent_element\fP 
.RE
.PP

.SH "Member Data Documentation"
.PP 
.SS "bool ProjectUsageTracker::m_active = false\fR [private]\fP"

.SS "QElapsedTimer ProjectUsageTracker::m_elapsed_timer\fR [private]\fP"

.SS "bool ProjectUsageTracker::m_enabled = true\fR [private]\fP"

.SS "qint64 ProjectUsageTracker::m_seconds_spent = 0\fR [private]\fP"


.SH "Author"
.PP 
Generated automatically by Doxygen for QElectroTech from the source code\&.
