Sketcher: Solver Message simplification

This commit is contained in:
Paddle
2023-03-14 14:38:25 +01:00
committed by abdullahtahiriyo
parent 0833cbe7cc
commit d09b1e1499
4 changed files with 59 additions and 126 deletions

View File

@@ -1624,20 +1624,6 @@ QWidget#Form QPushButton:pressed {
background-color: #557BB6;
}
/* Sketcher Manual Update Button */
QPushButton#manualUpdate {
padding: 4px;
margin: 0px;
border: 1px solid #494949;
}
QPushButton:pressed#manualUpdate {
color: #ffffff;
border: 1px solid #3c3c3c;
background-color: #48699a;
}
/* Addon Manager */
QDialog#Dialog QPushButton {

View File

@@ -21,6 +21,9 @@
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QAction>
#endif
#include <Gui/Application.h>
#include <Gui/BitmapFactory.h>
@@ -52,14 +55,6 @@ TaskSketcherMessages::TaskSketcherMessages(ViewProviderSketch *sketchView) :
ui->labelConstrainStatus->setOpenExternalLinks(false);
ui->autoUpdate->onRestore();
ui->autoRemoveRedundants->onRestore();
if(ui->autoUpdate->isChecked())
sketchView->getSketchObject()->noRecomputes=false;
else
sketchView->getSketchObject()->noRecomputes=true;
// Set up the possible state values for the status label
ui->labelConstrainStatus->setParameterGroup("User parameter:BaseApp/Preferences/Mod/Sketcher/General");
ui->labelConstrainStatus->registerState(QString::fromUtf8("empty_sketch"), QColor("black"), std::string("EmptySketchMessageColor"));
@@ -77,14 +72,27 @@ TaskSketcherMessages::TaskSketcherMessages(ViewProviderSketch *sketchView) :
connect(ui->labelConstrainStatusLink, &Gui::UrlLabel::linkClicked,
this, &TaskSketcherMessages::on_labelConstrainStatusLink_linkClicked);
//Set Auto Update in the 'Manual Update' button menu.
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool state = hGrp->GetBool("AutoRecompute", false);
sketchView->getSketchObject()->noRecomputes = !state;
QAction* action = new QAction(tr("Auto update"), this);
action->setToolTip(tr("Executes a recomputation of active document after every sketch action"));
action->setCheckable(true);
action->setChecked(state);
ui->manualUpdate->addAction(action);
QObject::connect(
qAsConst(ui->manualUpdate)->actions()[0], &QAction::changed,
this, &TaskSketcherMessages::onAutoUpdateStateChanged
);
/*QObject::connect(
ui->labelConstrainStatus, SIGNAL(linkActivated(const QString &)),
this , SLOT (on_labelConstrainStatus_linkActivated(const QString &))
);
QObject::connect(
ui->autoUpdate, SIGNAL(stateChanged(int)),
this , SLOT (on_autoUpdate_stateChanged(int))
);
QObject::connect(
ui->manualUpdate, SIGNAL(clicked(bool)),
this , SLOT (on_manualUpdate_clicked(bool))
@@ -123,22 +131,13 @@ void TaskSketcherMessages::on_labelConstrainStatusLink_linkClicked(const QString
}
void TaskSketcherMessages::on_autoUpdate_stateChanged(int state)
void TaskSketcherMessages::onAutoUpdateStateChanged()
{
if(state==Qt::Checked) {
sketchView->getSketchObject()->noRecomputes=false;
ui->autoUpdate->onSave();
}
else if (state==Qt::Unchecked) {
sketchView->getSketchObject()->noRecomputes=true;
ui->autoUpdate->onSave();
}
}
bool state = qAsConst(ui->manualUpdate)->actions()[0]->isChecked();
void TaskSketcherMessages::on_autoRemoveRedundants_stateChanged(int state)
{
Q_UNUSED(state);
ui->autoRemoveRedundants->onSave();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
hGrp->SetBool("AutoRecompute", state);
sketchView->getSketchObject()->noRecomputes = !state;
}
void TaskSketcherMessages::on_manualUpdate_clicked(bool checked)

View File

@@ -47,12 +47,11 @@ public:
explicit TaskSketcherMessages(ViewProviderSketch *sketchView);
~TaskSketcherMessages() override;
void slotSetUp(const QString &state, const QString &msg, const QString& link, const QString& linkText);
void slotSetUp(const QString& state, const QString& msg, const QString& link, const QString& linkText);
private Q_SLOTS:
void on_labelConstrainStatusLink_linkClicked(const QString &);
void on_autoUpdate_stateChanged(int state);
void on_autoRemoveRedundants_stateChanged(int state);
void onAutoUpdateStateChanged();
void on_manualUpdate_clicked(bool checked);
protected:

View File

@@ -7,104 +7,53 @@
<x>0</x>
<y>0</y>
<width>253</width>
<height>108</height>
<height>48</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="Gui::StatefulLabel" name="labelConstrainStatus">
<property name="text">
<string>DOF</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::UrlLabel" name="labelConstrainStatusLink">
<property name="text">
<string>Link</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="autoRemoveRedundants">
<property name="toolTip">
<string>New constraints that would be redundant will automatically be removed</string>
</property>
<widget class="Gui::StatefulLabel" name="labelConstrainStatus">
<property name="text">
<string>Auto remove redundants</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>AutoRemoveRedundants</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Sketcher</cstring>
<string>DOF</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="Gui::PrefCheckBox" name="autoUpdate">
<property name="toolTip">
<string>Executes a recomputation of active document after every sketch action</string>
</property>
<property name="text">
<string>Auto update</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>AutoRecompute</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Sketcher</cstring>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="manualUpdate">
<property name="toolTip">
<string>Forces recomputation of active document</string>
</property>
<property name="text">
<string>Update</string>
</property>
</widget>
</item>
</layout>
<widget class="Gui::UrlLabel" name="labelConstrainStatusLink">
<property name="text">
<string>Link</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="manualUpdate">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Forces recomputation of active document</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>:/icons/view-refresh.svg</normaloff>:/icons/view-refresh.svg</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::MenuButtonPopup</enum>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::PrefCheckBox</class>
<extends>QCheckBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::StatefulLabel</class>
<extends>QLabel</extends>