Skip to content
Snippets Groups Projects
Commit fa39f6d9 authored by Raul Radu's avatar Raul Radu
Browse files

[Modules] Using smart pointers in BaseMavlinkModule

- rateLabel and logCheckBox are now unique pointers since they are used
  only within the class
parent 0bdfb1d5
No related branches found
No related tags found
No related merge requests found
...@@ -227,15 +227,15 @@ void BaseMavlinkModule::setupUi() ...@@ -227,15 +227,15 @@ void BaseMavlinkModule::setupUi()
outerLayout->addStretch(); outerLayout->addStretch();
rateLabel = new QLabel("Rate: 0 msg/s"); rateLabel = std::make_unique<QLabel>("Rate: 0 msg/s");
rateLabel->setSizePolicy( rateLabel->setSizePolicy(
QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
outerLayout->addWidget(rateLabel); outerLayout->addWidget(rateLabel.get());
logCheckBox = new QCheckBox("Enable log"); logCheckBox = std::make_unique<QCheckBox>("Enable log");
logCheckBox->setSizePolicy( logCheckBox->setSizePolicy(
QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
outerLayout->addWidget(logCheckBox); outerLayout->addWidget(logCheckBox.get());
QPushButton *openLogFolderButton = new QPushButton("Log folder"); QPushButton *openLogFolderButton = new QPushButton("Log folder");
openLogFolderButton->setSizePolicy( openLogFolderButton->setSizePolicy(
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <QTimer> #include <QTimer>
#include <QWidget> #include <QWidget>
#include <memory>
#include "MavlinkCodec.h" #include "MavlinkCodec.h"
#include "Ports/MavlinkPort.h" #include "Ports/MavlinkPort.h"
...@@ -78,8 +79,8 @@ private: ...@@ -78,8 +79,8 @@ private:
ToggleButton *startToggleButton; ToggleButton *startToggleButton;
QComboBox *sysIdComboBox; QComboBox *sysIdComboBox;
QLabel *rateLabel; std::unique_ptr<QLabel> rateLabel;
QCheckBox *logCheckBox; std::unique_ptr<QCheckBox> logCheckBox;
QTimer linkQualityTimer; QTimer linkQualityTimer;
const int linkQualityPeriod = 2000; // [ms] const int linkQualityPeriod = 2000; // [ms]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment