Skip to content
Snippets Groups Projects
Commit 3a9ce170 authored by Paul Beuchat's avatar Paul Beuchat
Browse files

Small changes to active controller highlighting in the controller tabs part of...

Small changes to active controller highlighting in the controller tabs part of the Flying Agent GUI in an attempt to remove the bug that causes the GUI to crash.
parent f6c0ce23
No related branches found
No related tags found
No related merge requests found
......@@ -138,10 +138,6 @@ private:
bool m_should_search_pose_data_for_object_name = false;
QMutex m_should_search_pose_data_for_object_name_mutex;
// The color for normal and highlighted tabs
QColor m_tab_text_colour_normal;
QColor m_tab_text_colour_highlight;
// Mutex for the highlighting of the active controller
QMutex m_change_highlighted_controller_mutex;
......
......@@ -44,10 +44,6 @@ ControllerTabs::ControllerTabs(QWidget *parent) :
ui->setupUi(this);
// Specify the color for normal and highlighted tabs
m_tab_text_colour_normal = Qt::black;
m_tab_text_colour_highlight = QColor(40,120,40);
// Set all the frame to be the inactive colouring
setAllFramesToControllerIsOffColouring();
......@@ -440,6 +436,8 @@ void ControllerTabs::controllerUsedChangedCallback(const std_msgs::Int32& msg)
void ControllerTabs::setControllerEnabled(int new_controller)
{
// Define the tab text highlight colour locally
const static QColor tab_text_colour_highlight = QColor(40,120,40);
// Define the on string and style sheet setting locally
const static QString style_sheet_string_for_on = "background-color:rgb(40,120,40);";
const static QString text_for_controller_isOn = "A\nC\nT\nI\nV\nE";
......@@ -457,7 +455,7 @@ void ControllerTabs::setControllerEnabled(int new_controller)
{
case DEFAULT_CONTROLLER:
{
setTextColourOfTabLabel( m_tab_text_colour_highlight , ui->default_tab );
setTextColourOfTabLabel( tab_text_colour_highlight , ui->default_tab );
ui->frame_isCurrentController_default->setStyleSheet(style_sheet_string_for_on);
ui->label_isCurrentController_default->setText(text_for_controller_isOn);
break;
......@@ -469,7 +467,7 @@ void ControllerTabs::setControllerEnabled(int new_controller)
}
case STUDENT_CONTROLLER:
{
setTextColourOfTabLabel( m_tab_text_colour_highlight , ui->student_tab );
setTextColourOfTabLabel( tab_text_colour_highlight , ui->student_tab );
ui->frame_isCurrentController_student->setStyleSheet(style_sheet_string_for_on);
ui->label_isCurrentController_student->setText(text_for_controller_isOn);
break;
......@@ -481,35 +479,35 @@ void ControllerTabs::setControllerEnabled(int new_controller)
}
case REMOTE_CONTROLLER:
{
setTextColourOfTabLabel( m_tab_text_colour_highlight , ui->remote_tab );
setTextColourOfTabLabel( tab_text_colour_highlight , ui->remote_tab );
ui->frame_isCurrentController_remote->setStyleSheet(style_sheet_string_for_on);
ui->label_isCurrentController_remote->setText(text_for_controller_isOn);
break;
}
case TUNING_CONTROLLER:
{
setTextColourOfTabLabel( m_tab_text_colour_highlight , ui->tuning_tab );
setTextColourOfTabLabel( tab_text_colour_highlight , ui->tuning_tab );
ui->frame_isCurrentController_tuning->setStyleSheet(style_sheet_string_for_on);
ui->label_isCurrentController_tuning->setText(text_for_controller_isOn);
break;
}
case PICKER_CONTROLLER:
{
setTextColourOfTabLabel( m_tab_text_colour_highlight , ui->picker_tab );
setTextColourOfTabLabel( tab_text_colour_highlight , ui->picker_tab );
ui->frame_isCurrentController_picker->setStyleSheet(style_sheet_string_for_on);
ui->label_isCurrentController_picker->setText(text_for_controller_isOn);
break;
}
case TEMPLATE_CONTROLLER:
{
setTextColourOfTabLabel( m_tab_text_colour_highlight , ui->template_tab );
setTextColourOfTabLabel( tab_text_colour_highlight , ui->template_tab );
ui->frame_isCurrentController_template->setStyleSheet(style_sheet_string_for_on);
ui->label_isCurrentController_template->setText(text_for_controller_isOn);
break;
}
case CSONE_CONTROLLER:
{
setTextColourOfTabLabel( m_tab_text_colour_highlight , ui->csone_tab );
setTextColourOfTabLabel( tab_text_colour_highlight , ui->csone_tab );
ui->frame_isCurrentController_csone->setStyleSheet(style_sheet_string_for_on);
ui->label_isCurrentController_csone->setText(text_for_controller_isOn);
break;
......@@ -540,17 +538,20 @@ void ControllerTabs::setTextColourOfTabLabel(QColor color , QWidget * tab_widget
void ControllerTabs::setAllTabLabelsToNormalColouring()
{
// Define the tab text normal colour locally
const static QColor tab_text_colour_normal = Qt::black;
// Lock the mutex
m_change_highlighted_controller_mutex.lock();
// Set all the colours to normal
setTextColourOfTabLabel( m_tab_text_colour_normal , ui->default_tab );
setTextColourOfTabLabel( m_tab_text_colour_normal , ui->student_tab );
setTextColourOfTabLabel( m_tab_text_colour_normal , ui->picker_tab );
setTextColourOfTabLabel( m_tab_text_colour_normal , ui->tuning_tab );
setTextColourOfTabLabel( m_tab_text_colour_normal , ui->remote_tab );
setTextColourOfTabLabel( m_tab_text_colour_normal , ui->template_tab );
setTextColourOfTabLabel( m_tab_text_colour_normal , ui->csone_tab );
setTextColourOfTabLabel( tab_text_colour_normal , ui->default_tab );
setTextColourOfTabLabel( tab_text_colour_normal , ui->student_tab );
setTextColourOfTabLabel( tab_text_colour_normal , ui->picker_tab );
setTextColourOfTabLabel( tab_text_colour_normal , ui->tuning_tab );
setTextColourOfTabLabel( tab_text_colour_normal , ui->remote_tab );
setTextColourOfTabLabel( tab_text_colour_normal , ui->template_tab );
setTextColourOfTabLabel( tab_text_colour_normal , ui->csone_tab );
// Unlock the mutex
m_change_highlighted_controller_mutex.unlock();
......@@ -684,12 +685,16 @@ void ControllerTabs::setAgentIDsToCoordinate(QVector<int> agentIDs , bool should
// SUBSCRIBERS
// > For receiving message that the instant controller was changed
m_change_highlighted_controller_mutex.lock();
controllerUsedSubscriber = agent_base_nodeHandle.subscribe("FlyingAgentClient/ControllerUsed", 1, &ControllerTabs::controllerUsedChangedCallback, this);
m_change_highlighted_controller_mutex.unlock();
}
else
{
// Unsubscribe
m_change_highlighted_controller_mutex.lock();
controllerUsedSubscriber.shutdown();
m_change_highlighted_controller_mutex.unlock();
// Set all tabs to be normal colours
setAllTabLabelsToNormalColouring();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment