[qet] [3919] Add title block embedded in a project ( but not in common or custom collection) available

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


Revision: 3919
Author:   blacksun
Date:     2015-04-25 10:43:00 +0200 (Sat, 25 Apr 2015)
Log Message:
-----------
Add title block embedded in a project (but not in common or custom collection) available
as a default title block for a new diagram in this project. 

Modified Paths:
--------------
    trunk/sources/configpages.cpp
    trunk/sources/qetproject.cpp

Modified: trunk/sources/configpages.cpp
===================================================================
--- trunk/sources/configpages.cpp	2015-04-22 15:24:46 UTC (rev 3918)
+++ trunk/sources/configpages.cpp	2015-04-25 08:43:00 UTC (rev 3919)
@@ -46,6 +46,7 @@
 	// default titleblock properties
 	QList <TitleBlockTemplatesCollection *> c;
 	c << QETApp::commonTitleBlockTemplatesCollection() << QETApp::customTitleBlockTemplatesCollection();
+	if (m_project) c << m_project->embeddedTitleBlockTemplatesCollection();
 	ipw = new TitleBlockPropertiesWidget(c, TitleBlockProperties::defaultProperties(), true);
 	// default conductor properties
 	cpw = new ConductorPropertiesWidget(ConductorProperties::defaultProperties());

Modified: trunk/sources/qetproject.cpp
===================================================================
--- trunk/sources/qetproject.cpp	2015-04-22 15:24:46 UTC (rev 3918)
+++ trunk/sources/qetproject.cpp	2015-04-25 08:43:00 UTC (rev 3919)
@@ -456,8 +456,21 @@
 	if (!titleblock.template_name.isEmpty())
 	{
 		TitleBlockTemplatesFilesCollection *collection = nullptr;
-		collection = titleblock.collection == QET::QetCollection::Common ? QETApp::commonTitleBlockTemplatesCollection() :
-																		   QETApp::customTitleBlockTemplatesCollection();
+		switch (titleblock.collection)
+		{
+			case QET::Common :
+				collection = QETApp::commonTitleBlockTemplatesCollection();
+				break;
+			case QET::Custom :
+				collection = QETApp::customTitleBlockTemplatesCollection();
+				break;
+			case QET::Embendded :
+				//Titleblock is already embedded to project
+				return;
+			default:
+				return;
+		}
+
 		QScopedPointer<IntegrationMoveTitleBlockTemplatesHandler> m(new IntegrationMoveTitleBlockTemplatesHandler);
 		integrateTitleBlockTemplate(collection -> location(titleblock.template_name), m.data());
 	}


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