ktexteditor_wakatime v1.5.1
Kate plugin to interface with WakaTime.
Loading...
Searching...
No Matches
Public Types | Public Member Functions
WakaTime Class Reference

#include <wakatime.h>

Inherits QObject.

Public Types

enum  State {
  ErrorSending , NothingToSend , SentSuccessfully , TooSoon ,
  WakaTimeCliNotInPath
}
 

Public Member Functions

 WakaTime (QObject *parent=nullptr)
 
QString getBinPath (const QStringList &binNames)
 
QString getProjectDirectory (const QFileInfo &fileInfo)
 
WakaTime::State send (const QString &filePath, const QString &mode, int lineNumber, int cursorPosition, int linesInFile, bool isWrite)
 

Detailed Description

Wrapper for the wakatime-cli binary.

Definition at line 14 of file wakatime.h.

Member Enumeration Documentation

◆ State

enum State

State returned by send().

Enumerator
ErrorSending 

wakatime-cli exited with non-zero.

NothingToSend 

Filename was empty.

SentSuccessfully 

Successful request.

TooSoon 

send() called too soon since last time.

WakaTimeCliNotInPath 

wakatime or wakatime-cli not in PATH.

Definition at line 22 of file wakatime.h.

Constructor & Destructor Documentation

◆ WakaTime()

WakaTime ( QObject *  parent = nullptr)

Constructor.

Definition at line 12 of file wakatime.cpp.

Member Function Documentation

◆ getBinPath()

QString getBinPath ( const QStringList &  binNames)

Find the full path to a file based on the PATH environment variable. Equivalent to command -v or which. Does not check if the file is executable.

Parameters
binNamesThe names of the binary to find.
Returns
The full path to the binary if found, otherwise an empty string.

Definition at line 16 of file wakatime.cpp.

+ Here is the caller graph for this function:

◆ getProjectDirectory()

QString getProjectDirectory ( const QFileInfo &  fileInfo)

Get the project name by traversing up until .git or .svn is found.

Parameters
fileInfoThe QFileInfo of the file to get the project directory for.
Returns
The project directory name if found, otherwise an empty string.

Definition at line 47 of file wakatime.cpp.

+ Here is the caller graph for this function:

◆ send()

WakaTime::State send ( const QString &  filePath,
const QString &  mode,
int  lineNumber,
int  cursorPosition,
int  linesInFile,
bool  isWrite 
)

Send statistics to WakaTime.

Parameters
filePathThe file path to send statistics for.
modeThe language mode of the file.
lineNumberThe line number of the cursor position.
cursorPositionThe column number of the cursor position.
linesInFileThe total number of lines in the file.
isWriteWhether this is a write event (true) or just a heartbeat (false).
Returns
WakaTime::State indicating the result of the send operation.

Definition at line 72 of file wakatime.cpp.

+ Here is the call graph for this function:

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