Conductor : improve one text per folio and remove option no one text per folio

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3375 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-10-13 18:42:38 +00:00
parent 53be98416c
commit 4e431ae04b
9 changed files with 21 additions and 43 deletions

View File

@@ -225,8 +225,7 @@ ConductorProperties::ConductorProperties() :
horiz_rotate_text(0),
style(Qt::SolidLine),
m_show_text(true),
m_one_text_per_folio(false),
m_no_one_text_per_folio(false)
m_one_text_per_folio(false)
{
}
@@ -257,7 +256,6 @@ void ConductorProperties::toXml(QDomElement &e) const {
e.setAttribute("numsize", text_size);
e.setAttribute("displaytext", m_show_text);
e.setAttribute("onetextperfolio", m_one_text_per_folio);
e.setAttribute("noonetextperfolio", m_no_one_text_per_folio);
e.setAttribute("vertirotatetext", verti_rotate_text);
e.setAttribute("horizrotatetext", horiz_rotate_text);
@@ -297,7 +295,6 @@ void ConductorProperties::fromXml(QDomElement &e) {
text_size = e.attribute("numsize", QString::number(9)).toInt();
m_show_text = e.attribute("displaytext", QString::number(1)).toInt();
m_one_text_per_folio = e.attribute("onetextperfolio", QString::number(0)).toInt();
m_no_one_text_per_folio = e.attribute("noonetextperfolio", QString::number(0)).toInt();
verti_rotate_text = e.attribute("vertirotatetext").toDouble();
horiz_rotate_text = e.attribute("horizrotatetext").toDouble();
@@ -380,8 +377,7 @@ bool ConductorProperties::operator==(const ConductorProperties &other) const{
other.verti_rotate_text == verti_rotate_text &&\
other.horiz_rotate_text == horiz_rotate_text &&\
other.singleLineProperties == singleLineProperties &&\
other.m_one_text_per_folio == m_one_text_per_folio &&\
other.m_no_one_text_per_folio == m_no_one_text_per_folio
other.m_one_text_per_folio == m_one_text_per_folio
);
}

View File

@@ -86,7 +86,6 @@ class ConductorProperties {
double horiz_rotate_text;
bool m_show_text;
bool m_one_text_per_folio;
bool m_no_one_text_per_folio;
/// conducteur style (Qt::SolidLine or Qt::DashLine)
Qt::PenStyle style;

View File

@@ -47,7 +47,6 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent) :
ipw = new TitleBlockPropertiesWidget(QETDiagramEditor::defaultTitleBlockProperties(), true);
// default conductor properties
cpw = new ConductorPropertiesWidget(QETDiagramEditor::defaultConductorProperties());
cpw -> setHiddenNoOneTextPerFolio(true);
// default propertie of report label
rpw = new ReportPropertieWidget(QETDiagramEditor::defaultReportProperties());
// default properties of xref

View File

@@ -1183,7 +1183,8 @@ QPointF Conductor::posForText(Qt::Orientations &flag) {
void Conductor::calculateTextItemPosition() {
if (!text_item || !diagram() || properties_.type != ConductorProperties::Multi) return;
if (diagram() -> defaultConductorProperties.m_one_text_per_folio == true) {
if (diagram() -> defaultConductorProperties.m_one_text_per_folio == true &&
relatedPotentialConductors(false).size() > 0) {
Conductor *longuest_conductor = longuestConductorInPotential(this);
@@ -1191,24 +1192,16 @@ void Conductor::calculateTextItemPosition() {
//we call calculateTextItemPosition of the longuest conductor
if(longuest_conductor != this) {
longuest_conductor -> calculateTextItemPosition();
//This isn't the longuest conductor, if option "m_no_one_text_per_folio" is false we return now
//else is true, that mean the text is visible, so we need to calcule position
if (properties_.m_no_one_text_per_folio == false) return;
return;
}
} else {
//At this point this conductor is the longuest conductor
//we hide all text of conductor_list or setVisible according to the
//properties of current conductor if option "m_no_one_text_per_folio" is true
//At this point this conductor is the longuest conductor we hide all text of conductor_list
foreach (Conductor *c, relatedPotentialConductors(false)) {
if (c -> properties_.m_no_one_text_per_folio == false)
c -> textItem() -> setVisible(false);
else
c -> textItem() -> setVisible(c -> properties().m_show_text);
}
//Make sure text item is visible
text_item -> setVisible(true);
}
}
//position
if (text_item -> wasMovedByUser()) {

View File

@@ -37,6 +37,10 @@ ConductorPropertiesDialog::ConductorPropertiesDialog(Conductor *conductor, QWidg
ui->setupUi(this);
m_cpw = new ConductorPropertiesWidget(conductor->properties());
m_cpw -> setHiddenOneTextPerFolio(true);
if (conductor -> diagram() -> defaultConductorProperties.m_one_text_per_folio == true &&
conductor -> relatedPotentialConductors().size()) {
m_cpw->setDisabledShowText();
}
ui -> main_layout -> insertWidget(1, m_cpw);
}

View File

@@ -75,7 +75,6 @@ void ConductorPropertiesWidget::setProperties(const ConductorProperties &propert
ui -> m_text_size_sb -> setValue (m_properties.text_size);
ui -> m_show_text_cb -> setChecked (m_properties.m_show_text);
ui -> m_one_text_per_folio_cb -> setChecked (m_properties.m_one_text_per_folio);
ui -> m_no_one_text_per_folio_cb -> setChecked (m_properties.m_no_one_text_per_folio);
ui -> m_earth_cb -> setChecked (m_properties.singleLineProperties.hasGround);
ui -> m_neutral_cb -> setChecked (m_properties.singleLineProperties.hasNeutral);
ui -> m_pen_cb -> setChecked (m_properties.singleLineProperties.isPen());
@@ -104,7 +103,6 @@ ConductorProperties ConductorPropertiesWidget::properties() const {
properties_.text_size = ui -> m_text_size_sb -> value();
properties_.m_show_text = ui -> m_show_text_cb -> isChecked();
properties_.m_one_text_per_folio = ui -> m_one_text_per_folio_cb -> isChecked();
properties_.m_no_one_text_per_folio = ui -> m_no_one_text_per_folio_cb -> isChecked();
properties_.verti_rotate_text = m_verti_select -> value();
properties_.horiz_rotate_text = m_horiz_select -> value();
@@ -141,11 +139,11 @@ void ConductorPropertiesWidget::setHiddenOneTextPerFolio(const bool &hide) {
}
/**
* @brief ConductorPropertiesWidget::setHiddenNoOneTextPerFolio
* @param hide
* @brief ConductorPropertiesWidget::setDisabledShowText
* @param disable
*/
void ConductorPropertiesWidget::setHiddenNoOneTextPerFolio(const bool &hide) {
ui -> m_no_one_text_per_folio_cb -> setHidden(hide);
void ConductorPropertiesWidget::setDisabledShowText(const bool &disable) {
ui->m_show_text_cb->setDisabled(disable==true? true : false);
}
/**

View File

@@ -42,7 +42,7 @@ class ConductorPropertiesWidget : public QWidget
void addAutonumWidget (QWidget *widget);
void setHiddenOneTextPerFolio (const bool &hide);
void setHiddenNoOneTextPerFolio (const bool &hide);
void setDisabledShowText (const bool &disable = true);
private:
void initWidget();

View File

@@ -111,16 +111,6 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="m_no_one_text_per_folio_cb">
<property name="toolTip">
<string>Ne pas subir l'option un texte par potentiel</string>
</property>
<property name="text">
<string>Ne pas subir l'option : Afficher un texte de potentiel par folio. (expérimental)</string>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@@ -64,7 +64,6 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare
//Conductor widget
ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(conductors, this);
cpw -> setHiddenNoOneTextPerFolio(true);
cpw -> setReadOnly(diagram_is_read_only);
//Conductor autonum