diff --git a/src/Gui/PreferencePages/DlgSettingsUI.cpp b/src/Gui/PreferencePages/DlgSettingsUI.cpp index e5d7974621..33ae4e044f 100644 --- a/src/Gui/PreferencePages/DlgSettingsUI.cpp +++ b/src/Gui/PreferencePages/DlgSettingsUI.cpp @@ -86,6 +86,9 @@ void DlgSettingsUI::saveSettings() ui->overlayAutoHideCheckBox->onSave(); ui->mouseClickPassThroughCheckBox->onSave(); ui->mouseWheelPassThroughCheckBox->onSave(); + + // TaskWatcher + ui->showTaskWatcherCheckBox->onSave(); } void DlgSettingsUI::loadSettings() @@ -113,6 +116,9 @@ void DlgSettingsUI::loadSettings() ui->mouseClickPassThroughCheckBox->onRestore(); ui->mouseWheelPassThroughCheckBox->onRestore(); + // TaskWatcher + ui->showTaskWatcherCheckBox->onRestore(); + loadStyleSheet(); } diff --git a/src/Gui/PreferencePages/DlgSettingsUI.ui b/src/Gui/PreferencePages/DlgSettingsUI.ui index f9910f251b..bbf9a98c3a 100644 --- a/src/Gui/PreferencePages/DlgSettingsUI.ui +++ b/src/Gui/PreferencePages/DlgSettingsUI.ui @@ -53,7 +53,7 @@ This color might be used by your theme to let you customize it. - + 85 123 @@ -119,7 +119,7 @@ This color might be used by your theme to let you customize it. - + 85 123 @@ -145,7 +145,7 @@ This color might be used by your theme to let you customize it. - + 85 123 @@ -497,10 +497,32 @@ - - - Qt::Orientation::Vertical + + + Suggested Actions + + + + + Suggest actions in the task view based on the selection + + + true + + + ShowTaskWatcher + + + General + + + + + + + + 20 diff --git a/src/Gui/TaskView/TaskView.cpp b/src/Gui/TaskView/TaskView.cpp index 9e5394ba6a..0536d58ea9 100644 --- a/src/Gui/TaskView/TaskView.cpp +++ b/src/Gui/TaskView/TaskView.cpp @@ -270,7 +270,10 @@ QSize TaskPanel::minimumSizeHint() const //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TaskView::TaskView(QWidget *parent) - : QWidget(parent),ActiveDialog(nullptr),ActiveCtrl(nullptr) + : QWidget(parent) + , ActiveDialog(nullptr) + , ActiveCtrl(nullptr) + , hGrp(Gui::WindowParameter::getDefaultParameter()->GetGroup("General")) { mainLayout = new QVBoxLayout(this); mainLayout->setContentsMargins(0, 0, 0, 0); @@ -323,6 +326,14 @@ TaskView::TaskView(QWidget *parent) std::bind(&Gui::TaskView::TaskView::slotInEdit, this, sp::_1)); //NOLINTEND + setShowTaskWatcher(hGrp->GetBool("ShowTaskWatcher", true)); + connectShowTaskWatcherSetting = hGrp->Manager()->signalParamChanged.connect( + [this](ParameterGrp *Param, ParameterGrp::ParamType Type, const char *name, const char * value) { + if(Param == hGrp && Type == ParameterGrp::ParamType::FCBool && name && strcmp(name, "ShowTaskWatcher") == 0) { + setShowTaskWatcher(value && *value == '1'); + } + }); + updateWatcher(); } @@ -334,6 +345,7 @@ TaskView::~TaskView() connectApplicationUndoDocument.disconnect(); connectApplicationRedoDocument.disconnect(); connectApplicationInEdit.disconnect(); + connectShowTaskWatcherSetting.disconnect(); Gui::Selection().Detach(this); for (QWidget* panel : contextualPanels) { @@ -701,9 +713,21 @@ void TaskView::removeDialog() tryRestoreWidth(); triggerMinimumSizeHint(); } - +void TaskView::setShowTaskWatcher(bool show) +{ + showTaskWatcher = show; + if (show) { + addTaskWatcher(); + } else { + clearTaskWatcher(); + } +} void TaskView::updateWatcher() { + if (!showTaskWatcher) { + return; + } + if (ActiveWatcher.empty()) { auto panel = Gui::Control().taskPanel(); if (panel && panel->ActiveWatcher.size()) @@ -779,6 +803,9 @@ void TaskView::clearTaskWatcher() void TaskView::addTaskWatcher() { + if (!showTaskWatcher) { + return; + } // add all widgets for all watcher to the task view for (TaskWatcher* tw : ActiveWatcher) { std::vector &cont = tw->getWatcherContent(); diff --git a/src/Gui/TaskView/TaskView.h b/src/Gui/TaskView/TaskView.h index 3cc27a704f..eceda32c49 100644 --- a/src/Gui/TaskView/TaskView.h +++ b/src/Gui/TaskView/TaskView.h @@ -27,6 +27,7 @@ #include #include +#include #include #include #include "TaskWatcher.h" @@ -213,6 +214,8 @@ protected: // removes the running dialog after accept() or reject() from the TaskView void removeDialog(); + void setShowTaskWatcher(bool show); + std::vector ActiveWatcher; QSint::ActionPanel* taskPanel; @@ -220,6 +223,8 @@ protected: TaskEditControl *ActiveCtrl; bool restoreWidth = false; int currentWidth = 0; + ParameterGrp::handle hGrp; + bool showTaskWatcher; Connection connectApplicationActiveDocument; Connection connectApplicationDeleteDocument; @@ -227,6 +232,7 @@ protected: Connection connectApplicationUndoDocument; Connection connectApplicationRedoDocument; Connection connectApplicationInEdit; + Connection connectShowTaskWatcherSetting; }; } //namespace TaskView