NDEVR
API Documentation
WebSocketConnectionDialog.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: WebSocketConnectionDialog
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
40#include "DLLInfo.h"
41#include "HardwareWidgets/Headers/ConnectionDialog.h"
42#include <NDEVR/Connection.h>
43#include "Base/Headers/Dictionary.h"
44#include <QWidget>
45namespace Ui
46{
47 class WebNetworkConnectionUI;
48}
49namespace NDEVR
50{
51 class Connection;
52 class InfoPipe;
53 class Thread;
57 class NDEVR_WEB_SOCKET_API WebSocketConnectionDialog : public ConnectionDialog
58 {
59 Q_OBJECT
60 public:
65 explicit WebSocketConnectionDialog(QWidget* parent = nullptr);
74 void setFixedProtocol(const String& mode);
82 virtual void clear() override;
87 virtual ConnectionInfo connectionInfo() const override;
92 virtual void setConnectionInfo(const ConnectionInfo& connection) override;
98 virtual bool handlesConnection(const ConnectionInfo& connection) override;
103 void setAllowPingLogic(bool allow_ping);
108 void setAllowLocalButton(bool allow_local);
113 bool checkIfValid() const;
119 protected slots:
124 protected:
129 protected:
131 Ui::WebNetworkConnectionUI* ui;
132 bool m_allow_ping_logic = true;
134 };
135
139 {
140 public:
146 virtual bool handlesType(const StringView& connection) const override;
151 virtual TranslatedString title() const override;
156 virtual StringView icon() const override;
161 virtual ConnectionDialog* createConnectionDialog() const override;
162 };
163}
Defines cross-platform DLL export/import macros for the NDEVRWebSocket module.
Used to, given a Connection, generate an appropriate ConnectionDialog to allow adjustment of paramete...
A virtual dialog that provides an interface that allows the user to adjust certain parameters for a C...
ConnectionDialog(QWidget *parent=nullptr)
Constructs a ConnectionDialog.
A standard interface for all types of connections that allow transmitting and receiving of data betwe...
Definition Connection.h:316
A light-weight base class for Log that allows processes to update, without the need for additional in...
The core String View class for the NDEVR API.
Definition StringView.h:58
The core String class for the NDEVR API.
Definition String.h:95
The default thread class for executing concurrent sequences in the NDEVR API.
Definition Thread.h:113
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A ConnectionDialogFactory which allows for the creation of a WebSocketConnectionDialog.
virtual bool handlesType(const StringView &connection) const override
Checks whether this factory handles the given connection type string.
virtual ConnectionDialog * createConnectionDialog() const override
Creates a new WebSocketConnectionDialog instance.
virtual TranslatedString title() const override
Returns the user-facing title for this connection dialog type.
virtual StringView icon() const override
Returns the icon name associated with WebSocket connections.
virtual ConnectionInfo connectionInfo() const override
Builds and returns a ConnectionInfo populated from the current dialog field values.
String m_fixed_protocol
When non-empty, locks the protocol to this value.
virtual void setConnectionInfo(const ConnectionInfo &connection) override
Populates the dialog fields from the given connection information.
Ui::WebNetworkConnectionUI * ui
The auto-generated UI form for WebSocket connection settings.
void setAllowLocalButton(bool allow_local)
Enables or disables the local/localhost shortcut button.
~WebSocketConnectionDialog()
Destroys the dialog and frees the UI resources.
void refreshPingVisible()
Updates the visibility of ping-related controls based on current settings.
bool m_allow_local_button
Whether the localhost shortcut button is visible.
bool m_allow_ping_logic
Whether ping-test controls are visible and active.
void updateFromDialog()
Slot that synchronizes internal state when dialog fields are modified by the user.
String protocol() const
Returns the currently selected or fixed protocol string.
bool checkIfValid() const
Validates the current dialog field values.
WebSocketConnectionDialog(QWidget *parent=nullptr)
Constructs a WebSocketConnectionDialog with an optional parent widget.
virtual void clear() override
Resets all dialog fields to their default empty state.
void setFixedProtocol(const String &mode)
Locks the protocol selector to a fixed value, preventing user changes.
void setAllowPingLogic(bool allow_ping)
Enables or disables the ping-test logic and associated UI controls.
virtual bool handlesConnection(const ConnectionInfo &connection) override
Checks whether this dialog can edit the given connection type.
void clearFixedProtocol()
Removes the fixed protocol constraint, allowing the user to choose freely.
The primary namespace for the NDEVR SDK.
A structure designed to store information about a specific Connection.
Definition Connection.h:90