API Documentation
Loading...
Searching...
No Matches
BatteryWidget.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: NDEVR
28File: BatteryWidget
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/Battery.h>
35#include <NDEVR/Button.h>
36#include <NDEVR/Dictionary.h>
37#include <NDEVR/UUID.h>
38#include <QPointer>
39class QLabel;
40class QGridLayout;
41namespace NDEVR
42{
43 class ProgressWidget;
44 class Battery;
45 class QCustomLabel;
46 /**--------------------------------------------------------------------------------------------------
47 \brief Listens for changes to a Battery and reports an error to the user when thresholds are crossed.
48 **/
50 {
51 Q_OBJECT
52 public:
53 void addSensors(const Buffer<Battery*>& sensors);
54 void removeSensors(const Buffer<Battery*>& sensors);
57 protected slots:
58 void stateChangeSlot(bool originator);
59 protected:
61 };
62 /**--------------------------------------------------------------------------------------------------
63 \brief A button that displays information about multiple Batteries when clicked. Button changes color
64 based on the status of specified Battery objects.
65 **/
67 {
68 Q_OBJECT
69 public:
70 explicit BatteryWidget(QWidget* parent = nullptr);
71 void setSensors(const Buffer<Battery*>& sensors);
72 void setSensor(Battery* sensor);
73 void addSensor(Battery* sensor, bool update = true);
74 void removeSensor(Battery* sensor, bool update = true);
75 void clearSensors(bool update = true);
76 void setColumnCount(uint04 column_count);
78 protected slots:
80 protected:
82 [[nodiscard]] RGBColor getColor(uint04 state) const;
83 protected:
87 QGridLayout* m_layout;
88 uint04 m_column_count = 2;
89 };
90}
#define HARDWARE_WIDGETS_API
Definition DLLInfo.h:56
Listens for changes to a Battery and reports an error to the user when thresholds are crossed.
Definition BatteryWidget.h:50
void stateChangeSlot(bool originator)
Dictionary< UUID, QPointer< Battery > > m_sensors
Definition BatteryWidget.h:60
static BatteryAlertWatcher & Default()
void removeSensors(const Buffer< Battery * > &sensors)
void addSensors(const Buffer< Battery * > &sensors)
A device which has an accociated voltage or percent that changes. Can have set upper and lower limits...
Definition Battery.h:83
A button that displays information about multiple Batteries when clicked. Button changes color based ...
Definition BatteryWidget.h:67
Dictionary< UUID, ProgressWidget * > m_values
Definition BatteryWidget.h:85
void setSensors(const Buffer< Battery * > &sensors)
void addSensor(Battery *sensor, bool update=true)
QWidget * m_battery_widget
Definition BatteryWidget.h:86
void removeSensor(Battery *sensor, bool update=true)
QGridLayout * m_layout
Definition BatteryWidget.h:87
Dictionary< UUID, Battery * > m_sensors
Definition BatteryWidget.h:84
BatteryWidget(QWidget *parent=nullptr)
void setColumnCount(uint04 column_count)
void setSensor(Battery *sensor)
void clearSensors(bool update=true)
RGBColor getColor(uint04 state) const
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
A core widget that allows the user to click one of many button types.
Definition Button.h:66
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:54
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96