[qet] [4493] Added view mode in Cross References - included Folio Field

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


Revision: 4493
Author:   dfochi
Date:     2016-05-20 22:31:55 +0200 (Fri, 20 May 2016)
Log Message:
-----------
Added view mode in Cross References - included Folio Field

Modified Paths:
--------------
    trunk/sources/projectconfigpages.cpp
    trunk/sources/properties/xrefproperties.cpp
    trunk/sources/properties/xrefproperties.h
    trunk/sources/qetgraphicsitem/crossrefitem.cpp
    trunk/sources/ui/titleblockpropertieswidget.ui
    trunk/sources/ui/xrefpropertieswidget.cpp
    trunk/sources/ui/xrefpropertieswidget.ui

Modified: trunk/sources/projectconfigpages.cpp
===================================================================
--- trunk/sources/projectconfigpages.cpp	2016-05-20 20:22:44 UTC (rev 4492)
+++ trunk/sources/projectconfigpages.cpp	2016-05-20 20:31:55 UTC (rev 4493)
@@ -331,7 +331,7 @@
 	//Auto Numbering Tab
 	tab_widget->addTab(autoNumbering_tab_widget,tr ("Folio Auto Numbering"));
 
-	tab_widget->resize(440,590);
+	tab_widget->resize(455,590);
 }
 
 /**
@@ -514,7 +514,7 @@
 			tab_widget->resize(470,tab_widget->height());
 		}
 		else {
-			tab_widget->resize(440,tab_widget->height());
+			tab_widget->resize(455,tab_widget->height());
 		}
 	}
 }

Modified: trunk/sources/properties/xrefproperties.cpp
===================================================================
--- trunk/sources/properties/xrefproperties.cpp	2016-05-20 20:22:44 UTC (rev 4492)
+++ trunk/sources/properties/xrefproperties.cpp	2016-05-20 20:31:55 UTC (rev 4493)
@@ -27,6 +27,7 @@
 	m_show_power_ctc = true;
 	m_display = Cross;
 	m_snap_to = Bottom;
+	m_view_mode = Index;
 	m_prefix_keys << "power" << "delay" << "switch";
 }
 
@@ -40,6 +41,8 @@
 	settings.setValue(prefix + "showpowerctc", m_show_power_ctc);
 	QString display = m_display == Cross? "cross" : "contacts";
 	settings.setValue(prefix + "displayhas", display);
+	QString view_mode = m_view_mode == Index? "index" : "foliolabel";
+	settings.setValue(prefix + "viewmode", view_mode);
 	QString snap = m_snap_to == Bottom? "bottom" : "label";
 	settings.setValue(prefix + "snapto", snap);
 	foreach (QString key, m_prefix.keys()) {
@@ -57,6 +60,8 @@
 	m_show_power_ctc = settings.value(prefix + "showpowerctc", false).toBool();
 	QString display = settings.value(prefix + "displayhas", "cross").toString();
 	display == "cross"? m_display = Cross : m_display = Contacts;
+	QString view_mode = settings.value(prefix + "viewmode", "index").toString();
+	view_mode == "index"? m_view_mode = Index : m_view_mode = FolioLabel;
 	QString snap = settings.value(prefix + "snapto", "label").toString();
 	snap == "bottom"? m_snap_to = Bottom : m_snap_to = Label;
 	foreach (QString key, m_prefix_keys) {
@@ -73,6 +78,8 @@
 	xml_element.setAttribute("showpowerctc", m_show_power_ctc? "true" : "false");
 	QString display = m_display == Cross? "cross" : "contacts";
 	xml_element.setAttribute("displayhas", display);
+	QString view_mode = m_view_mode == Index? "index" : "foliolabel";
+	xml_element.setAttribute("viewmode", view_mode);
 	QString snap = m_snap_to == Bottom? "bottom" : "label";
 	xml_element.setAttribute("snapto", snap);
 	foreach (QString key, m_prefix.keys()) {
@@ -89,6 +96,8 @@
 	m_show_power_ctc = xml_element.attribute("showpowerctc")  == "true";
 	QString display = xml_element.attribute("displayhas", "cross");
 	display == "cross"? m_display = Cross : m_display = Contacts;
+	QString view_mode = xml_element.attribute("viewmode", "index");
+	view_mode == "index"? m_view_mode = Index : m_view_mode = FolioLabel;
 	QString snap = xml_element.attribute("snapto", "label");
 	snap == "bottom"? m_snap_to = Bottom : m_snap_to = Label;
 	foreach (QString key, m_prefix_keys) {
@@ -125,6 +134,7 @@
 bool XRefProperties::operator ==(const XRefProperties &xrp) const{
 	return (m_show_power_ctc == xrp.m_show_power_ctc &&
 			m_display == xrp.m_display &&
+			m_view_mode == xrp.m_view_mode &&
 			m_snap_to == xrp.m_snap_to &&
 			m_prefix == xrp.m_prefix);
 }

Modified: trunk/sources/properties/xrefproperties.h
===================================================================
--- trunk/sources/properties/xrefproperties.h	2016-05-20 20:22:44 UTC (rev 4492)
+++ trunk/sources/properties/xrefproperties.h	2016-05-20 20:31:55 UTC (rev 4493)
@@ -35,6 +35,11 @@
 		Contacts
 	};
 
+	enum ViewMode {
+		Index,
+		FolioLabel
+	};
+
 	enum SnapTo {
 		Bottom,
 		Label
@@ -56,6 +61,9 @@
 	void setDisplayHas	  (const DisplayHas dh) {m_display = dh;}
 	DisplayHas displayHas () const				{return m_display;}
 
+	void setViewMode	  (const ViewMode vm) {m_view_mode = vm;}
+	ViewMode viewMode ()   const			  {return m_view_mode;}
+
 	void setSnapTo (const SnapTo st) {m_snap_to = st;}
 	SnapTo snapTo  () const			 {return m_snap_to;}
 
@@ -65,6 +73,7 @@
 	private:
 	bool m_show_power_ctc;
 	DisplayHas m_display;
+	ViewMode   m_view_mode;
 	SnapTo m_snap_to;
 	QHash <QString, QString> m_prefix;
 	QStringList m_prefix_keys;

Modified: trunk/sources/qetgraphicsitem/crossrefitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/crossrefitem.cpp	2016-05-20 20:22:44 UTC (rev 4492)
+++ trunk/sources/qetgraphicsitem/crossrefitem.cpp	2016-05-20 20:31:55 UTC (rev 4493)
@@ -89,8 +89,16 @@
  * if @add_prefix is true, prefix (for power and delay contact) is added to the poistion text.
  */
 QString CrossRefItem::elementPositionText(const Element *elmt, const bool &add_prefix) const{
+
 	QString txt;
-	txt += QString::number(elmt->diagram()->folioIndex() + 1);
+	XRefProperties::ViewMode vw = m_properties.viewMode();
+	if (vw == XRefProperties::Index)
+	{
+		txt += QString::number(elmt->diagram()->folioIndex() + 1);
+	}
+	else if (vw == XRefProperties::FolioLabel){
+		txt += elmt->diagram()->border_and_titleblock.folio();
+	}
 	txt += "-";
 	txt += elmt->diagram()->convertPosition(elmt -> scenePos()).toString();
 	if (add_prefix) {

Modified: trunk/sources/ui/titleblockpropertieswidget.ui
===================================================================
--- trunk/sources/ui/titleblockpropertieswidget.ui	2016-05-20 20:22:44 UTC (rev 4492)
+++ trunk/sources/ui/titleblockpropertieswidget.ui	2016-05-20 20:31:55 UTC (rev 4493)
@@ -289,7 +289,7 @@
                   <item row="0" column="0">
                    <widget class="QComboBox" name="auto_page_cb">
                     <property name="sizePolicy">
-                     <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                     <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
                       <horstretch>0</horstretch>
                       <verstretch>0</verstretch>
                      </sizepolicy>
@@ -299,7 +299,7 @@
                   <item row="0" column="1">
                    <widget class="QPushButton" name="m_edit_autofolionum_pb">
                     <property name="sizePolicy">
-                     <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+                     <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
                       <horstretch>0</horstretch>
                       <verstretch>0</verstretch>
                      </sizepolicy>
@@ -323,6 +323,12 @@
                 </item>
                 <item row="7" column="1">
                  <widget class="QLabel" name="label_9">
+                  <property name="sizePolicy">
+                   <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+                    <horstretch>0</horstretch>
+                    <verstretch>0</verstretch>
+                   </sizepolicy>
+                  </property>
                   <property name="text">
                    <string>Page Num:</string>
                   </property>
@@ -344,27 +350,27 @@
                   <property name="text">
                    <string>Vous pouvez définir ici vos propres associations noms/valeurs pour que le cartouche en tienne compte. Exemple :
 associer le nom &quot;volta&quot; et la valeur &quot;1745&quot; remplacera %{volta} par 1745 dans le cartouche.</string>
-              </property>
-              <property name="wordWrap">
-               <bool>true</bool>
-              </property>
-             </widget>
-            </item>
-           </layout>
+                  </property>
+                  <property name="wordWrap">
+                   <bool>true</bool>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
+              </item>
+             </layout>
+            </widget>
+           </widget>
           </item>
          </layout>
         </widget>
-       </widget>
-      </item>
-     </layout>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
   </layout>
  </widget>
-    </widget>
-   </item>
-  </layout>
- </widget>
  <resources>
   <include location="../../qelectrotech.qrc"/>
  </resources>

Modified: trunk/sources/ui/xrefpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/xrefpropertieswidget.cpp	2016-05-20 20:22:44 UTC (rev 4492)
+++ trunk/sources/ui/xrefpropertieswidget.cpp	2016-05-20 20:31:55 UTC (rev 4493)
@@ -110,6 +110,8 @@
 
 	if		(ui->m_display_has_cross_rb->isChecked())	 xrp.setDisplayHas(XRefProperties::Cross);
 	else if (ui->m_display_has_contacts_rb->isChecked()) xrp.setDisplayHas(XRefProperties::Contacts);
+	if		(ui->m_display_folio_index_rb->isChecked())  xrp.setViewMode  (XRefProperties::Index);
+	else if (ui->m_display_folio_label_rb->isChecked())  xrp.setViewMode  (XRefProperties::FolioLabel);
 	if (ui->m_snap_to_cb->itemData(ui->m_snap_to_cb->currentIndex()).toString() == "bottom")
 		 xrp.setSnapTo(XRefProperties::Bottom);
 	else xrp.setSnapTo(XRefProperties::Label);
@@ -137,6 +139,14 @@
 		ui->m_display_has_contacts_rb->setChecked(true);
 	}
 
+	XRefProperties::ViewMode vw = xrp.viewMode();
+	if		(vw == XRefProperties::Index)	{
+		ui->m_display_folio_index_rb->setChecked(true);
+	}
+	else if (vw == XRefProperties::FolioLabel) {
+		ui->m_display_folio_label_rb->setChecked(true);
+	}
+
 	if (xrp.snapTo() == XRefProperties::Bottom)
 		 ui->m_snap_to_cb->setCurrentIndex(ui->m_snap_to_cb->findData("bottom"));
 	else ui->m_snap_to_cb->setCurrentIndex(ui->m_snap_to_cb->findData("label"));

Modified: trunk/sources/ui/xrefpropertieswidget.ui
===================================================================
--- trunk/sources/ui/xrefpropertieswidget.ui	2016-05-20 20:22:44 UTC (rev 4492)
+++ trunk/sources/ui/xrefpropertieswidget.ui	2016-05-20 20:31:55 UTC (rev 4493)
@@ -49,19 +49,56 @@
        </layout>
       </item>
       <item>
-       <layout class="QVBoxLayout" name="verticalLayout_2">
+       <layout class="QHBoxLayout" name="horizontalLayout_3">
         <item>
-         <widget class="QRadioButton" name="m_display_has_cross_rb">
-          <property name="text">
-           <string>Afficher en croix</string>
-          </property>
-         </widget>
+         <layout class="QVBoxLayout" name="verticalLayout_2">
+          <item>
+           <widget class="QRadioButton" name="m_display_has_contacts_rb">
+            <property name="text">
+             <string>Afficher en contacts</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QRadioButton" name="m_display_has_cross_rb">
+            <property name="text">
+             <string>Afficher en croix</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
         </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QVBoxLayout" name="verticalLayout_5">
         <item>
-         <widget class="QRadioButton" name="m_display_has_contacts_rb">
-          <property name="text">
-           <string>Afficher en contacts</string>
+         <widget class="QGroupBox" name="groupBox">
+          <property name="title">
+           <string>View Mode</string>
           </property>
+          <layout class="QVBoxLayout" name="verticalLayout_6">
+           <item>
+            <widget class="QRadioButton" name="m_display_folio_label_rb">
+             <property name="text">
+              <string>View Folio Label</string>
+             </property>
+             <property name="autoExclusive">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QRadioButton" name="m_display_folio_index_rb">
+             <property name="text">
+              <string>View Folio Index</string>
+             </property>
+             <property name="autoExclusive">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+          </layout>
          </widget>
         </item>
        </layout>


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