Add doxygen documentation to client ui

This commit is contained in:
2026-02-14 14:32:35 +01:00
parent 3c0d01df15
commit 9836d40a49
6 changed files with 151 additions and 3 deletions
+29 -1
View File
@@ -6,13 +6,41 @@ class Better_Radiobutton : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief Construct a new Better_Radiobutton object
*
* @param parent A pointer to the parent widget
*/
explicit Better_Radiobutton(QWidget *parent = nullptr); explicit Better_Radiobutton(QWidget *parent = nullptr);
explicit Better_Radiobutton(std::vector<QString> names, QWidget *partent = nullptr); /**
* @brief Construct a new Better_Radiobutton object
*
* @param names A list of names for the radiobuttons
* @param parent A pointer to the parent widget
*/
explicit Better_Radiobutton(std::vector<QString> names, QWidget *parent = nullptr);
/**
* @brief Add a radiobutton to the group
*
* @param name The name of the radiobutton
*/
void add_radiobutton(QString name); void add_radiobutton(QString name);
/**
* @brief Get the name of the currently checked radiobutton
*
* @return QString The name of the checked radiobutton
*/
QString isChecked() const; QString isChecked() const;
signals: signals:
/**
* @brief Emitted when a radiobutton is toggled
*
* @param name The name of the radiobutton
* @param checked Whether the radiobutton is checked
*/
void toggled(QString name, bool checked); void toggled(QString name, bool checked);
private: private:
+47
View File
@@ -12,15 +12,62 @@ class Can_Transceive : public QWidget
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief Construct a new Can_Transceive object
*
* @param parent A pointer to the parent widget
*/
explicit Can_Transceive(QWidget *parent = nullptr); explicit Can_Transceive(QWidget *parent = nullptr);
/**
* @brief Destroy the Can_Transceive object
*
*/
~Can_Transceive(); ~Can_Transceive();
/**
* @brief This function enables or disables the CAN data input fields based on the selected DLC
*
*/
void enable_can_send_data(); void enable_can_send_data();
/**
* @brief Clear the CAN message lists
*
*/
void clear(); void clear();
/**
* @brief Add a sent CAN message to the send list
*
* @param id The CAN message ID
* @param dlc The Data Length Code
* @param payload The CAN message payload
*/
void add_send_item(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload); void add_send_item(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload);
/**
* @brief Add a received CAN message to the receive list
*
* @param id The CAN message ID
* @param dlc The Data Length Code
* @param payload The CAN message payload
*/
void add_receive_item(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload); void add_receive_item(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload);
signals: signals:
/**
* @brief Emitted when a CAN message is to be sent
*
* @param id The CAN message ID
* @param dlc The Data Length Code
* @param payload The CAN message payload
*/
void send_can_message(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload); void send_can_message(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload);
/**
* @brief Emitted when the CAN message lists are to be cleared
*
*/
void can_clear(); void can_clear();
private: private:
+5 -1
View File
@@ -1,6 +1,10 @@
#include "hex_spinbox.hpp" #include "hex_spinbox.hpp"
HexSpinBox::HexSpinBox(QWidget *parent, bool showPrefix, const QString &format) : QSpinBox(parent), format(format) HexSpinBox::HexSpinBox(QWidget *parent) : HexSpinBox(false, QStringLiteral("%X"), parent)
{
}
HexSpinBox::HexSpinBox(bool showPrefix, const QString &format, QWidget *parent) : QSpinBox(parent), format(format)
{ {
// Validates hex strings up to 8 chars with or w/out leading "0x" prefix. // Validates hex strings up to 8 chars with or w/out leading "0x" prefix.
// For arbitrary prefix/suffix, the regex could be built dynamically // For arbitrary prefix/suffix, the regex could be built dynamically
+25 -1
View File
@@ -11,10 +11,34 @@ class HexSpinBox : public QSpinBox
Q_OBJECT Q_OBJECT
public: public:
HexSpinBox(QWidget *parent = nullptr, bool showPrefix = false, const QString &format = QStringLiteral("%X")); /**
* @brief Construct a new Hex Spin Box object
*
* @param parent The parent QWidget
*/
explicit HexSpinBox(QWidget *parent = nullptr);
/**
* @brief Construct a new Hex Spin Box object
*
* @param showPrefix Whether to show the "0x" prefix
* @param format The printf-style format string to use for displaying the value
* @param parent The parent QWidget
*/
HexSpinBox(bool showPrefix = false, const QString &format = QStringLiteral("%X"), QWidget *parent = nullptr);
public slots: public slots:
/**
* @brief Set the Show Prefix object
*
* @param show True to show the "0x" prefix, false to hide it
*/
void setShowPrefix(bool show); void setShowPrefix(bool show);
/**
* @brief Set the Format object
*
* @param text The printf-style format string to use for displaying the value
*/
void setFormat(const QString &text); void setFormat(const QString &text);
protected: protected:
+34
View File
@@ -5,12 +5,46 @@ class Led : public QPushButton
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief Construct a new Led object
*
* @param parent The parent widget
*/
explicit Led(QWidget *parent = nullptr); explicit Led(QWidget *parent = nullptr);
/**
* @brief Construct a new Led object
*
* @param text The text to display on the button
* @param parent The parent widget
*/
explicit Led(const QString &text, QWidget *parent = nullptr); explicit Led(const QString &text, QWidget *parent = nullptr);
/**
* @brief Construct a new Led object
*
* @param icon The icon to display on the button
* @param text The text to display on the button
* @param parent The parent widget
*/
Led(const QIcon &icon, const QString &text, QWidget *parent = nullptr); Led(const QIcon &icon, const QString &text, QWidget *parent = nullptr);
~Led(); ~Led();
private: private:
/**
* @brief Check if the widget is read-only
*
* @param widget The widget to check
* @return true If the widget is read-only
* @return false If the widget is not read-only
*/
bool is_read_only(QWidget *widget); bool is_read_only(QWidget *widget);
/**
* @brief Set the read-only state of the widget
*
* @param widget The widget to set
* @param read_only The read-only state to set
*/
void set_read_only(QWidget *widget, bool read_only); void set_read_only(QWidget *widget, bool read_only);
}; };
+11
View File
@@ -8,7 +8,18 @@ class Plot_wrapper : public QwtPlot
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief Construct a new Plot_wrapper object
*
* @param parent The parent QWidget
*/
Plot_wrapper(QWidget *parent = nullptr); Plot_wrapper(QWidget *parent = nullptr);
/**
* @brief Get the curve associated with the plot
*
* @return QwtPlotCurve*
*/
QwtPlotCurve *curve() const; QwtPlotCurve *curve() const;
private: private: