|
QDriverStation
The free, cross-platform FRC Driver Station
|
Provides CPU and Battery information to the QML interface. More...
#include <utilities.h>
Public Slots | |
| void | copy (const QVariant &data) |
| void | setAutoScaleEnabled (const bool enabled) |
Public Member Functions | |
| Utilities () | |
| Q_INVOKABLE int | cpuUsage () |
| Q_INVOKABLE int | batteryLevel () |
| Q_INVOKABLE qreal | scaleRatio () |
| Q_INVOKABLE bool | isConnectedToAC () |
Private Slots | |
| void | updateCpuUsage () |
| void | updateBatteryLevel () |
| void | updateConnectedToAC () |
| void | calculateScaleRatio () |
| void | readCpuUsageProcess (int exit_code=0) |
| void | readBatteryLevelProcess (int exit_code=0) |
| void | readConnectedToACProcess (int exit_code=0) |
Private Attributes | |
| qreal | m_ratio |
| int | m_cpuUsage |
| int | m_batteryLevel |
| bool | m_connectedToAC |
| QSettings * | m_settings |
| QProcess | m_cpuProcess |
| QProcess | m_batteryLevelProcess |
| QProcess | m_connectedToACProcess |
Provides CPU and Battery information to the QML interface.
|
explicit |
Configures the class and nitializes the CPU querying process under Windows.
References readBatteryLevelProcess(), readConnectedToACProcess(), readCpuUsageProcess(), updateBatteryLevel(), updateConnectedToAC(), and updateCpuUsage().
| int Utilities::batteryLevel | ( | ) |
Returns the current battery level (from 0 to 100)
|
privateslot |
Calculates the scale factor to apply to the UI.
Referenced by scaleRatio().
|
slot |
Copies the given data to the system clipboard
| int Utilities::cpuUsage | ( | ) |
Returns the current CPU usage (from 0 to 100)
| bool Utilities::isConnectedToAC | ( | ) |
Returns true if the computer is connected to a power source or the battery is not discharging.
|
privateslot |
Reads the output of the process launched to get the battery level
Referenced by Utilities().
|
privateslot |
Reads the output of the process launched to get the AC power source status
Referenced by Utilities().
|
privateslot |
Reads the output of the process launched to get the CPU usage
Referenced by Utilities().
| qreal Utilities::scaleRatio | ( | ) |
Returns the auto-calculates scale ratio
References calculateScaleRatio().
|
slot |
Enables or disables the autoscale feature.
|
privateslot |
Queries for the current battery level
Referenced by Utilities().
|
privateslot |
Queries for the current AC power source status
Referenced by Utilities().
|
privateslot |
Queries for the current CPU usage
Referenced by Utilities().
1.8.11