NDEVR
API Documentation
ConnectionStatusWidget.h
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: ConnectionStatusWidget
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/Connection.h>
35#include <NDEVR/LogStream.h>
36#include <QLabel>
37#include <QPointer>
38namespace NDEVR
39{
40 class ProgressWidget;
41 class QCustomLabel;
42 class StatusBar;
43 class Log;
49 class HARDWARE_WIDGETS_API ConnectionStatusWidget : public QWidget, public LogStream
50 {
51 Q_OBJECT
52 public:
57 explicit ConnectionStatusWidget(QWidget* parent = nullptr);
62 void setSensor(Connection* sensor);
78 void setCustomTitle(const TranslatedString& custom_title);
83 void setHorizontal(bool horizontal);
88 void setActAsLog(bool act_like_log);
93 void setColor(RGBColor color);
99 virtual void setProgress(uint04 idx, fltp04 progress) override;
105 protected:
109 void init();
115 virtual void addMessage(uint04 id, const LogMessage& message) override;
116 protected slots:
124 protected:
125 QPointer<Connection> m_sensor;
132 fltp04 m_pending_progress = Constant<fltp04>::Invalid;
134 bool m_owns_log = false;
136 bool m_act_like_log = false;
137
138 };
139}
void endCancelConnection()
Completes the connection cancellation and updates the display.
Log * m_log
Log widget for displaying connection messages.
virtual void addMessage(uint04 id, const LogMessage &message) override
Adds a log message to the status display.
fltp04 m_pending_progress
Pending progress value awaiting display.
ConnectionState m_connection_state
The current connection state.
ProgressWidget * progressWidget() const
Returns the progress widget used by this status display.
ConnectionStatusWidget(QWidget *parent=nullptr)
Constructs a ConnectionStatusWidget.
TranslatedString m_custom_title
Custom title overriding the default connection name.
void init()
Initializes the widget layout and child widgets.
void setHorizontal(bool horizontal)
Sets whether the widget uses a horizontal or vertical layout.
virtual void setProgress(uint04 idx, fltp04 progress) override
Updates the progress indicator at the given index.
QPointer< Connection > m_sensor
The connection being monitored.
void setCustomTitle(const TranslatedString &custom_title)
Sets a custom title to display instead of the default connection name.
void setSensor(Connection *sensor)
Sets the connection whose status will be displayed.
ProgressWidget * m_progress_widget
Dial widget showing connection progress.
bool m_owns_log
Whether this widget owns the log object.
void connectionStateUpdatedSlot(ConnectionState state)
Slot called when the monitored connection's state changes.
void setColor(RGBColor color)
Sets the color of the progress dial.
void cancelConnection()
Initiates cancellation of the current connection attempt.
QCustomLabel * m_title_label
Label displaying the connection title.
void clearConnectionStatus()
Clears all connection status information from the display.
bool m_act_like_log
Whether to display as a log view.
bool m_has_connection_object
Whether a connection object has been assigned.
void setActAsLog(bool act_like_log)
Sets whether the widget should display as a log view.
void updateTitle()
Updates the title label based on the connection name or custom title.
void deletedSlot()
Slot called when the monitored connection is deleted.
bool m_is_horizontal
Whether the widget uses horizontal layout.
void setConnectionState(ConnectionState state)
Manually sets the displayed connection state.
QCustomLabel * m_status_label
Label displaying the current status text.
A standard interface for all types of connections that allow transmitting and receiving of data betwe...
Definition Connection.h:316
A class that allows for specific log information to be conveyed to a InfoPipe object including inform...
Definition LogMessage.h:48
A listener that receives and processes log messages and progress updates from an InfoPipe.
Definition LogStream.h:49
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
Definition Log.h:50
Displays the progress, either horizontally as a bar or as a round spin dial.
Displays translated text.
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:57
A simple widget that shows a Status and optionally a progressbar.
Definition StatusBar.h:49
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
The primary namespace for the NDEVR SDK.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
ConnectionState
Describes the state of the connection.
Definition Connection.h:45
@ e_no_connection
No connection has been established.
Definition Connection.h:46