[qet] [3901] Add possibility to choose the default title block for a new project ( User title block isn't supported yet)

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


Revision: 3901
Author:   blacksun
Date:     2015-04-09 11:39:34 +0200 (Thu, 09 Apr 2015)
Log Message:
-----------
Add possibility to choose the default title block for a new project (User title block isn't supported yet)

Modified Paths:
--------------
    trunk/sources/configpages.cpp
    trunk/sources/qetproject.cpp
    trunk/sources/titleblockproperties.cpp
    trunk/sources/ui/titleblockpropertieswidget.cpp

Modified: trunk/sources/configpages.cpp
===================================================================
--- trunk/sources/configpages.cpp	2015-04-08 09:41:40 UTC (rev 3900)
+++ trunk/sources/configpages.cpp	2015-04-09 09:39:34 UTC (rev 3901)
@@ -42,9 +42,9 @@
 	//By default we set the global default properties
 
 	// dimensions by default for diagram
-	bpw = new	BorderPropertiesWidget(BorderProperties::defaultProperties());
+	bpw = new BorderPropertiesWidget(BorderProperties::defaultProperties());
 	// default titleblock properties
-	ipw = new TitleBlockPropertiesWidget(TitleBlockProperties::defaultProperties(), true);
+	ipw = new TitleBlockPropertiesWidget(QETApp::commonTitleBlockTemplatesCollection(), TitleBlockProperties::defaultProperties(), true);
 	// default conductor properties
 	cpw = new ConductorPropertiesWidget(ConductorProperties::defaultProperties());
 	// default propertie of report label

Modified: trunk/sources/qetproject.cpp
===================================================================
--- trunk/sources/qetproject.cpp	2015-04-08 09:41:40 UTC (rev 3900)
+++ trunk/sources/qetproject.cpp	2015-04-09 09:39:34 UTC (rev 3901)
@@ -31,6 +31,7 @@
 #include "ui/dialogwaiting.h"
 #include "numerotationcontext.h"
 #include "reportproperties.h"
+#include "integrationmovetemplateshandler.h"
 
 #include <QStandardPaths>
 
@@ -445,12 +446,18 @@
 }
 
 /**
-	Permet de specifier le cartouche par defaut utilise lors de la creation
-	d'un nouveau schema dans ce projet.
-	@param titleblock Cartouche d'un schema
-*/
+ * @brief QETProject::setDefaultTitleBlockProperties
+ * Specify the title block to be used at the creation of a new diagram for this project
+ * @param titleblock
+ */
 void QETProject::setDefaultTitleBlockProperties(const TitleBlockProperties &titleblock) {
 	default_titleblock_properties_ = titleblock;
+		//Integrate the title block in this project
+	if (!titleblock.template_name.isEmpty())
+	{
+		QScopedPointer<IntegrationMoveTitleBlockTemplatesHandler> m(new IntegrationMoveTitleBlockTemplatesHandler);
+		integrateTitleBlockTemplate(QETApp::commonTitleBlockTemplatesCollection()->location(titleblock.template_name), m.data());
+	}
 }
 
 /**
@@ -843,7 +850,8 @@
 	
 	// check whether a TBT having the same name already exists within this project
 	QString target_name = dst_tbt.name();
-	while (titleblocks_.templates().contains(target_name)) {
+	while (titleblocks_.templates().contains(target_name))
+	{
 		QET::Action action = handler -> templateAlreadyExists(src_tbt, dst_tbt);
 		if (action == QET::Retry) {
 			continue;

Modified: trunk/sources/titleblockproperties.cpp
===================================================================
--- trunk/sources/titleblockproperties.cpp	2015-04-08 09:41:40 UTC (rev 3900)
+++ trunk/sources/titleblockproperties.cpp	2015-04-09 09:39:34 UTC (rev 3901)
@@ -108,10 +108,11 @@
 }
 
 /**
-	Exporte le cartouche dans une configuration.
-	@param settings Parametres a ecrire
-	@param prefix prefixe a ajouter devant les noms des parametres
-*/
+ * @brief TitleBlockProperties::toSettings
+ * Export the TitleBlockProperties into a QSettings
+ * @param settings : setting to use
+ * @param prefix : name to use as prefix for this property
+ */
 void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix) const {
 	settings.setValue(prefix + "title",    title);
 	settings.setValue(prefix + "author",   author);
@@ -119,6 +120,7 @@
 	settings.setValue(prefix + "folio",    folio);
 	settings.setValue(prefix + "date",     exportDate());
 	settings.setValue(prefix + "displayAt", (display_at == Qt::BottomEdge? "bottom" : "right"));
+	settings.setValue(prefix + "titleblocktemplate", template_name.isEmpty()? QString() : template_name);
 	context.toSettings(settings, prefix + "properties");
 }
 
@@ -134,6 +136,7 @@
 	folio    = settings.value(prefix + "folio", "%id/%total").toString();
 	setDateFromString(settings.value(prefix + "date").toString());
 	display_at = (settings.value(prefix + "displayAt", QVariant("bottom")).toString() == "bottom" ? Qt::BottomEdge : Qt::RightEdge);
+	template_name = settings.value(prefix + "titleblocktemplate").toString();
 	context.fromSettings(settings, prefix + "properties");
 }
 

Modified: trunk/sources/ui/titleblockpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/titleblockpropertieswidget.cpp	2015-04-08 09:41:40 UTC (rev 3900)
+++ trunk/sources/ui/titleblockpropertieswidget.cpp	2015-04-09 09:39:34 UTC (rev 3901)
@@ -143,7 +143,9 @@
 	}
 
 	if (!currentTitleBlockTemplateName().isEmpty())
+	{
 		prop.template_name = currentTitleBlockTemplateName();
+	}
 
 	prop.context = m_dcw -> context();
 


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