[qet] qet/qet: [5510] Add in config the possibility to start the numbering of the columns of

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


Revision: 5510
Author:   scorpio810
Date:     2018-09-22 12:39:36 +0200 (Sat, 22 Sep 2018)
Log Message:
-----------
Add in config the possibility to start the numbering of the columns of
titleblocks at 0.

Modified Paths:
--------------
    trunk/sources/autoNum/assignvariables.cpp
    trunk/sources/bordertitleblock.cpp
    trunk/sources/diagramposition.cpp
    trunk/sources/ui/configpage/generalconfigurationpage.cpp
    trunk/sources/ui/configpage/generalconfigurationpage.ui

Modified: trunk/sources/autoNum/assignvariables.cpp
===================================================================
--- trunk/sources/autoNum/assignvariables.cpp	2018-09-17 02:14:39 UTC (rev 5509)
+++ trunk/sources/autoNum/assignvariables.cpp	2018-09-22 10:39:36 UTC (rev 5510)
@@ -193,7 +193,8 @@
 
 		return str;
 	}
-
+	QSettings settings;
+	
 	AssignVariables::AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt):
 	m_diagram(diagram),
 	m_arg_formula(formula),
@@ -200,6 +201,7 @@
 	m_assigned_label(formula),
 	m_seq_struct(seqStruct),
 	m_element(elmt)
+	
 	{
 		if (m_diagram)
 		{
@@ -210,10 +212,14 @@
 			m_assigned_label.replace("%M",  m_diagram -> border_and_titleblock.machine());
 			m_assigned_label.replace("%LM", m_diagram -> border_and_titleblock.locmach());
 
-
+	
 			if (m_element)
 			{
+			if (settings.value("border-columns_0", true).toBool()){
+				m_assigned_label.replace("%c", QString::number(m_diagram->convertPosition(m_element->scenePos()).number() - 1));
+				}else{
 				m_assigned_label.replace("%c", QString::number(m_diagram->convertPosition(m_element->scenePos()).number()));
+				}
 				m_assigned_label.replace("%l", m_diagram->convertPosition(m_element->scenePos()).letter());
 				m_assigned_label.replace("%prefix", m_element->getPrefix());
 			}

Modified: trunk/sources/bordertitleblock.cpp
===================================================================
--- trunk/sources/bordertitleblock.cpp	2018-09-17 02:14:39 UTC (rev 5509)
+++ trunk/sources/bordertitleblock.cpp	2018-09-22 10:39:36 UTC (rev 5510)
@@ -437,6 +437,8 @@
 	painter -> setPen(pen);
 	painter -> setBrush(Qt::NoBrush);
 	
+	QSettings settings;
+	
 		//Draw the borer
 	if (display_border_) painter -> drawRect(diagram_rect_);
 	
@@ -464,7 +466,11 @@
 				columns_header_height_
 			);
 			painter -> drawRect(numbered_rectangle);
+			if (settings.value("border-columns_0", true).toBool()){
+			painter -> drawText(numbered_rectangle, Qt::AlignVCenter | Qt::AlignCenter, QString("%1").arg(i - 1));
+			}else{
 			painter -> drawText(numbered_rectangle, Qt::AlignVCenter | Qt::AlignCenter, QString("%1").arg(i));
+			}
 		}
 	}
 	
@@ -530,6 +536,8 @@
 		);
 	}
 
+	QSettings settings;
+	
 	// dessine la numerotation des colonnes
 	if (display_border_ &&
 		display_columns_) {
@@ -541,8 +549,13 @@
 			double recWidth = columns_width_;
 			double recHeight = columns_header_height_;
 			Createdxf::drawRectangle(file_path, xCoord, yCoord, recWidth, recHeight, color);
+			if (settings.value("border-columns_0", true).toBool()){
+			Createdxf::drawTextAligned(file_path, QString::number(i - 1), xCoord,
+									   yCoord + recHeight*0.5, recHeight*0.7, 0, 0, 1, 2, xCoord+recWidth/2, color, 0);
+			}else{
 			Createdxf::drawTextAligned(file_path, QString::number(i), xCoord,
 									   yCoord + recHeight*0.5, recHeight*0.7, 0, 0, 1, 2, xCoord+recWidth/2, color, 0);
+			}
 		}
 	}
 

Modified: trunk/sources/diagramposition.cpp
===================================================================
--- trunk/sources/diagramposition.cpp	2018-09-17 02:14:39 UTC (rev 5509)
+++ trunk/sources/diagramposition.cpp	2018-09-22 10:39:36 UTC (rev 5510)
@@ -16,6 +16,7 @@
 	along with QElectroTech.  If not, see <http://www.gnu.org/licenses/>.
 */
 #include "diagramposition.h"
+#include "qetapp.h"
 
 /**
 	Constructeur
@@ -59,7 +60,13 @@
 	if (isOutOfBounds()) {
 		return("-");
 	}
+	QSettings settings;
+	
+	if (settings.value("border-columns_0", true).toBool()){
+	return(QString("%1%2").arg(letter_).arg(number_ - 1));
+	}else{
 	return(QString("%1%2").arg(letter_).arg(number_));
+	}
 }
 
 /**

Modified: trunk/sources/ui/configpage/generalconfigurationpage.cpp
===================================================================
--- trunk/sources/ui/configpage/generalconfigurationpage.cpp	2018-09-17 02:14:39 UTC (rev 5509)
+++ trunk/sources/ui/configpage/generalconfigurationpage.cpp	2018-09-22 10:39:36 UTC (rev 5510)
@@ -46,6 +46,7 @@
 	ui->m_save_label_paste->setChecked(settings.value("diagramcommands/erase-label-on-copy", true).toBool());
 	ui->m_use_folio_label->setChecked(settings.value("genericpanel/folio", true).toBool());
 	ui->m_export_terminal->setChecked(settings.value("nomenclature-exportlist", true).toBool());
+	ui->m_border_0->setChecked(settings.value("border-columns_0", false).toBool());
 	ui->m_autosave_sb->setValue(settings.value("diagrameditor/autosave-interval", 0).toInt());
 	
 	QString fontInfos = settings.value("diagramitemfont").toString() + " " +
@@ -114,6 +115,7 @@
 	settings.setValue("diagrameditor/zoom-out-beyond-of-folio", ui->m_zoom_out_beyond_folio->isChecked());
 	settings.setValue("genericpanel/folio",ui->m_use_folio_label->isChecked());
 	settings.setValue("nomenclature/terminal-exportlist",ui->m_export_terminal->isChecked());
+	settings.setValue("border-columns_0",ui->m_border_0->isChecked());
 	settings.setValue("diagrameditor/autosave-interval", ui->m_autosave_sb->value());
 	
 	QString path = settings.value("elements-collections/common-collection-path").toString();

Modified: trunk/sources/ui/configpage/generalconfigurationpage.ui
===================================================================
--- trunk/sources/ui/configpage/generalconfigurationpage.ui	2018-09-17 02:14:39 UTC (rev 5509)
+++ trunk/sources/ui/configpage/generalconfigurationpage.ui	2018-09-22 10:39:36 UTC (rev 5510)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>827</width>
-    <height>779</height>
+    <width>930</width>
+    <height>905</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -108,7 +108,7 @@
       <string>Projets</string>
      </property>
      <layout class="QGridLayout" name="gridLayout">
-      <item row="8" column="2">
+      <item row="9" column="2">
        <widget class="QPushButton" name="m_font_pb">
         <property name="text">
          <string/>
@@ -115,7 +115,7 @@
         </property>
        </widget>
       </item>
-      <item row="7" column="0">
+      <item row="8" column="0">
        <widget class="QLabel" name="label">
         <property name="text">
          <string>Sauvegarde automatique des projets (appliqué au prochain lancement de QElectroTech)</string>
@@ -122,7 +122,7 @@
         </property>
        </widget>
       </item>
-      <item row="9" column="2">
+      <item row="10" column="2">
        <widget class="QPushButton" name="m_folio_list_pb">
         <property name="text">
          <string/>
@@ -150,7 +150,7 @@
         </property>
        </widget>
       </item>
-      <item row="9" column="0">
+      <item row="10" column="0">
        <widget class="QLabel" name="label_3">
         <property name="text">
          <string>Police des champs textes des pages sommaires</string>
@@ -157,7 +157,7 @@
         </property>
        </widget>
       </item>
-      <item row="8" column="0">
+      <item row="9" column="0">
        <widget class="QLabel" name="label_2">
         <property name="text">
          <string>Police des champs de texte</string>
@@ -171,7 +171,7 @@
         </property>
        </widget>
       </item>
-      <item row="7" column="2">
+      <item row="8" column="2">
        <widget class="QSpinBox" name="m_autosave_sb">
         <property name="frame">
          <bool>true</bool>
@@ -205,7 +205,7 @@
         </property>
        </widget>
       </item>
-      <item row="7" column="1">
+      <item row="8" column="1">
        <spacer name="horizontalSpacer">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
@@ -218,6 +218,13 @@
         </property>
        </spacer>
       </item>
+      <item row="7" column="0" colspan="2">
+       <widget class="QCheckBox" name="m_border_0">
+        <property name="text">
+         <string extracomment="Choix de l'increment de depart 1 ou 0">Activer la numérotation à partir de 0 pour la colonne des cartouches au lieu de 1</string>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>


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