From a020ddf8dc4a660955aa320c6a182ad7e2775330 Mon Sep 17 00:00:00 2001 From: Martin Pecka Date: Tue, 19 Nov 2024 14:26:20 +0100 Subject: [PATCH] Added environment variable GAZEBO_SUPPRESS_EOL_WARNING that disables EOL notices. --- gazebo/gazebo_shared.cc | 7 +++++++ gazebo/gui/MainWindow.cc | 21 ++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/gazebo/gazebo_shared.cc b/gazebo/gazebo_shared.cc index 810ca0a9ca..cb898048a1 100644 --- a/gazebo/gazebo_shared.cc +++ b/gazebo/gazebo_shared.cc @@ -14,6 +14,8 @@ * limitations under the License. * */ +#include + #include #include "gazebo/transport/TransportIface.hh" @@ -27,6 +29,11 @@ void gazebo_shared::printVersion() { fprintf(stderr, "%s", GAZEBO_VERSION_HEADER); + + char *ignoreEol = getenv("GAZEBO_SUPPRESS_EOL_WARNING"); + if (ignoreEol != nullptr && strncmp(ignoreEol, "1", 1) == 0) + return; + const char* msg = R"( # # ####### ####### ### ##### ####### ## # # # # # # # # diff --git a/gazebo/gui/MainWindow.cc b/gazebo/gui/MainWindow.cc index f7c2e81a1a..20b82aecee 100644 --- a/gazebo/gui/MainWindow.cc +++ b/gazebo/gui/MainWindow.cc @@ -1678,15 +1678,18 @@ void MainWindow::ShowMenuBar(QMenuBar *_bar) this->dataPtr->menuLayout->addWidget(this->dataPtr->menuBar); if (!this->dataPtr->eolNotice) { - // Add Gazebo classic EOL notice label - this->dataPtr->eolNotice = new QLabel(this->dataPtr->menuBar); - this->dataPtr->eolNotice->setText(R"( - This version of Gazebo reaches end-of-life in January 2025. - Consider migrating to the new Gazebo)"); - this->dataPtr->menuLayout->addStretch(1); - this->dataPtr->menuLayout->addWidget(this->dataPtr->eolNotice); + char *ignoreEol = getenv("GAZEBO_SUPPRESS_EOL_WARNING"); + if (ignoreEol == nullptr || strncmp(ignoreEol, "1", 1) != 0) { + // Add Gazebo classic EOL notice label + this->dataPtr->eolNotice = new QLabel(this->dataPtr->menuBar); + this->dataPtr->eolNotice->setText(R"( + This version of Gazebo reaches end-of-life in January 2025. + Consider migrating to the new Gazebo)"); + this->dataPtr->menuLayout->addStretch(1); + this->dataPtr->menuLayout->addWidget(this->dataPtr->eolNotice); + } }