[qet] [3375] Conductor : improve one text per folio and remove option no one text per folio

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 3375
Author:   blacksun
Date:     2014-10-13 20:42:38 +0200 (Mon, 13 Oct 2014)
Log Message:
-----------
Conductor : improve one text per folio and remove option no one text per folio

Modified Paths:
--------------
    trunk/sources/conductorproperties.cpp
    trunk/sources/conductorproperties.h
    trunk/sources/configpages.cpp
    trunk/sources/qetgraphicsitem/conductor.cpp
    trunk/sources/ui/conductorpropertiesdialog.cpp
    trunk/sources/ui/conductorpropertieswidget.cpp
    trunk/sources/ui/conductorpropertieswidget.h
    trunk/sources/ui/conductorpropertieswidget.ui
    trunk/sources/ui/diagrampropertiesdialog.cpp

Modified: trunk/sources/conductorproperties.cpp
===================================================================
--- trunk/sources/conductorproperties.cpp	2014-10-12 20:14:30 UTC (rev 3374)
+++ trunk/sources/conductorproperties.cpp	2014-10-13 18:42:38 UTC (rev 3375)
@@ -225,8 +225,7 @@
 	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 @@
 	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 @@
 	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 @@
 		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
 	);
 }
 

Modified: trunk/sources/conductorproperties.h
===================================================================
--- trunk/sources/conductorproperties.h	2014-10-12 20:14:30 UTC (rev 3374)
+++ trunk/sources/conductorproperties.h	2014-10-13 18:42:38 UTC (rev 3375)
@@ -86,7 +86,6 @@
 	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;
 	

Modified: trunk/sources/configpages.cpp
===================================================================
--- trunk/sources/configpages.cpp	2014-10-12 20:14:30 UTC (rev 3374)
+++ trunk/sources/configpages.cpp	2014-10-13 18:42:38 UTC (rev 3375)
@@ -47,7 +47,6 @@
 	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

Modified: trunk/sources/qetgraphicsitem/conductor.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/conductor.cpp	2014-10-12 20:14:30 UTC (rev 3374)
+++ trunk/sources/qetgraphicsitem/conductor.cpp	2014-10-13 18:42:38 UTC (rev 3375)
@@ -1183,7 +1183,8 @@
 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,23 +1192,15 @@
 		//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
-			foreach (Conductor *c, relatedPotentialConductors(false)) {
-				if (c -> properties_.m_no_one_text_per_folio == false)
+		//At this point this conductor is the longuest conductor we hide all text of conductor_list
+		foreach (Conductor *c, relatedPotentialConductors(false)) {
 					c -> textItem() -> setVisible(false);
-				else
-					c -> textItem() -> setVisible(c -> properties().m_show_text);
 			}
-			//Make sure text item is visible
-			text_item -> setVisible(true);
-		}
+		//Make sure text item is visible
+		text_item -> setVisible(true);
 	}
 
 	//position

Modified: trunk/sources/ui/conductorpropertiesdialog.cpp
===================================================================
--- trunk/sources/ui/conductorpropertiesdialog.cpp	2014-10-12 20:14:30 UTC (rev 3374)
+++ trunk/sources/ui/conductorpropertiesdialog.cpp	2014-10-13 18:42:38 UTC (rev 3375)
@@ -37,6 +37,10 @@
 	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);
 }
 

Modified: trunk/sources/ui/conductorpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/conductorpropertieswidget.cpp	2014-10-12 20:14:30 UTC (rev 3374)
+++ trunk/sources/ui/conductorpropertieswidget.cpp	2014-10-13 18:42:38 UTC (rev 3375)
@@ -75,7 +75,6 @@
 	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 @@
 	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 @@
 }
 
 /**
- * @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);
 }
 
 /**

Modified: trunk/sources/ui/conductorpropertieswidget.h
===================================================================
--- trunk/sources/ui/conductorpropertieswidget.h	2014-10-12 20:14:30 UTC (rev 3374)
+++ trunk/sources/ui/conductorpropertieswidget.h	2014-10-13 18:42:38 UTC (rev 3375)
@@ -42,7 +42,7 @@
 
 		void addAutonumWidget (QWidget *widget);
 		void setHiddenOneTextPerFolio   (const bool &hide);
-		void setHiddenNoOneTextPerFolio (const bool &hide);
+		void setDisabledShowText        (const bool &disable = true);
 
 	private:
 		void initWidget();

Modified: trunk/sources/ui/conductorpropertieswidget.ui
===================================================================
--- trunk/sources/ui/conductorpropertieswidget.ui	2014-10-12 20:14:30 UTC (rev 3374)
+++ trunk/sources/ui/conductorpropertieswidget.ui	2014-10-13 18:42:38 UTC (rev 3375)
@@ -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>

Modified: trunk/sources/ui/diagrampropertiesdialog.cpp
===================================================================
--- trunk/sources/ui/diagrampropertiesdialog.cpp	2014-10-12 20:14:30 UTC (rev 3374)
+++ trunk/sources/ui/diagrampropertiesdialog.cpp	2014-10-13 18:42:38 UTC (rev 3375)
@@ -64,7 +64,6 @@
 
 	//Conductor widget
 	ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(conductors, this);
-	cpw -> setHiddenNoOneTextPerFolio(true);
 	cpw -> setReadOnly(diagram_is_read_only);
 
 	//Conductor autonum


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/