From b27bd2b4b521f346d4f4a627ca9971f2dc58c5fa Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Thu, 29 Dec 2022 16:01:17 +0100 Subject: [PATCH] Gui: Add Notification Area to Status bar ======================================== Parameter "NotificationAreaEnabled" can be used to completely disable the Notification Area. If disabled it won't appear on the UI at all and no non-intrusive notification will be generated. --- src/Gui/MainWindow.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 3f1ee3ad7b..cd038999d0 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -80,6 +80,7 @@ #include "DownloadManager.h" #include "FileDialog.h" #include "MenuManager.h" +#include "NotificationArea.h" #include "ProgressBar.h" #include "PropertyView.h" #include "PythonConsole.h" @@ -251,7 +252,6 @@ protected: } // namespace Gui - /* TRANSLATOR Gui::MainWindow */ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) @@ -304,6 +304,17 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) statusBar()->addPermanentWidget(progressBar, 0); statusBar()->addPermanentWidget(d->sizeLabel, 0); + auto hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/NotificationArea"); + + auto notificationAreaEnabled = hGrp->GetBool("NotificationAreaEnabled", true); + + if(notificationAreaEnabled) { + NotificationArea* notificationArea = new NotificationArea(statusBar()); + notificationArea->setObjectName(QString::fromLatin1("notificationArea")); + notificationArea->setIcon(QIcon(QString::fromLatin1(":/icons/InTray.svg"))); + notificationArea->setStyleSheet(QStringLiteral("text-align:left;")); + statusBar()->addPermanentWidget(notificationArea); + } // clears the action label d->actionTimer = new QTimer( this ); d->actionTimer->setObjectName(QString::fromLatin1("actionTimer"));