diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/controllertabs.ui b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/controllertabs.ui index 23d3def2e703a7bafc5f0abbda6cad4dc97e6cca..155dff174d9d08a6ec80698a61ec2938546c47be 100644 --- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/controllertabs.ui +++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/controllertabs.ui @@ -28,7 +28,7 @@ <item row="0" column="0"> <widget class="QTabWidget" name="controller_tabs_widget"> <property name="currentIndex"> - <number>2</number> + <number>6</number> </property> <property name="movable"> <bool>true</bool> @@ -38,8 +38,104 @@ <string>Default</string> </attribute> <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>3</number> + </property> + <property name="topMargin"> + <number>3</number> + </property> + <property name="rightMargin"> + <number>3</number> + </property> + <property name="bottomMargin"> + <number>3</number> + </property> + <property name="spacing"> + <number>5</number> + </property> + <item row="0" column="1"> + <widget class="QScrollArea" name="scrollArea_default"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="DefaultControllerTab" name="default_controller_tab_widget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1638</width> + <height>595</height> + </rect> + </property> + </widget> + </widget> + </item> <item row="0" column="0"> - <widget class="DefaultControllerTab" name="default_controller_tab_widget" native="true"/> + <widget class="QFrame" name="frame_isCurrentController_default"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:rgb(160,40,40);</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_11"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_isCurrentController_default"> + <property name="font"> + <font> + <pointsize>16</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>O +F +F</string> + </property> + <property name="alignment"> + <set>Qt::AlignHCenter|Qt::AlignTop</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> </item> </layout> </widget> @@ -48,8 +144,104 @@ <string>Student</string> </attribute> <layout class="QGridLayout" name="gridLayout_4"> + <property name="leftMargin"> + <number>3</number> + </property> + <property name="topMargin"> + <number>3</number> + </property> + <property name="rightMargin"> + <number>3</number> + </property> + <property name="bottomMargin"> + <number>3</number> + </property> + <property name="spacing"> + <number>5</number> + </property> + <item row="0" column="1"> + <widget class="QScrollArea" name="scrollArea_student"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="StudentControllerTab" name="student_controller_tab_widget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1638</width> + <height>595</height> + </rect> + </property> + </widget> + </widget> + </item> <item row="0" column="0"> - <widget class="StudentControllerTab" name="student_controller_tab_widget" native="true"/> + <widget class="QFrame" name="frame_isCurrentController_student"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:rgb(160,40,40);</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_12"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_isCurrentController_student"> + <property name="font"> + <font> + <pointsize>16</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>O +F +F</string> + </property> + <property name="alignment"> + <set>Qt::AlignHCenter|Qt::AlignTop</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> </item> </layout> </widget> @@ -70,7 +262,101 @@ <property name="bottomMargin"> <number>3</number> </property> + <property name="spacing"> + <number>5</number> + </property> <item row="0" column="0"> + <widget class="QFrame" name="frame_isCurrentController_csone"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:rgb(160,40,40);</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_9"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_isCurrentController_csone"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="font"> + <font> + <pointsize>16</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>O +F +F</string> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="alignment"> + <set>Qt::AlignHCenter|Qt::AlignTop</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="margin"> + <number>0</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="1"> <widget class="QScrollArea" name="scrollArea_csone"> <property name="widgetResizable"> <bool>true</bool> @@ -80,8 +366,8 @@ <rect> <x>0</x> <y>0</y> - <width>1723</width> - <height>576</height> + <width>1638</width> + <height>595</height> </rect> </property> </widget> @@ -106,7 +392,10 @@ <property name="bottomMargin"> <number>3</number> </property> - <item row="0" column="0"> + <property name="spacing"> + <number>5</number> + </property> + <item row="0" column="1"> <widget class="QScrollArea" name="scrollArea_picker"> <property name="widgetResizable"> <bool>true</bool> @@ -116,13 +405,80 @@ <rect> <x>0</x> <y>0</y> - <width>1723</width> - <height>576</height> + <width>1638</width> + <height>595</height> </rect> </property> </widget> </widget> </item> + <item row="0" column="0"> + <widget class="QFrame" name="frame_isCurrentController_picker"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:rgb(160,40,40);</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_10"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_isCurrentController_picker"> + <property name="font"> + <font> + <pointsize>16</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>O +F +F</string> + </property> + <property name="alignment"> + <set>Qt::AlignHCenter|Qt::AlignTop</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> </layout> </widget> <widget class="QWidget" name="tuning_tab"> @@ -130,8 +486,104 @@ <string>Tuning</string> </attribute> <layout class="QGridLayout" name="gridLayout_6"> + <property name="leftMargin"> + <number>3</number> + </property> + <property name="topMargin"> + <number>3</number> + </property> + <property name="rightMargin"> + <number>3</number> + </property> + <property name="bottomMargin"> + <number>3</number> + </property> + <property name="spacing"> + <number>5</number> + </property> + <item row="0" column="1"> + <widget class="QScrollArea" name="scrollArea_tuning"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="TuningControllerTab" name="tuning_controller_tab_widget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1638</width> + <height>595</height> + </rect> + </property> + </widget> + </widget> + </item> <item row="0" column="0"> - <widget class="TuningControllerTab" name="tuning_controller_tab_widget" native="true"/> + <widget class="QFrame" name="frame_isCurrentController_tuning"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:rgb(160,40,40);</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_13"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_isCurrentController_tuning"> + <property name="font"> + <font> + <pointsize>16</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>O +F +F</string> + </property> + <property name="alignment"> + <set>Qt::AlignHCenter|Qt::AlignTop</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> </item> </layout> </widget> @@ -140,8 +592,104 @@ <string>Remote</string> </attribute> <layout class="QGridLayout" name="gridLayout_3"> + <property name="leftMargin"> + <number>3</number> + </property> + <property name="topMargin"> + <number>3</number> + </property> + <property name="rightMargin"> + <number>3</number> + </property> + <property name="bottomMargin"> + <number>3</number> + </property> + <property name="spacing"> + <number>5</number> + </property> + <item row="0" column="1"> + <widget class="QScrollArea" name="scrollArea_remote"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="RemoteControllerTab" name="remote_controller_tab_widget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1638</width> + <height>595</height> + </rect> + </property> + </widget> + </widget> + </item> <item row="0" column="0"> - <widget class="RemoteControllerTab" name="remote_controller_tab_widget" native="true"/> + <widget class="QFrame" name="frame_isCurrentController_remote"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:rgb(160,40,40);</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_14"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_isCurrentController_remote"> + <property name="font"> + <font> + <pointsize>16</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>O +F +F</string> + </property> + <property name="alignment"> + <set>Qt::AlignHCenter|Qt::AlignTop</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> </item> </layout> </widget> @@ -150,8 +698,104 @@ <string>Template</string> </attribute> <layout class="QGridLayout" name="gridLayout_7"> + <property name="leftMargin"> + <number>3</number> + </property> + <property name="topMargin"> + <number>3</number> + </property> + <property name="rightMargin"> + <number>3</number> + </property> + <property name="bottomMargin"> + <number>3</number> + </property> + <property name="spacing"> + <number>5</number> + </property> + <item row="0" column="1"> + <widget class="QScrollArea" name="scrollArea_template"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="TemplateControllerTab" name="template_controller_tab_widget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1638</width> + <height>595</height> + </rect> + </property> + </widget> + </widget> + </item> <item row="0" column="0"> - <widget class="TemplateControllerTab" name="template_controller_tab_widget" native="true"/> + <widget class="QFrame" name="frame_isCurrentController_template"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:rgb(160,40,40);</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_15"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_isCurrentController_template"> + <property name="font"> + <font> + <pointsize>16</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>O +F +F</string> + </property> + <property name="alignment"> + <set>Qt::AlignHCenter|Qt::AlignTop</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> </item> </layout> </widget> diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/controllertabs.h b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/controllertabs.h index 772a6807c6704ded815094573b0a8c6720ddb714..09c828d17c9d0eb75f98c8411fa3f2065505fc24 100644 --- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/controllertabs.h +++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/controllertabs.h @@ -142,6 +142,9 @@ private: 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; + // Sound effect for when the controller changes while flying //QSoundEffect m_soundEffect_controllerChanged; @@ -183,9 +186,15 @@ private: void setControllerEnabled(int new_controller); + void setTextColourOfTabLabel(QColor color , QWidget * tab_widget); + void setAllTabLabelsToNormalColouring(); - void setTextColourOfTabLabel(QColor color , QWidget * tab_widget); + void setAllFramesToControllerIsOffColouring(); + + void setAllFramesToControllerCoordinatorColouring(); + + }; diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp index 617745e2fd431cbefe88d166f5d35fc2932f99f0..2c873aa4ca2e562ad92977010e2a16fe59c2b64c 100644 --- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp +++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp @@ -46,7 +46,10 @@ ControllerTabs::ControllerTabs(QWidget *parent) : // Specify the color for normal and highlighted tabs m_tab_text_colour_normal = Qt::black; - m_tab_text_colour_highlight = QColor(0,200,0); + m_tab_text_colour_highlight = QColor(40,120,40); + + // Set all the frame to be the inactive colouring + setAllFramesToControllerIsOffColouring(); // Initialise the sound effect for when the controller changes while flying //QSoundEffect m_soundEffect_controllerChanged; @@ -437,8 +440,16 @@ void ControllerTabs::controllerUsedChangedCallback(const std_msgs::Int32& msg) void ControllerTabs::setControllerEnabled(int new_controller) { + // 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"; + // First set everything back to normal colouring setAllTabLabelsToNormalColouring(); + setAllFramesToControllerIsOffColouring(); + + // Lock the mutex + m_change_highlighted_controller_mutex.lock(); // Now switch to highlight the tab corresponding to // the enable controller @@ -447,6 +458,8 @@ void ControllerTabs::setControllerEnabled(int new_controller) case DEFAULT_CONTROLLER: { setTextColourOfTabLabel( m_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; } case DEMO_CONTROLLER: @@ -457,6 +470,8 @@ void ControllerTabs::setControllerEnabled(int new_controller) case STUDENT_CONTROLLER: { setTextColourOfTabLabel( m_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; } case MPC_CONTROLLER: @@ -467,26 +482,36 @@ void ControllerTabs::setControllerEnabled(int new_controller) case REMOTE_CONTROLLER: { setTextColourOfTabLabel( m_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 ); + 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 ); + 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 ); + 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 ); + ui->frame_isCurrentController_csone->setStyleSheet(style_sheet_string_for_on); + ui->label_isCurrentController_csone->setText(text_for_controller_isOn); break; } default: @@ -495,11 +520,30 @@ void ControllerTabs::setControllerEnabled(int new_controller) break; } } + + // Unlock the mutex + m_change_highlighted_controller_mutex.unlock(); +} + + +void ControllerTabs::setTextColourOfTabLabel(QColor color , QWidget * tab_widget) +{ + // Get the current index of the tab + int current_index_of_tab = ui->controller_tabs_widget->indexOf(tab_widget); + // Only apply the colour if the tab is found + if (current_index_of_tab >= 0) + { + ui->controller_tabs_widget->tabBar()->setTabTextColor(current_index_of_tab, color); + } } void ControllerTabs::setAllTabLabelsToNormalColouring() { + // 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 ); @@ -507,21 +551,79 @@ void ControllerTabs::setAllTabLabelsToNormalColouring() 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 ); + + // Unlock the mutex + m_change_highlighted_controller_mutex.unlock(); } -void ControllerTabs::setTextColourOfTabLabel(QColor color , QWidget * tab_widget) +void ControllerTabs::setAllFramesToControllerIsOffColouring() { - // Get the current index of the tab - int current_index_of_tab = ui->controller_tabs_widget->indexOf(tab_widget); - // Only apply the colour if the tab is found - if (current_index_of_tab >= 0) - { - ui->controller_tabs_widget->tabBar()->setTabTextColor(current_index_of_tab, color); - } + // Define the off string and style sheet setting locally + const static QString text_for_controller_isOff = "O\nF\nF"; + const static QString style_sheet_string_for_off = "background-color:rgb(160,40,40);"; + + // Lock the mutex + m_change_highlighted_controller_mutex.lock(); + + // Set all the frames to the off colour + ui->frame_isCurrentController_default ->setStyleSheet(style_sheet_string_for_off); + ui->frame_isCurrentController_student ->setStyleSheet(style_sheet_string_for_off); + ui->frame_isCurrentController_picker ->setStyleSheet(style_sheet_string_for_off); + ui->frame_isCurrentController_tuning ->setStyleSheet(style_sheet_string_for_off); + ui->frame_isCurrentController_remote ->setStyleSheet(style_sheet_string_for_off); + ui->frame_isCurrentController_template->setStyleSheet(style_sheet_string_for_off); + ui->frame_isCurrentController_csone ->setStyleSheet(style_sheet_string_for_off); + + + // Set all the texts to the off string + ui->label_isCurrentController_default ->setText(text_for_controller_isOff); + ui->label_isCurrentController_student ->setText(text_for_controller_isOff); + ui->label_isCurrentController_picker ->setText(text_for_controller_isOff); + ui->label_isCurrentController_tuning ->setText(text_for_controller_isOff); + ui->label_isCurrentController_remote ->setText(text_for_controller_isOff); + ui->label_isCurrentController_template->setText(text_for_controller_isOff); + ui->label_isCurrentController_csone ->setText(text_for_controller_isOff); + + // Unlock the mutex + m_change_highlighted_controller_mutex.unlock(); +} + +void ControllerTabs::setAllFramesToControllerCoordinatorColouring() +{ + // Define the off string locally + const static QString text_for_coordinatorMode = "C\nO\nO\nR\nD"; + const static QString style_sheet_string_for_coordinatorMode = "background-color:rgb(150,150,150);"; + + // Lock the mutex + m_change_highlighted_controller_mutex.lock(); + + // Set all the frames to the off colour + ui->frame_isCurrentController_default ->setStyleSheet(style_sheet_string_for_coordinatorMode); + ui->frame_isCurrentController_student ->setStyleSheet(style_sheet_string_for_coordinatorMode); + ui->frame_isCurrentController_picker ->setStyleSheet(style_sheet_string_for_coordinatorMode); + ui->frame_isCurrentController_tuning ->setStyleSheet(style_sheet_string_for_coordinatorMode); + ui->frame_isCurrentController_remote ->setStyleSheet(style_sheet_string_for_coordinatorMode); + ui->frame_isCurrentController_template->setStyleSheet(style_sheet_string_for_coordinatorMode); + ui->frame_isCurrentController_csone ->setStyleSheet(style_sheet_string_for_coordinatorMode); + + + // Set all the texts to the off string + ui->label_isCurrentController_default ->setText(text_for_coordinatorMode); + ui->label_isCurrentController_student ->setText(text_for_coordinatorMode); + ui->label_isCurrentController_picker ->setText(text_for_coordinatorMode); + ui->label_isCurrentController_tuning ->setText(text_for_coordinatorMode); + ui->label_isCurrentController_remote ->setText(text_for_coordinatorMode); + ui->label_isCurrentController_template->setText(text_for_coordinatorMode); + ui->label_isCurrentController_csone ->setText(text_for_coordinatorMode); + + // Unlock the mutex + m_change_highlighted_controller_mutex.unlock(); } + + // ---------------------------------------------------------------------------------- // A GGGG EEEEE N N TTTTT III DDDD SSSS // A A G E NN N T I D D S @@ -592,6 +694,8 @@ void ControllerTabs::setAgentIDsToCoordinate(QVector<int> agentIDs , bool should // Set all tabs to be normal colours setAllTabLabelsToNormalColouring(); + // Set all current controller frames to be in "coordinator mode" + setAllFramesToControllerCoordinatorColouring(); } #endif diff --git a/dfall_ws/src/dfall_pkg/launch/coordinator.launch b/dfall_ws/src/dfall_pkg/launch/coordinator.launch index b05e5b610ac22d23d1598a4417e7bf049cb1292f..30fa23c456f006a6916aa9c44aef51d7144dd5e9 100755 --- a/dfall_ws/src/dfall_pkg/launch/coordinator.launch +++ b/dfall_ws/src/dfall_pkg/launch/coordinator.launch @@ -12,7 +12,7 @@ <!-- Example of how to specify the coordID from command line --> <!-- roslaunch dfall_pkg coordID:=001 --> - <group ns="$(eval 'agent' + str(coordID).zfill(3))"> + <group ns="$(eval 'coord' + str(coordID).zfill(3))"> <!-- COORDINATOR GUI --> <group if="$(arg withGUI)">