diff --git a/dfall_ws/src/dfall_pkg/CMakeLists.txt b/dfall_ws/src/dfall_pkg/CMakeLists.txt index 7b1ca67e5a4712f7dc87ec9b0806aebffffdade6..292aec970604a3f4086a8bdc1fec47eb5c0d6664 100755 --- a/dfall_ws/src/dfall_pkg/CMakeLists.txt +++ b/dfall_ws/src/dfall_pkg/CMakeLists.txt @@ -169,6 +169,7 @@ if(Qt5_FOUND) # be done manually set(SRC_HDRS_QOBJECT_FLYING_AGENT_GUI ${FLYING_AGENT_GUI_LIB_PATH_INC}/connectstartstopbar.h + ${FLYING_AGENT_GUI_LIB_PATH_INC}/controllerstatusbanner.h ${FLYING_AGENT_GUI_LIB_PATH_INC}/controllertabs.h ${FLYING_AGENT_GUI_LIB_PATH_INC}/coordinator.h ${FLYING_AGENT_GUI_LIB_PATH_INC}/coordinatorrow.h @@ -188,6 +189,7 @@ if(Qt5_FOUND) # Flying Agent GUI -- wrap UI file and QOBJECT files qt5_wrap_ui(UIS_HDRS_FLYING_AGENT_GUI ${FLYING_AGENT_GUI_LIB_PATH_FORMS}/connectstartstopbar.ui + ${FLYING_AGENT_GUI_LIB_PATH_FORMS}/controllerstatusbanner.ui ${FLYING_AGENT_GUI_LIB_PATH_FORMS}/controllertabs.ui ${FLYING_AGENT_GUI_LIB_PATH_FORMS}/coordinator.ui ${FLYING_AGENT_GUI_LIB_PATH_FORMS}/coordinatorrow.ui @@ -456,6 +458,7 @@ if(Qt5_FOUND) ${FLYING_AGENT_GUI_LIB_PATH_SRC}/main.cpp ${FLYING_AGENT_GUI_LIB_PATH_SRC}/rosNodeThread_for_flyingAgentGUI.cpp ${FLYING_AGENT_GUI_LIB_PATH_SRC}/connectstartstopbar.cpp + ${FLYING_AGENT_GUI_LIB_PATH_SRC}/controllerstatusbanner.cpp ${FLYING_AGENT_GUI_LIB_PATH_SRC}/controllertabs.cpp ${FLYING_AGENT_GUI_LIB_PATH_SRC}/coordinator.cpp ${FLYING_AGENT_GUI_LIB_PATH_SRC}/coordinatorrow.cpp 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 a8ef9a1cff131451b762926f4112e4bfc7d908e4..aa69f2d57c1eb46019e2f15e29092508528766f9 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 @@ -71,7 +71,7 @@ </widget> </item> <item row="0" column="0"> - <widget class="QFrame" name="frame_isCurrentController_default"> + <widget class="ControllerStatusBanner" name="statusBanner_default" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -90,51 +90,6 @@ <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> @@ -177,7 +132,7 @@ F</string> </widget> </item> <item row="0" column="0"> - <widget class="QFrame" name="frame_isCurrentController_student"> + <widget class="ControllerStatusBanner" name="statusBanner_student" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -196,51 +151,6 @@ F</string> <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> @@ -266,9 +176,9 @@ F</string> <number>5</number> </property> <item row="0" column="0"> - <widget class="QFrame" name="frame_isCurrentController_csone"> + <widget class="ControllerStatusBanner" name="statusBanner_csone" native="true"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -285,75 +195,6 @@ F</string> <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"> @@ -413,7 +254,7 @@ F</string> </widget> </item> <item row="0" column="0"> - <widget class="QFrame" name="frame_isCurrentController_picker"> + <widget class="ControllerStatusBanner" name="statusBanner_picker" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -432,51 +273,6 @@ F</string> <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> @@ -501,25 +297,8 @@ F</string> <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>576</height> - </rect> - </property> - </widget> - </widget> - </item> <item row="0" column="0"> - <widget class="QFrame" name="frame_isCurrentController_tuning"> + <widget class="ControllerStatusBanner" name="statusBanner_tuning" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -538,51 +317,23 @@ F</string> <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> + </widget> + </item> + <item row="0" column="1"> + <widget class="QScrollArea" name="scrollArea_tuning"> + <property name="widgetResizable"> + <bool>true</bool> </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> + <widget class="TuningControllerTab" name="tuning_controller_tab_widget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1638</width> + <height>576</height> + </rect> </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> </widget> </item> </layout> @@ -625,7 +376,7 @@ F</string> </widget> </item> <item row="0" column="0"> - <widget class="QFrame" name="frame_isCurrentController_remote"> + <widget class="ControllerStatusBanner" name="statusBanner_remote" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -644,51 +395,6 @@ F</string> <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> @@ -713,7 +419,7 @@ F</string> <property name="spacing"> <number>5</number> </property> - <item row="0" column="2"> + <item row="0" column="1"> <widget class="QScrollArea" name="scrollArea_template"> <property name="widgetResizable"> <bool>true</bool> @@ -723,7 +429,7 @@ F</string> <rect> <x>0</x> <y>0</y> - <width>1553</width> + <width>1638</width> <height>576</height> </rect> </property> @@ -731,74 +437,7 @@ F</string> </widget> </item> <item row="0" column="0"> - <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> - <item row="0" column="1"> - <widget class="ControllerStatusBanner" name="widget" native="true"> + <widget class="ControllerStatusBanner" name="statusBanner_template" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <horstretch>0</horstretch> diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/controllerstatusbanner.h b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/controllerstatusbanner.h index 8222fee2ed603e8d339482ee7fb8f0ecdf52afff..7a524ea7c1d9f733951ac1d3a44986f00ca76290 100644 --- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/controllerstatusbanner.h +++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/controllerstatusbanner.h @@ -1,7 +1,58 @@ +// Copyright (C) 2020, ETH Zurich, D-ITET, Paul Beuchat +// +// This file is part of D-FaLL-System. +// +// D-FaLL-System is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// D-FaLL-System is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with D-FaLL-System. If not, see <http://www.gnu.org/licenses/>. +// +// +// ---------------------------------------------------------------------------------- +// DDDD FFFFF L L SSSS Y Y SSSS TTTTT EEEEE M M +// D D F aaa L L S Y Y S T E MM MM +// D D --- FFFF a a L L --- SSS Y SSS T EEE M M M +// D D F a aa L L S Y S T E M M +// DDDD F aa a LLLL LLLL SSSS Y SSSS T EEEEE M M +// +// +// DESCRIPTION: +// A banner that indicates the status of a controller. +// Possible status values are: { OFF , ACTIVE , COORD } +// +// ---------------------------------------------------------------------------------- + + + + + #ifndef CONTROLLERSTATUSBANNER_H #define CONTROLLERSTATUSBANNER_H #include <QWidget> +#include <QMutex> + +#ifdef CATKIN_MAKE +#include <ros/ros.h> +#include <ros/network.h> +#include <ros/package.h> +#else +#include <QTextStream> +#endif + +// STATUS VALUES +#define CONTROLLER_STATUS_BANNER_OFF 0 +#define CONTROLLER_STATUS_BANNER_ACTIVE 1 +#define CONTROLLER_STATUS_BANNER_COORD 2 + namespace Ui { class ControllerStatusBanner; @@ -15,8 +66,22 @@ public: explicit ControllerStatusBanner(QWidget *parent = 0); ~ControllerStatusBanner(); + // PUBLIC METHODS FOR SETTING PROPERTIES + // > Set the state of the checkbox + void setStatus(int new_status); + private: + // --------------------------------------------------- // + // PRIVATE VARIABLES Ui::ControllerStatusBanner *ui; + + // > For the current status + int m_current_status; + + // MUTEX FOR HANDLING ACCESS + // > For the status variable and UI elements + QMutex m_status_mutex; + }; #endif // CONTROLLERSTATUSBANNER_H 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 ea1ba09875bd8d3b8a591474e555731620b03bbf..08df7f2abf692151d88cdb129af0466fc6f39d29 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 @@ -37,6 +37,8 @@ #ifndef CONTROLLERTABS_H #define CONTROLLERTABS_H +#include "controllerstatusbanner.h" + #include <QWidget> #include <QMutex> #include <QVector> @@ -186,9 +188,9 @@ private: void setAllTabLabelsToNormalColouring(); - void setAllFramesToControllerIsOffColouring(); + void setAllBannersToControllerIsOff(); - void setAllFramesToControllerCoordinatorColouring(); + void setAllBannersToControllerCoordinator(); diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllerstatusbanner.cpp b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllerstatusbanner.cpp index 273bed5b110ad47c0ecc621cec440799338b6625..0ad01ec5525c2f54c5e440b7a2f84371e2a7f170 100644 --- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllerstatusbanner.cpp +++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllerstatusbanner.cpp @@ -8,7 +8,7 @@ ControllerStatusBanner::ControllerStatusBanner(QWidget *parent) : ui->setupUi(this); // HIDE ALL EXCEPT THE "OFF" BANNER - ui->frame_isActive->show(); + ui->frame_isOff->show(); ui->frame_isActive->hide(); ui->frame_isCoord->hide(); } @@ -17,3 +17,60 @@ ControllerStatusBanner::~ControllerStatusBanner() { delete ui; } + + + + + +// PUBLIC METHODS FOR SETTING PROPERTIES + +// > For making the "enable flight" and "disable flight" buttons unavailable +void ControllerStatusBanner::setStatus(int new_status) +{ + // LOCK THE MUTEX + m_status_mutex.lock(); + + // CHECK IF THE "new_status" IS DIFFERENT FROM THE "m_current_status" + if (new_status!=m_current_status) + { + // SWITCH BETWEEN THE POSSIBLE STATUS VALUES + switch (new_status) + { + case CONTROLLER_STATUS_BANNER_OFF: + { + ui->frame_isOff->show(); + ui->frame_isActive->hide(); + ui->frame_isCoord->hide(); + break; + } + case CONTROLLER_STATUS_BANNER_ACTIVE: + { + ui->frame_isOff->hide(); + ui->frame_isActive->show(); + ui->frame_isCoord->hide(); + break; + } + case CONTROLLER_STATUS_BANNER_COORD: + { + ui->frame_isOff->hide(); + ui->frame_isActive->hide(); + ui->frame_isCoord->show(); + break; + } + default: + { + // INFORM THE USER OF THE ERROR + #ifdef CATKIN_MAKE + ROS_ERROR("[CONTROLLER STATUS BANNER] the new_status requested is not a valid status value."); + #else + // TO ASSIST WITH DEBUGGING WHEN COMPILED AND RUN IN "QtCreator" + QTextStream(stdout) << "[CONTROLLER STATUS BANNER] the new_status requested is not a valid status value."; + #endif + break; + } + } + } + + // UNLOCK THE MUTEX + m_status_mutex.unlock(); +} 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 485e9ef6ea70b828dda84b4906aa83951c9245a3..52d7c5f3ee0602eeb481fb3ce29fda352deaa616 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 @@ -44,8 +44,8 @@ ControllerTabs::ControllerTabs(QWidget *parent) : ui->setupUi(this); - // Set all the frame to be the inactive colouring - setAllFramesToControllerIsOffColouring(); + // Set all the banners to be the inactive colouring + setAllBannersToControllerIsOff(); // Initialise the sound effect for when the controller changes while flying //QSoundEffect m_soundEffect_controllerChanged; @@ -444,7 +444,7 @@ void ControllerTabs::setControllerEnabled(int new_controller) // First set everything back to normal colouring setAllTabLabelsToNormalColouring(); - setAllFramesToControllerIsOffColouring(); + setAllBannersToControllerIsOff(); // Lock the mutex m_change_highlighted_controller_mutex.lock(); @@ -456,8 +456,7 @@ void ControllerTabs::setControllerEnabled(int new_controller) case DEFAULT_CONTROLLER: { 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); + ui->statusBanner_default->setStatus(CONTROLLER_STATUS_BANNER_ACTIVE); break; } case DEMO_CONTROLLER: @@ -468,53 +467,47 @@ void ControllerTabs::setControllerEnabled(int new_controller) case STUDENT_CONTROLLER: { 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); + ui->statusBanner_student->setStatus(CONTROLLER_STATUS_BANNER_ACTIVE); break; } case MPC_CONTROLLER: { - //ui->controller_enabled_label->setText("MPC"); + //... break; } case REMOTE_CONTROLLER: { 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); + ui->statusBanner_remote->setStatus(CONTROLLER_STATUS_BANNER_ACTIVE); break; } case TUNING_CONTROLLER: { 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); + ui->statusBanner_tuning->setStatus(CONTROLLER_STATUS_BANNER_ACTIVE); break; } case PICKER_CONTROLLER: { 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); + ui->statusBanner_picker->setStatus(CONTROLLER_STATUS_BANNER_ACTIVE); break; } case TEMPLATE_CONTROLLER: { 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); + ui->statusBanner_template->setStatus(CONTROLLER_STATUS_BANNER_ACTIVE); break; } case CSONE_CONTROLLER: { 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); + ui->statusBanner_csone->setStatus(CONTROLLER_STATUS_BANNER_ACTIVE); break; } default: { - //ui->controller_enabled_label->setText("Unknown"); + //... break; } } @@ -557,65 +550,37 @@ void ControllerTabs::setAllTabLabelsToNormalColouring() m_change_highlighted_controller_mutex.unlock(); } -void ControllerTabs::setAllFramesToControllerIsOffColouring() +void ControllerTabs::setAllBannersToControllerIsOff() { - // 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); + // Set all the banners to the off status + ui->statusBanner_default ->setStatus(CONTROLLER_STATUS_BANNER_OFF); + ui->statusBanner_student ->setStatus(CONTROLLER_STATUS_BANNER_OFF); + ui->statusBanner_picker ->setStatus(CONTROLLER_STATUS_BANNER_OFF); + ui->statusBanner_tuning ->setStatus(CONTROLLER_STATUS_BANNER_OFF); + ui->statusBanner_remote ->setStatus(CONTROLLER_STATUS_BANNER_OFF); + ui->statusBanner_template->setStatus(CONTROLLER_STATUS_BANNER_OFF); + ui->statusBanner_csone ->setStatus(CONTROLLER_STATUS_BANNER_OFF); // Unlock the mutex m_change_highlighted_controller_mutex.unlock(); } -void ControllerTabs::setAllFramesToControllerCoordinatorColouring() +void ControllerTabs::setAllBannersToControllerCoordinator() { - // 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); + // Set all the banners to the coordinator status + ui->statusBanner_default ->setStatus(CONTROLLER_STATUS_BANNER_COORD); + ui->statusBanner_student ->setStatus(CONTROLLER_STATUS_BANNER_COORD); + ui->statusBanner_picker ->setStatus(CONTROLLER_STATUS_BANNER_COORD); + ui->statusBanner_tuning ->setStatus(CONTROLLER_STATUS_BANNER_COORD); + ui->statusBanner_remote ->setStatus(CONTROLLER_STATUS_BANNER_COORD); + ui->statusBanner_template->setStatus(CONTROLLER_STATUS_BANNER_COORD); + ui->statusBanner_csone ->setStatus(CONTROLLER_STATUS_BANNER_COORD); // Unlock the mutex m_change_highlighted_controller_mutex.unlock(); @@ -699,8 +664,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(); + // Set all current controller banners to be in "coordinator mode" + setAllBannersToControllerCoordinator(); } #endif