[qet] [4641] GenericPanel : add switch for folio ID or folio label

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


Revision: 4641
Author:   scorpio810
Date:     2016-08-20 14:52:57 +0200 (Sat, 20 Aug 2016)
Log Message:
-----------
GenericPanel : add switch for folio ID or folio label

Modified Paths:
--------------
    trunk/sources/genericpanel.cpp

Modified: trunk/sources/genericpanel.cpp
===================================================================
--- trunk/sources/genericpanel.cpp	2016-08-19 14:55:28 UTC (rev 4640)
+++ trunk/sources/genericpanel.cpp	2016-08-20 12:52:57 UTC (rev 4641)
@@ -282,12 +282,26 @@
 QTreeWidgetItem *GenericPanel::updateDiagramItem(QTreeWidgetItem *diagram_qtwi, Diagram *diagram, PanelOptions options, bool freshly_created) {
 	Q_UNUSED(options)
 	if (!diagram || !diagram_qtwi) return(0);
+	QSettings settings;
 	
 	QString displayed_title = diagram -> title();
 	if (displayed_title.isEmpty()) {
-        displayed_title = tr("Folio sans titre", "Fallback label when a diagram has no title");
+		displayed_title = tr("Folio sans titre", "Fallback label when a diagram has no title");
 	}
+	if (settings.value("genericpanel/folio", true).toBool()){
+	QString displayed_label = diagram ->border_and_titleblock.folio();
+	int diagram_folio_idx = diagram -> folioIndex();
+	if (diagram_folio_idx != -1) {
+		displayed_label = QString(
+			tr(
+				"%1 - %2",
+				"label displayed for a diagram in the panel ; %1 is the folio index, %2 is the diagram title"
+			)
+		).arg(displayed_label).arg(displayed_title);
+		diagram_qtwi -> setText(0, displayed_label);
+	}
 	
+	}else{
 	QString displayed_label;
 	int diagram_folio_idx = diagram -> folioIndex();
 	if (diagram_folio_idx != -1) {
@@ -297,12 +311,11 @@
 				"label displayed for a diagram in the panel ; %1 is the folio index, %2 is the diagram title"
 			)
 		).arg(diagram_folio_idx + 1).arg(displayed_title);
-	} else {
-		displayed_label = displayed_title;
 	}
 	
+	diagram_qtwi -> setText(0, displayed_label);
 	
-	diagram_qtwi -> setText(0, displayed_label);
+	}
 	if (freshly_created) {
 		diagram_qtwi -> setData(0, GenericPanel::Item, qVariantFromValue(diagram));
 		diagrams_.insert(diagram, diagram_qtwi);
@@ -314,8 +327,10 @@
 	}
 	
 	return(updateItem(diagram_qtwi, options, freshly_created));
-}
+	}
 
+
+
 /**
 	
 */


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