mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Lint
This commit is contained in:
@@ -3,8 +3,8 @@
|
|||||||
#include "ui_button.hpp"
|
#include "ui_button.hpp"
|
||||||
#include "ui_checkbox.hpp"
|
#include "ui_checkbox.hpp"
|
||||||
#include "ui_combobox.hpp"
|
#include "ui_combobox.hpp"
|
||||||
#include "ui_double_spinbox.hpp"
|
|
||||||
#include "ui_dial.hpp"
|
#include "ui_dial.hpp"
|
||||||
|
#include "ui_double_spinbox.hpp"
|
||||||
#include "ui_hex_spinbox.hpp"
|
#include "ui_hex_spinbox.hpp"
|
||||||
#include "ui_label.hpp"
|
#include "ui_label.hpp"
|
||||||
#include "ui_led.hpp"
|
#include "ui_led.hpp"
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
#include "ui_double_spinbox.hpp"
|
#include "ui_double_spinbox.hpp"
|
||||||
|
|
||||||
UI_double_spinbox::UI_double_spinbox(QObject* parent) : UI_item(UI_DOUBLE_SPINBOX_TYPE, parent)
|
UI_double_spinbox::UI_double_spinbox(QObject *parent) : UI_item(UI_DOUBLE_SPINBOX_TYPE, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_double_spinbox::UI_double_spinbox(double min, double max, double value, QObject* parent) : UI_item(UI_DOUBLE_SPINBOX_TYPE, parent)
|
UI_double_spinbox::UI_double_spinbox(double min, double max, double value, QObject *parent)
|
||||||
|
: UI_item(UI_DOUBLE_SPINBOX_TYPE, parent)
|
||||||
{
|
{
|
||||||
m_min = min;
|
m_min = min;
|
||||||
m_max = max;
|
m_max = max;
|
||||||
|
|||||||
@@ -5,11 +5,12 @@
|
|||||||
|
|
||||||
#define UI_DOUBLE_SPINBOX_TYPE std::string("ui_double_spinbox")
|
#define UI_DOUBLE_SPINBOX_TYPE std::string("ui_double_spinbox")
|
||||||
|
|
||||||
class UI_double_spinbox : public UI_item {
|
class UI_double_spinbox : public UI_item
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit UI_double_spinbox(QObject* parent = nullptr);
|
explicit UI_double_spinbox(QObject *parent = nullptr);
|
||||||
UI_double_spinbox(double min, double max, double value, QObject* parent = nullptr);
|
UI_double_spinbox(double min, double max, double value, QObject *parent = nullptr);
|
||||||
|
|
||||||
void set_value(double value) override;
|
void set_value(double value) override;
|
||||||
double value() const;
|
double value() const;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "ui_hex_spinbox.hpp"
|
#include "ui_hex_spinbox.hpp"
|
||||||
|
|
||||||
UI_hex_spinbox::UI_hex_spinbox(QObject* parent) : UI_item(UI_HEX_SPINBOX_TYPE, parent) {
|
UI_hex_spinbox::UI_hex_spinbox(QObject *parent) : UI_item(UI_HEX_SPINBOX_TYPE, parent)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_hex_spinbox::UI_hex_spinbox(double min, double max, double value, QObject* parent) : UI_item(UI_HEX_SPINBOX_TYPE, parent)
|
UI_hex_spinbox::UI_hex_spinbox(double min, double max, double value, QObject *parent)
|
||||||
|
: UI_item(UI_HEX_SPINBOX_TYPE, parent)
|
||||||
{
|
{
|
||||||
m_min = min;
|
m_min = min;
|
||||||
m_max = max;
|
m_max = max;
|
||||||
|
|||||||
@@ -5,11 +5,12 @@
|
|||||||
|
|
||||||
#define UI_HEX_SPINBOX_TYPE std::string("ui_hex_spinbox")
|
#define UI_HEX_SPINBOX_TYPE std::string("ui_hex_spinbox")
|
||||||
|
|
||||||
class UI_hex_spinbox : public UI_item {
|
class UI_hex_spinbox : public UI_item
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit UI_hex_spinbox(QObject* parent = nullptr);
|
explicit UI_hex_spinbox(QObject *parent = nullptr);
|
||||||
UI_hex_spinbox(double min, double max, double value, QObject* parent = nullptr);
|
UI_hex_spinbox(double min, double max, double value, QObject *parent = nullptr);
|
||||||
|
|
||||||
void set_value(double value) override;
|
void set_value(double value) override;
|
||||||
double value() const;
|
double value() const;
|
||||||
|
|||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
#include "ui_spinbox.hpp"
|
#include "ui_spinbox.hpp"
|
||||||
|
|
||||||
UI_spinbox::UI_spinbox(QObject* parent) : UI_item(UI_SPINBOX_TYPE, parent)
|
UI_spinbox::UI_spinbox(QObject *parent) : UI_item(UI_SPINBOX_TYPE, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_spinbox::UI_spinbox(double min, double max, double value, QObject* parent) : UI_item(UI_SPINBOX_TYPE, parent)
|
UI_spinbox::UI_spinbox(double min, double max, double value, QObject *parent) : UI_item(UI_SPINBOX_TYPE, parent)
|
||||||
{
|
{
|
||||||
m_min = min;
|
m_min = min;
|
||||||
m_max = max;
|
m_max = max;
|
||||||
|
|||||||
+4
-3
@@ -5,11 +5,12 @@
|
|||||||
|
|
||||||
#define UI_SPINBOX_TYPE std::string("ui_spinbox")
|
#define UI_SPINBOX_TYPE std::string("ui_spinbox")
|
||||||
|
|
||||||
class UI_spinbox : public UI_item {
|
class UI_spinbox : public UI_item
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit UI_spinbox(QObject* parent = nullptr);
|
explicit UI_spinbox(QObject *parent = nullptr);
|
||||||
UI_spinbox(double min, double max, double value, QObject* parent = nullptr);
|
UI_spinbox(double min, double max, double value, QObject *parent = nullptr);
|
||||||
|
|
||||||
void set_value(double value) override;
|
void set_value(double value) override;
|
||||||
double value() const;
|
double value() const;
|
||||||
|
|||||||
+25
-22
@@ -180,7 +180,7 @@ void Simulator_base::UI_item_parser(json &input)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_label(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_label(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
auto label = qobject_cast<QLabel *>(widget);
|
auto label = qobject_cast<QLabel *>(widget);
|
||||||
if (label == nullptr)
|
if (label == nullptr)
|
||||||
@@ -197,7 +197,7 @@ void Simulator_base::process_ui_label(json &ui_item, QWidget* widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_slider(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_slider(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
QLabel *label = id_to_label(ui_item["id"]);
|
QLabel *label = id_to_label(ui_item["id"]);
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ void Simulator_base::process_ui_slider(json &ui_item, QWidget* widget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_dial(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_dial(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
QLabel *label = id_to_label(ui_item["id"]);
|
QLabel *label = id_to_label(ui_item["id"]);
|
||||||
|
|
||||||
@@ -268,7 +268,7 @@ void Simulator_base::process_ui_dial(json &ui_item, QWidget* widget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_thermo(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_thermo(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
QLabel *label = id_to_label(ui_item["id"]);
|
QLabel *label = id_to_label(ui_item["id"]);
|
||||||
|
|
||||||
@@ -300,12 +300,12 @@ void Simulator_base::process_ui_thermo(json &ui_item, QWidget* widget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_textbox(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_textbox(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
SPDLOG_CRITICAL("Not implemented");
|
SPDLOG_CRITICAL("Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_combobox(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_combobox(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
auto combobox = qobject_cast<QComboBox *>(widget);
|
auto combobox = qobject_cast<QComboBox *>(widget);
|
||||||
if (combobox == nullptr)
|
if (combobox == nullptr)
|
||||||
@@ -328,12 +328,12 @@ void Simulator_base::process_ui_combobox(json &ui_item, QWidget* widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_radiobutton(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_radiobutton(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
SPDLOG_CRITICAL("Not implemented");
|
SPDLOG_CRITICAL("Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_checkbox(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_checkbox(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
auto checkbox = qobject_cast<QCheckBox *>(widget);
|
auto checkbox = qobject_cast<QCheckBox *>(widget);
|
||||||
if (checkbox == nullptr)
|
if (checkbox == nullptr)
|
||||||
@@ -393,7 +393,7 @@ void Simulator_base::process_ui_checkbox(json &ui_item, QWidget* widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_button(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_button(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
auto button = qobject_cast<QPushButton *>(widget);
|
auto button = qobject_cast<QPushButton *>(widget);
|
||||||
if (button == nullptr)
|
if (button == nullptr)
|
||||||
@@ -447,7 +447,7 @@ void Simulator_base::process_ui_button(json &ui_item, QWidget* widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_led(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_led(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
auto led = qobject_cast<Led *>(widget);
|
auto led = qobject_cast<Led *>(widget);
|
||||||
if (led == nullptr)
|
if (led == nullptr)
|
||||||
@@ -495,7 +495,7 @@ void Simulator_base::process_ui_led(json &ui_item, QWidget* widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_spinbox(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_spinbox(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
auto spinbox = qobject_cast<QSpinBox *>(widget);
|
auto spinbox = qobject_cast<QSpinBox *>(widget);
|
||||||
if (spinbox == nullptr)
|
if (spinbox == nullptr)
|
||||||
@@ -522,7 +522,7 @@ void Simulator_base::process_ui_spinbox(json &ui_item, QWidget* widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_double_spinbox(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_double_spinbox(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
auto spinbox = qobject_cast<QDoubleSpinBox *>(widget);
|
auto spinbox = qobject_cast<QDoubleSpinBox *>(widget);
|
||||||
if (spinbox == nullptr)
|
if (spinbox == nullptr)
|
||||||
@@ -549,7 +549,7 @@ void Simulator_base::process_ui_double_spinbox(json &ui_item, QWidget* widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_hex_spinbox(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_hex_spinbox(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
auto spinbox = qobject_cast<HexSpinBox *>(widget);
|
auto spinbox = qobject_cast<HexSpinBox *>(widget);
|
||||||
if (spinbox == nullptr)
|
if (spinbox == nullptr)
|
||||||
@@ -576,7 +576,7 @@ void Simulator_base::process_ui_hex_spinbox(json &ui_item, QWidget* widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_plot(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_plot(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
auto plot = qobject_cast<Plot_wrapper *>(widget);
|
auto plot = qobject_cast<Plot_wrapper *>(widget);
|
||||||
if (plot == nullptr)
|
if (plot == nullptr)
|
||||||
@@ -625,7 +625,7 @@ void Simulator_base::process_ui_plot(json &ui_item, QWidget* widget)
|
|||||||
plot->replot();
|
plot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_table(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_table(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
auto table = qobject_cast<QTableWidget *>(widget);
|
auto table = qobject_cast<QTableWidget *>(widget);
|
||||||
if (table == nullptr)
|
if (table == nullptr)
|
||||||
@@ -682,7 +682,7 @@ void Simulator_base::process_ui_table(json &ui_item, QWidget* widget)
|
|||||||
// table->
|
// table->
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::process_ui_can(json &ui_item, QWidget* widget)
|
void Simulator_base::process_ui_can(json &ui_item, QWidget *widget)
|
||||||
{
|
{
|
||||||
auto can_ui = qobject_cast<Can_Transceive *>(widget);
|
auto can_ui = qobject_cast<Can_Transceive *>(widget);
|
||||||
if (can_ui == nullptr)
|
if (can_ui == nullptr)
|
||||||
@@ -772,8 +772,9 @@ void Simulator_base::setup_spinbox(QWidget *item, size_t index)
|
|||||||
if (spinbox == nullptr)
|
if (spinbox == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
connect(spinbox, &QSpinBox::valueChanged, this,
|
connect(spinbox, &QSpinBox::valueChanged, this, [=, this](int value) {
|
||||||
[=, this](int value) { m_web_socket->send_event(Web_socket_wrapper::Event::value_changed, index, (double)value); });
|
m_web_socket->send_event(Web_socket_wrapper::Event::value_changed, index, (double)value);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::setup_double_spinbox(QWidget *item, size_t index)
|
void Simulator_base::setup_double_spinbox(QWidget *item, size_t index)
|
||||||
@@ -782,8 +783,9 @@ void Simulator_base::setup_double_spinbox(QWidget *item, size_t index)
|
|||||||
if (spinbox == nullptr)
|
if (spinbox == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
connect(spinbox, &QDoubleSpinBox::valueChanged, this,
|
connect(spinbox, &QDoubleSpinBox::valueChanged, this, [=, this](double value) {
|
||||||
[=, this](double value) { m_web_socket->send_event(Web_socket_wrapper::Event::value_changed, index, value); });
|
m_web_socket->send_event(Web_socket_wrapper::Event::value_changed, index, value);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::setup_hex_spinbox(QWidget *item, size_t index)
|
void Simulator_base::setup_hex_spinbox(QWidget *item, size_t index)
|
||||||
@@ -792,8 +794,9 @@ void Simulator_base::setup_hex_spinbox(QWidget *item, size_t index)
|
|||||||
if (spinbox == nullptr)
|
if (spinbox == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
connect(spinbox, &HexSpinBox::valueChanged, this,
|
connect(spinbox, &HexSpinBox::valueChanged, this, [=, this](int value) {
|
||||||
[=, this](int value) { m_web_socket->send_event(Web_socket_wrapper::Event::value_changed, index, (double)value); });
|
m_web_socket->send_event(Web_socket_wrapper::Event::value_changed, index, (double)value);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator_base::setup_qwtplot(QWidget *item, size_t index)
|
void Simulator_base::setup_qwtplot(QWidget *item, size_t index)
|
||||||
|
|||||||
+16
-16
@@ -38,22 +38,22 @@ class Simulator_base : public QMainWindow
|
|||||||
void push_ui_item(QWidget *item);
|
void push_ui_item(QWidget *item);
|
||||||
|
|
||||||
void UI_item_parser(json &input);
|
void UI_item_parser(json &input);
|
||||||
virtual void process_ui_label(json &ui_item, QWidget* widget);
|
virtual void process_ui_label(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_slider(json &ui_item, QWidget* widget);
|
virtual void process_ui_slider(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_dial(json &ui_item, QWidget* widget);
|
virtual void process_ui_dial(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_thermo(json &ui_item, QWidget* widget);
|
virtual void process_ui_thermo(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_textbox(json &ui_item, QWidget* widget);
|
virtual void process_ui_textbox(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_combobox(json &ui_item, QWidget* widget);
|
virtual void process_ui_combobox(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_radiobutton(json &ui_item, QWidget* widget);
|
virtual void process_ui_radiobutton(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_checkbox(json &ui_item, QWidget* widget);
|
virtual void process_ui_checkbox(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_button(json &ui_item, QWidget* widget);
|
virtual void process_ui_button(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_led(json &ui_item, QWidget* widget);
|
virtual void process_ui_led(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_spinbox(json &ui_item, QWidget* widget);
|
virtual void process_ui_spinbox(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_double_spinbox(json &ui_item, QWidget* widget);
|
virtual void process_ui_double_spinbox(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_hex_spinbox(json &ui_item, QWidget* widget);
|
virtual void process_ui_hex_spinbox(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_plot(json &ui_item, QWidget* widget);
|
virtual void process_ui_plot(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_table(json &ui_item, QWidget* widget);
|
virtual void process_ui_table(json &ui_item, QWidget *widget);
|
||||||
virtual void process_ui_can(json &ui_item, QWidget* widget);
|
virtual void process_ui_can(json &ui_item, QWidget *widget);
|
||||||
|
|
||||||
void setup_ui_item(QWidget *item, size_t index);
|
void setup_ui_item(QWidget *item, size_t index);
|
||||||
void setup_button(QWidget *item, size_t index);
|
void setup_button(QWidget *item, size_t index);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "UI.hpp"
|
#include "UI.hpp"
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
#include "ui.hpp"
|
||||||
#include <QSerialPort>
|
#include <QSerialPort>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user