mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 23:20:52 +01:00
0.6 branch : fix wrong behavior, in some condition when two folios report are linked together,
the value of the funtion and tension/protocol of the selected potential are not transmit to the other report. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.60@5107 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -57,7 +57,7 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector
|
|||||||
m_is_valid = true;
|
m_is_valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isValid() const {return m_is_valid;}
|
bool isValid() const override {return m_is_valid;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief getPotential
|
* @brief getPotential
|
||||||
@@ -110,7 +110,7 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector
|
|||||||
properties_list.append(c->properties());
|
properties_list.append(c->properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
~NewConductorPotentialSelector() {}
|
~NewConductorPotentialSelector() override {}
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool m_is_valid;
|
bool m_is_valid;
|
||||||
@@ -155,9 +155,9 @@ class LinkReportPotentialSelector : public AbstractPotentialSelector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~LinkReportPotentialSelector() {}
|
~LinkReportPotentialSelector() override {}
|
||||||
|
|
||||||
bool isValid() const {return m_is_valid;}
|
bool isValid() const override {return m_is_valid;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_is_valid;
|
bool m_is_valid;
|
||||||
@@ -215,8 +215,27 @@ PotentialSelectorDialog::~PotentialSelectorDialog()
|
|||||||
*/
|
*/
|
||||||
void PotentialSelectorDialog::buildWidget()
|
void PotentialSelectorDialog::buildWidget()
|
||||||
{
|
{
|
||||||
QRadioButton *rb1 = new QRadioButton(tr("Le potentiel avec numero de fil %1 est présent %2 fois").arg(m_potential_selector->m_properties_list_1.first().text).arg(m_potential_selector->m_conductor_number_1), this);
|
QString text1(tr("%n conducteurs composent le potentiel suivant :", "", m_potential_selector->m_conductor_number_1));
|
||||||
QRadioButton *rb2 = new QRadioButton(tr("Le potentiel avec numero de fil %1 est présent %2 fois").arg(m_potential_selector->m_properties_list_2.first().text).arg(m_potential_selector->m_conductor_number_2), this);
|
ConductorProperties cp1 = m_potential_selector->m_properties_list_1.first();
|
||||||
|
|
||||||
|
if(!cp1.text.isEmpty())
|
||||||
|
text1.append(tr("\nNuméro : %1").arg(cp1.text));
|
||||||
|
if(!cp1.m_function.isEmpty())
|
||||||
|
text1.append(tr("\nFonction : %1").arg(cp1.m_function));
|
||||||
|
if(!cp1.m_tension_protocol.isEmpty())
|
||||||
|
text1.append(tr("\nTension/protocole : %1").arg(cp1.m_tension_protocol));
|
||||||
|
|
||||||
|
QString text2(tr("%n conducteurs composent le potentiel suivant :", "", m_potential_selector->m_conductor_number_2));
|
||||||
|
ConductorProperties cp2 = m_potential_selector->m_properties_list_2.first();
|
||||||
|
if(!cp2.text.isEmpty())
|
||||||
|
text2.append(tr("\nNuméro : %1").arg(cp2.text));
|
||||||
|
if(!cp2.m_function.isEmpty())
|
||||||
|
text2.append(tr("\nFonction : %1").arg(cp2.m_function));
|
||||||
|
if(!cp2.m_tension_protocol.isEmpty())
|
||||||
|
text2.append(tr("\nTension/protocole : %1").arg(cp2.m_tension_protocol));
|
||||||
|
|
||||||
|
QRadioButton *rb1 = new QRadioButton(text1, this);
|
||||||
|
QRadioButton *rb2 = new QRadioButton(text2, this);
|
||||||
|
|
||||||
connect(rb1, &QRadioButton::toggled, [this](bool t)
|
connect(rb1, &QRadioButton::toggled, [this](bool t)
|
||||||
{
|
{
|
||||||
@@ -252,7 +271,6 @@ void PotentialSelectorDialog::buildWidget()
|
|||||||
rb2->setChecked(true);
|
rb2->setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief PotentialSelectorDialog::on_buttonBox_accepted
|
* @brief PotentialSelectorDialog::on_buttonBox_accepted
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class PotentialSelectorDialog : public QDialog
|
|||||||
public:
|
public:
|
||||||
explicit PotentialSelectorDialog(Conductor *conductor, QUndoCommand *parent_undo = nullptr, QWidget *parent = nullptr);
|
explicit PotentialSelectorDialog(Conductor *conductor, QUndoCommand *parent_undo = nullptr, QWidget *parent = nullptr);
|
||||||
explicit PotentialSelectorDialog(Element *report, QUndoCommand *parent_undo = nullptr, QWidget *parent = nullptr);
|
explicit PotentialSelectorDialog(Element *report, QUndoCommand *parent_undo = nullptr, QWidget *parent = nullptr);
|
||||||
~PotentialSelectorDialog();
|
~PotentialSelectorDialog() override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_buttonBox_accepted();
|
void on_buttonBox_accepted();
|
||||||
|
|||||||
@@ -123,29 +123,6 @@ bool LinkElementCommand::isLinkable(Element *element_a, Element *element_b, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief LinkElementCommand::addLink
|
|
||||||
* Add elements from the list to the linked element of edited element
|
|
||||||
* This method do several check to know if element can be linked or not.
|
|
||||||
* @param element_list
|
|
||||||
*/
|
|
||||||
void LinkElementCommand::addLink(QList<Element *> element_list)
|
|
||||||
{
|
|
||||||
setUpNewLink(element_list, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief LinkElementCommand::addLink
|
|
||||||
* This is an overloaded function
|
|
||||||
* @param element_
|
|
||||||
*/
|
|
||||||
void LinkElementCommand::addLink(Element *element_)
|
|
||||||
{
|
|
||||||
QList<Element *> list;
|
|
||||||
list << element_;
|
|
||||||
addLink(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LinkElementCommand::setLink
|
* @brief LinkElementCommand::setLink
|
||||||
* Replace all linked elements of edited element by elements stored in @element_list
|
* Replace all linked elements of edited element by elements stored in @element_list
|
||||||
@@ -209,6 +186,9 @@ void LinkElementCommand::redo()
|
|||||||
if(m_element->diagram()) m_element->diagram()->showMe();
|
if(m_element->diagram()) m_element->diagram()->showMe();
|
||||||
makeLink(m_linked_after);
|
makeLink(m_linked_after);
|
||||||
|
|
||||||
|
//If the action is to link two reports together, we check if the conductors
|
||||||
|
//of the new potential have the same text, function, and protocol.
|
||||||
|
//if not, a dialog ask what do to.
|
||||||
if (m_first_redo && (m_element->linkType() & Element::AllReport) \
|
if (m_first_redo && (m_element->linkType() & Element::AllReport) \
|
||||||
&& m_element->conductors().size() \
|
&& m_element->conductors().size() \
|
||||||
&& m_linked_after.size() && m_linked_after.first()->conductors().size())
|
&& m_linked_after.size() && m_linked_after.first()->conductors().size())
|
||||||
@@ -217,11 +197,18 @@ void LinkElementCommand::redo()
|
|||||||
QSet <Conductor *> c_list = m_element->conductors().first()->relatedPotentialConductors();
|
QSet <Conductor *> c_list = m_element->conductors().first()->relatedPotentialConductors();
|
||||||
c_list << m_element->conductors().first();
|
c_list << m_element->conductors().first();
|
||||||
//fill list of text
|
//fill list of text
|
||||||
QStringList strl;
|
QStringList str_txt;
|
||||||
foreach (const Conductor *c, c_list) strl<<(c->properties().text);
|
QStringList str_funct;
|
||||||
|
QStringList str_tens;
|
||||||
|
for (const Conductor *c : c_list)
|
||||||
|
{
|
||||||
|
str_txt << c->properties().text;
|
||||||
|
str_funct << c->properties().m_function;
|
||||||
|
str_tens << c->properties().m_tension_protocol;
|
||||||
|
}
|
||||||
|
|
||||||
//check text list, isn't same in potential, ask user what to do
|
//check text list, isn't same in potential, ask user what to do
|
||||||
if (!QET::eachStrIsEqual(strl))
|
if (!QET::eachStrIsEqual(str_txt) || !QET::eachStrIsEqual(str_funct) || !QET::eachStrIsEqual(str_tens))
|
||||||
{
|
{
|
||||||
PotentialSelectorDialog psd(m_element, this);
|
PotentialSelectorDialog psd(m_element, this);
|
||||||
psd.exec();
|
psd.exec();
|
||||||
|
|||||||
@@ -31,22 +31,20 @@ class Element;
|
|||||||
class LinkElementCommand : public QUndoCommand
|
class LinkElementCommand : public QUndoCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LinkElementCommand(Element *element_, QUndoCommand *parent = 0);
|
LinkElementCommand(Element *element_, QUndoCommand *parent = nullptr);
|
||||||
|
|
||||||
virtual int id() const {return 2;}
|
int id() const override {return 2;}
|
||||||
virtual bool mergeWith(const QUndoCommand *other);
|
bool mergeWith(const QUndoCommand *other) override;
|
||||||
|
|
||||||
static bool isLinkable (Element *element_a, Element *element_b, bool already_linked = false);
|
static bool isLinkable (Element *element_a, Element *element_b, bool already_linked = false);
|
||||||
|
|
||||||
void addLink (QList<Element *> element_list);
|
|
||||||
void addLink (Element *element_);
|
|
||||||
void setLink (QList<Element *> element_list);
|
void setLink (QList<Element *> element_list);
|
||||||
void setLink (Element *element_);
|
void setLink (Element *element_);
|
||||||
void unlink (QList<Element *> element_list);
|
void unlink (QList<Element *> element_list);
|
||||||
void unlinkAll ();
|
void unlinkAll ();
|
||||||
|
|
||||||
void undo();
|
void undo() override;
|
||||||
void redo();
|
void redo() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setUpNewLink (const QList<Element *> &element_list, bool already_link);
|
void setUpNewLink (const QList<Element *> &element_list, bool already_link);
|
||||||
|
|||||||
Reference in New Issue
Block a user