Port attachment UI to Part for general use
Furthermore change PartDesign primitives to use the new task dialog
This commit is contained in:
@@ -76,7 +76,6 @@ set(PartDesignGui_UIC_SRCS
|
||||
TaskPolarPatternParameters.ui
|
||||
TaskScaledParameters.ui
|
||||
TaskMultiTransformParameters.ui
|
||||
TaskDatumParameters.ui
|
||||
TaskShapeBinder.ui
|
||||
TaskPrimitiveParameters.ui
|
||||
TaskPipeParameters.ui
|
||||
@@ -207,7 +206,6 @@ SET(PartDesignGuiTaskDlgs_SRCS
|
||||
#TaskHoleParameters.ui
|
||||
#TaskHoleParameters.cpp
|
||||
#TaskHoleParameters.h
|
||||
TaskDatumParameters.ui
|
||||
TaskDatumParameters.cpp
|
||||
TaskDatumParameters.h
|
||||
TaskShapeBinder.ui
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
#include <Mod/Part/App/Attacher.h>
|
||||
#include <Mod/Part/Gui/TaskAttacher.h>
|
||||
|
||||
#include "ViewProviderDatum.h"
|
||||
|
||||
@@ -46,126 +46,25 @@ namespace PartDesignGui {
|
||||
|
||||
|
||||
|
||||
class TaskDatumParameters : public Gui::TaskView::TaskBox, public Gui::SelectionObserver
|
||||
class TaskDatumParameters : public PartGui::TaskAttacher
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskDatumParameters(ViewProviderDatum *DatumView,QWidget *parent = 0);
|
||||
~TaskDatumParameters();
|
||||
|
||||
bool getFlip(void) const;
|
||||
|
||||
/**
|
||||
* @brief getActiveMapMode returns either the default mode for selected
|
||||
* references, or the mode that was selected by the user in the list. If
|
||||
* no modes fit current set of references, mmDeactivated is returned.
|
||||
*/
|
||||
Attacher::eMapMode getActiveMapMode();
|
||||
|
||||
bool isCompleted() const { return completed; }
|
||||
|
||||
private Q_SLOTS:
|
||||
void onSuperplacementChanged(double, int idx);
|
||||
void onSuperplacementXChanged(double);
|
||||
void onSuperplacementYChanged(double);
|
||||
void onSuperplacementZChanged(double);
|
||||
void onSuperplacementYawChanged(double);
|
||||
void onSuperplacementPitchChanged(double);
|
||||
void onSuperplacementRollChanged(double);
|
||||
void onCheckFlip(bool);
|
||||
void onRefName1(const QString& text);
|
||||
void onRefName2(const QString& text);
|
||||
void onRefName3(const QString& text);
|
||||
void onRefName4(const QString& text);
|
||||
void onButtonRef1(const bool checked = true);
|
||||
void onButtonRef2(const bool checked = true);
|
||||
void onButtonRef3(const bool checked = true);
|
||||
void onButtonRef4(const bool checked = true);
|
||||
void onModeSelect(void);
|
||||
void visibilityAutomation(bool opening_not_closing);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
void resetViewMode();
|
||||
void objectDeleted(const Gui::ViewProviderDocumentObject&);
|
||||
void onSelectionChanged(const Gui::SelectionChanges& msg) override;
|
||||
void updateReferencesUI();
|
||||
|
||||
/**
|
||||
* @brief updatePreview: calculate attachment, update 3d view, update status message
|
||||
* @return true if attachment calculation was successful, false otherwise
|
||||
*/
|
||||
bool updatePreview();
|
||||
|
||||
void makeRefStrings(std::vector<QString>& refstrings, std::vector<std::string>& refnames);
|
||||
QLineEdit* getLine(unsigned idx);
|
||||
void onButtonRef(const bool checked, unsigned idx);
|
||||
void onRefName(const QString& text, unsigned idx);
|
||||
void updateRefButton(int idx);
|
||||
void updateSuperplacementUI();
|
||||
|
||||
/**
|
||||
* @brief updateListOfModes Fills the mode list with modes that apply to
|
||||
* current set of references.
|
||||
* @param curMode the mode to select in the list. If the mode isn't
|
||||
* contained in the list, nothing is selected. If mmDeactivated is passed,
|
||||
* currently selected mode is kept.
|
||||
*/
|
||||
void updateListOfModes(Attacher::eMapMode curMode = Attacher::mmDeactivated);
|
||||
|
||||
private:
|
||||
QWidget* proxy;
|
||||
Ui_TaskDatumParameters* ui;
|
||||
ViewProviderDatum *DatumView;
|
||||
|
||||
// TODO fix documentation here (2015-11-10, Fat-Zer)
|
||||
int iActiveRef; //what reference is being picked in 3d view now? -1 means no one, 0-3 means a reference is being picked.
|
||||
bool autoNext;//if we should automatically switch to next reference (true after dialog launch, false afterwards)
|
||||
std::vector<Attacher::eMapMode> modesInList; //this list is synchronous to what is populated into listOfModes widget.
|
||||
Attacher::SuggestResult lastSuggestResult;
|
||||
bool completed;
|
||||
|
||||
typedef boost::BOOST_SIGNALS_NAMESPACE::connection Connection;
|
||||
Connection connectDelObject;
|
||||
~TaskDatumParameters();
|
||||
};
|
||||
|
||||
/// simulation dialog for the TaskView
|
||||
class TaskDlgDatumParameters : public Gui::TaskView::TaskDialog
|
||||
class TaskDlgDatumParameters : public PartGui::TaskDlgAttacher
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskDlgDatumParameters(ViewProviderDatum *DatumView);
|
||||
~TaskDlgDatumParameters();
|
||||
|
||||
ViewProviderDatum* getDatumView() const
|
||||
{ return DatumView; }
|
||||
|
||||
|
||||
public:
|
||||
/// is called the TaskView when the dialog is opened
|
||||
virtual void open();
|
||||
/// is called by the framework if an button is clicked which has no accept or reject role
|
||||
virtual void clicked(int);
|
||||
/// is called by the framework if the dialog is accepted (Ok)
|
||||
|
||||
virtual bool accept();
|
||||
/// is called by the framework if the dialog is rejected (Cancel)
|
||||
virtual bool reject();
|
||||
/// is called by the framework if the user presses the help button
|
||||
virtual bool isAllowedAlterDocument(void) const
|
||||
{ return false; }
|
||||
|
||||
/// returns for Close and Help button
|
||||
virtual QDialogButtonBox::StandardButtons getStandardButtons(void) const
|
||||
{ return QDialogButtonBox::Ok|QDialogButtonBox::Cancel; }
|
||||
|
||||
protected:
|
||||
ViewProviderDatum *DatumView;
|
||||
|
||||
TaskDatumParameters *parameter;
|
||||
};
|
||||
|
||||
} //namespace PartDesignGui
|
||||
|
||||
@@ -1,383 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PartDesignGui::TaskDatumParameters</class>
|
||||
<widget class="QWidget" name="PartDesignGui::TaskDatumParameters">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>271</width>
|
||||
<height>604</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="message">
|
||||
<property name="text">
|
||||
<string>Selection accepted</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonRef1">
|
||||
<property name="text">
|
||||
<string>Reference 1</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineRef1"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonRef2">
|
||||
<property name="text">
|
||||
<string>Reference 2</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineRef2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonRef3">
|
||||
<property name="text">
|
||||
<string>Reference 3</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineRef3"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonRef4">
|
||||
<property name="text">
|
||||
<string>Reference 4</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineRef4"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Attachment mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listOfModes">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_superplacement">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Mirror of superPlacement property. Extra placement is expressed in local space of object being attached.</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Extra placement:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelOffset">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>X:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>labelOffset</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelOffset2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Y:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="superplacementY" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelOffset3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Z:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="superplacementZ" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelYaw">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Yaw:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="labelPitch">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pitch:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="labelRoll">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Roll:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="superplacementX" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="superplacementYaw">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">deg</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-360.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>360.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="superplacementPitch">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">deg</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-360.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>360.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="superplacementRoll">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">deg</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-360.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>360.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxFlip">
|
||||
<property name="text">
|
||||
<string>Flip sides</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::QuantitySpinBox</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Gui/QuantitySpinBox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefQuantitySpinBox</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>buttonRef1</tabstop>
|
||||
<tabstop>lineRef1</tabstop>
|
||||
<tabstop>buttonRef2</tabstop>
|
||||
<tabstop>lineRef2</tabstop>
|
||||
<tabstop>buttonRef3</tabstop>
|
||||
<tabstop>lineRef3</tabstop>
|
||||
<tabstop>buttonRef4</tabstop>
|
||||
<tabstop>lineRef4</tabstop>
|
||||
<tabstop>listOfModes</tabstop>
|
||||
<tabstop>superplacementX</tabstop>
|
||||
<tabstop>superplacementY</tabstop>
|
||||
<tabstop>superplacementZ</tabstop>
|
||||
<tabstop>superplacementYaw</tabstop>
|
||||
<tabstop>superplacementPitch</tabstop>
|
||||
<tabstop>superplacementRoll</tabstop>
|
||||
<tabstop>checkBoxFlip</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<designerdata>
|
||||
<property name="gridDeltaX">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="gridDeltaY">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="gridSnapX">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="gridSnapY">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="gridVisible">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</designerdata>
|
||||
</ui>
|
||||
@@ -602,11 +602,11 @@ TaskPrimitiveParameters::TaskPrimitiveParameters(ViewProviderPrimitive* Primitiv
|
||||
|
||||
assert(PrimitiveView);
|
||||
|
||||
//parameter = new TaskDatumParameters(vp);
|
||||
//Content.push_back(parameter);
|
||||
|
||||
primitive = new TaskBoxPrimitives(PrimitiveView);
|
||||
Content.push_back(primitive);
|
||||
|
||||
parameter = new PartGui::TaskAttacher(PrimitiveView);
|
||||
Content.push_back(parameter);
|
||||
}
|
||||
|
||||
TaskPrimitiveParameters::~TaskPrimitiveParameters()
|
||||
|
||||
@@ -120,8 +120,8 @@ protected:
|
||||
virtual bool reject();
|
||||
|
||||
private:
|
||||
TaskBoxPrimitives* primitive;
|
||||
TaskDatumParameters* parameter;
|
||||
TaskBoxPrimitives* primitive;
|
||||
PartGui::TaskAttacher* parameter;
|
||||
ViewProviderPrimitive* vp_prm;
|
||||
};
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ bool ViewProviderDatum::setEdit(int ModNum)
|
||||
// the task panel
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
TaskDlgDatumParameters *datumDlg = qobject_cast<TaskDlgDatumParameters *>(dlg);
|
||||
if (datumDlg && datumDlg->getDatumView() != this)
|
||||
if (datumDlg && datumDlg->getViewProvider() != this)
|
||||
datumDlg = 0; // another datum feature left open its task panel
|
||||
if (dlg && !datumDlg) {
|
||||
QMessageBox msgBox;
|
||||
|
||||
Reference in New Issue
Block a user