Commit 06b1f322 authored by tecnosapiens's avatar tecnosapiens

Add new widget: "SlugsPIDControl"

parent 7ecb10d0
......@@ -138,7 +138,9 @@ FORMS += src/ui/MainWindow.ui \
src/ui/QGCRemoteControlView.ui \
src/ui/WaypointGlobalView.ui \
src/ui/SlugsDataSensorView.ui \
src/ui/SlugsHilSim.ui
src/ui/SlugsHilSim.ui \
src/ui/SlugsDataSensorView.ui \
src/ui/SlugsPIDControl.ui
INCLUDEPATH += src \
src/ui \
src/ui/linechart \
......@@ -239,7 +241,8 @@ HEADERS += src/MG.h \
src/ui/map3D/Imagery.h \
src/comm/QGCMAVLink.h\
src/ui/SlugsDataSensorView.h \
src/ui/SlugsHilSim.h
src/ui/SlugsHilSim.h \
src/ui/SlugsPIDControl.h
SOURCES += src/main.cc \
src/Core.cc \
src/uas/UASManager.cc \
......@@ -320,7 +323,8 @@ SOURCES += src/main.cc \
src/ui/map3D/WebImage.cc \
src/ui/map3D/Imagery.cc \
src/ui/SlugsDataSensorView.cc \
src/ui/SlugsHilSim.cc
src/ui/SlugsHilSim.cc \
src/ui/SlugsPIDControl.cpp
RESOURCES = mavground.qrc
......
......@@ -181,6 +181,9 @@ void MainWindow::buildWidgets()
slugsDataWidget = new QDockWidget(tr("Slugs Data"), this);
slugsDataWidget->setWidget( new SlugsDataSensorView(this));
slugsPIDControlWidget = new QDockWidget(tr("PID Control"), this);
slugsPIDControlWidget->setWidget(new SlugsPIDControl(this));
}
......@@ -917,6 +920,13 @@ void MainWindow::loadGlobalOperatorView()
slugsDataWidget->show();
}
// Slugs Data View
if (slugsPIDControlWidget)
{
addDockWidget(Qt::LeftDockWidgetArea, slugsPIDControlWidget);
slugsPIDControlWidget->show();
}
// // UAS CONTROL
......
......@@ -66,6 +66,7 @@ This file is part of the QGROUNDCONTROL project
#include "QMap3DWidget.h"
#include "SlugsDataSensorView.h"
#include "LogCompressor.h"
#include "SlugsPIDControl.h"
/**
......@@ -180,6 +181,7 @@ protected:
QPointer<QDockWidget> hsiDockWidget;
QPointer<QDockWidget> rcViewDockWidget;
QPointer<QDockWidget> slugsDataWidget;
QPointer<QDockWidget> slugsPIDControlWidget;
// Popup widgets
JoystickWidget* joystickWidget;
......
#include "SlugsPIDControl.h"
#include "ui_SlugsPIDControl.h"
#include <QPalette>
#include<QColor>
#include <QDebug>
SlugsPIDControl::SlugsPIDControl(QWidget *parent) :
QWidget(parent),
ui(new Ui::SlugsPIDControl)
{
ui->setupUi(this);
//connectButtons();
//this call functions is only an example to view the color in the groupBox
changeRedColor(ui->AirSpeedHold_groupBox);
changeGreenColor(ui->HeightErrorLoPitch_groupBox);
}
SlugsPIDControl::~SlugsPIDControl()
{
delete ui;
}
/**
* Set the background color RED of the GroupBox PID based on the send Slugs PID message
*
*/
void SlugsPIDControl::changeRedColor(QGroupBox *group)
{
// GroupBox Color
QColor groupColor = QColor(231,72,28);
QString colorstyle;
QString borderColor = "#FA4A4F"; //"#4A4A4F";
groupColor = groupColor.darker(475);
colorstyle = colorstyle.sprintf("QGroupBox {background-color: #%02X%02X%02X; border: 5px solid %s; }",
groupColor.red(), groupColor.green(), groupColor.blue(), borderColor.toStdString().c_str());
group->setStyleSheet(colorstyle);
}
/**
* Set the background color GREEN of the GroupBox PID based on the send Slugs PID message
*
*/
void SlugsPIDControl::changeGreenColor(QGroupBox *group)
{
// GroupBox Color
QColor groupColor = QColor(30,124,16);
QString colorstyle;
QString borderColor = "#24AC23";
groupColor = groupColor.darker(475);
colorstyle = colorstyle.sprintf("QGroupBox {background-color: #%02X%02X%02X; border: 5px solid %s; }",
groupColor.red(), groupColor.green(), groupColor.blue(), borderColor.toStdString().c_str());
group->setStyleSheet(colorstyle);
}
/**
* Connection Signal and Slot of the set and get buttons on the widget
*
*/
void SlugsPIDControl::connectButtons()
{
//ToDo connect buttons set and get. Before create the slots
}
#ifndef SLUGSPIDCONTROL_H
#define SLUGSPIDCONTROL_H
#include <QWidget>
#include<QGroupBox>
namespace Ui {
class SlugsPIDControl;
}
class SlugsPIDControl : public QWidget
{
Q_OBJECT
public:
explicit SlugsPIDControl(QWidget *parent = 0);
~SlugsPIDControl();
protected slots:
void changeRedColor(QGroupBox* group);
void changeGreenColor(QGroupBox* group);
void connectButtons();
private:
Ui::SlugsPIDControl *ui;
};
#endif // SLUGSPIDCONTROL_H
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment