Core: Add setting to hide the TaskWatcher (#22857)
* Core: Add setting to hide the TaskWatcher * Move setting to Display/UI * Clarify option description Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com> * Use sentence case for section title Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com> --------- Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<property name="toolTip">
|
||||
<string>This color might be used by your theme to let you customize it.</string>
|
||||
</property>
|
||||
<property name="color">
|
||||
<property name="color" stdset="0">
|
||||
<color>
|
||||
<red>85</red>
|
||||
<green>123</green>
|
||||
@@ -119,7 +119,7 @@
|
||||
<property name="toolTip">
|
||||
<string>This color might be used by your theme to let you customize it.</string>
|
||||
</property>
|
||||
<property name="color">
|
||||
<property name="color" stdset="0">
|
||||
<color>
|
||||
<red>85</red>
|
||||
<green>123</green>
|
||||
@@ -145,7 +145,7 @@
|
||||
<property name="toolTip">
|
||||
<string>This color might be used by your theme to let you customize it.</string>
|
||||
</property>
|
||||
<property name="color">
|
||||
<property name="color" stdset="0">
|
||||
<color>
|
||||
<red>85</red>
|
||||
<green>123</green>
|
||||
@@ -497,10 +497,32 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Suggested Actions</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="showTaskWatcherCheckBox">
|
||||
<property name="text">
|
||||
<string>Suggest actions in the task view based on the selection</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ShowTaskWatcher</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_3">
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
|
||||
@@ -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<QWidget*> &cont = tw->getWatcherContent();
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <vector>
|
||||
#include <QScrollArea>
|
||||
|
||||
#include <Base/Parameter.h>
|
||||
#include <Gui/QSint/include/QSint>
|
||||
#include <Gui/Selection/Selection.h>
|
||||
#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<TaskWatcher*> 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
|
||||
|
||||
Reference in New Issue
Block a user