Commit 3a13459b authored by roangel's avatar roangel
Browse files

Added LUT for addresses. Now they are not editable during runtime

parent 33b12dbf
......@@ -237,6 +237,7 @@ set(MY_CPP_SOURCES # compilation of sources
${MY_LIB_PATH_SRC}/rosNodeThread.cpp
${MY_LIB_PATH_SRC}/crazyFly.cpp
${MY_LIB_PATH_SRC}/CFLinker.cpp
${MY_LIB_PATH_SRC}/addressLUT.cpp
)
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.0.2, 2017-05-26T12:05:49. -->
<!-- Written by QtCreator 4.0.2, 2017-08-15T15:30:19. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......
#ifndef ADDRESSLUT_H
#define ADDRESSLUT_H
#include <string>
#include <map>
extern std::map<std::string, std::string> address_LUT;
#endif
......@@ -128,6 +128,8 @@ private slots:
void setTabIndex(int index);
void doTabClosed(int tab_index);
void on_comboBoxCFs_currentTextChanged(const QString &arg1);
private:
Ui::MainGUIWindow *ui;
......
#include "addressLUT.h"
std::map<std::string, std::string> address_LUT
{
{"CF1", "A12D2"},
{"CF2", "E341E"},
{"CF3", "4E21A"},
};
......@@ -3,6 +3,7 @@
#include "crazyFlyZoneTab.h"
#include "myGraphicsScene.h"
#include "myGraphicsView.h"
#include "addressLUT.h"
#include <QObject>
#include <QDoubleSpinBox>
......@@ -124,6 +125,13 @@ void MainGUIWindow::_init()
// ui->err_message_cf_zone->hide();
// ui->err_message_student_id->hide();
ui->radioAddress_text->setReadOnly(true);
QPalette *palette = new QPalette();
palette->setColor(QPalette::Base,Qt::lightGray);
palette->setColor(QPalette::Text,Qt::darkGray);
ui->radioAddress_text->setPalette(*palette);
ui->err_message_cf->setStyleSheet("QLabel { color : red; }");
ui->err_message_cf_zone->setStyleSheet("QLabel { color : red; }");
ui->err_message_student_id->setStyleSheet("QLabel { color : red; }");
......@@ -872,3 +880,19 @@ void MainGUIWindow::on_load_from_DB_button_clicked()
ROS_ERROR("Failed to read DB");
}
}
void MainGUIWindow::on_comboBoxCFs_currentTextChanged(const QString &arg1)
{
std::string key = arg1.toStdString();
auto it = address_LUT.find(key);
if(it != address_LUT.end())
{
std::string found = it->second;
QString found_qstr = QString::fromStdString(found);
ui->radioAddress_text->setText(found_qstr);
}
else
{
ROS_INFO("name not found in LUT");
}
}
......@@ -422,7 +422,14 @@
</widget>
</item>
<item row="10" column="6">
<widget class="QLineEdit" name="radioAddress_text"/>
<widget class="QLineEdit" name="radioAddress_text">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="clearButtonEnabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="11" column="6">
<widget class="QLabel" name="err_message_radio_address">
......
2,CF1,1,0,0.52,0.41,-0.2,1.56,1.55,2
1,CF2,2,1,-1.62398,-1.65338,-0.2,1.70872,0.674222,2
1,CF1,A12D2,0,0.180387,0.712283,-0.2,1.77763,1.34043,2
2,CF2,E341E,1,-0.628728,-0.48753,-0.2,0.971272,0.52247,2
3,CF3,4E21A,2,0.425248,-1.49146,-0.2,1.66704,-0.577371,2
Supports Markdown
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