[qet] [3912] Allow user to select common or custom title block as default title block for a new project / diagram in project

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


Revision: 3912
Author:   blacksun
Date:     2015-04-17 13:36:28 +0200 (Fri, 17 Apr 2015)
Log Message:
-----------
Allow user to select common or custom title block as default title block for a new project / diagram in project

Modified Paths:
--------------
    trunk/sources/bordertitleblock.cpp
    trunk/sources/qet.cpp
    trunk/sources/qet.h
    trunk/sources/qetapp.cpp
    trunk/sources/qetproject.cpp
    trunk/sources/titleblock/templatescollection.cpp
    trunk/sources/titleblock/templatescollection.h
    trunk/sources/titleblockproperties.cpp
    trunk/sources/titleblockproperties.h
    trunk/sources/ui/titleblockpropertieswidget.cpp
    trunk/sources/ui/titleblockpropertieswidget.h

Modified: trunk/sources/bordertitleblock.cpp
===================================================================
--- trunk/sources/bordertitleblock.cpp	2015-04-16 16:20:38 UTC (rev 3911)
+++ trunk/sources/bordertitleblock.cpp	2015-04-17 11:36:28 UTC (rev 3912)
@@ -244,6 +244,7 @@
 	ip.template_name = titleBlockTemplateName();
 	ip.display_at = m_edge;
 	ip.context = additional_fields_;
+	ip.collection = QET::QetCollection::Embendded;
 	
 	return(ip);
 }

Modified: trunk/sources/qet.cpp
===================================================================
--- trunk/sources/qet.cpp	2015-04-16 16:20:38 UTC (rev 3911)
+++ trunk/sources/qet.cpp	2015-04-17 11:36:28 UTC (rev 3912)
@@ -729,3 +729,41 @@
 	}
 	return true;
 }
+
+/**
+ * @brief QET::qetCollectionToString
+ * @param c QetCollection value to convert
+ * @return The QetCollection enum value converted to a QString
+ */
+QString QET::qetCollectionToString(const QET::QetCollection &c)
+{
+	switch (c)
+	{
+		case Common :
+			return "common";
+		case Custom :
+			return "custom";
+		case Embendded :
+			return "embendded";
+		default:
+			return "common";
+	}
+}
+
+/**
+ * @brief QET::qetCollectionFromString
+ * @param str string to convert
+ * @return The corresponding QetCollection value from a string.
+ * If the string don't match anything, we return the failsafe value QetCollection::Common
+ */
+QET::QetCollection QET::qetCollectionFromString(const QString &str)
+{
+	if (str == "common")
+		return QetCollection::Common;
+	else if (str == "custom")
+		return QetCollection::Custom;
+	else if (str == "embendded")
+		return QetCollection::Embendded;
+	else
+		return QetCollection::Common;
+}

Modified: trunk/sources/qet.h
===================================================================
--- trunk/sources/qet.h	2015-04-16 16:20:38 UTC (rev 3911)
+++ trunk/sources/qet.h	2015-04-17 11:36:28 UTC (rev 3912)
@@ -128,6 +128,16 @@
 		RelativeToTotalLength,      ///< the length is just a fraction of the total available length
 		RelativeToRemainingLength   ///< the length is just a fraction of the length that is still available when other types of lengths have been removed
 	};
+
+		///Enum used to specify the origin of a collection of thing (title block, element etc...)
+	enum QetCollection {
+		Common,		///< From common collection
+		Custom,		///< From user collection
+		Embendded	///< From an embeddded collection (a project for exemple)
+	};
+
+	QString qetCollectionToString (const QetCollection &c);
+	QetCollection qetCollectionFromString (const QString &str);
 	
 	bool lineContainsPoint(const QLineF &, const QPointF &);
 	bool orthogonalProjection(const QPointF &, const QLineF &, QPointF * = 0);

Modified: trunk/sources/qetapp.cpp
===================================================================
--- trunk/sources/qetapp.cpp	2015-04-16 16:20:38 UTC (rev 3911)
+++ trunk/sources/qetapp.cpp	2015-04-17 11:36:28 UTC (rev 3912)
@@ -381,6 +381,7 @@
 		common_tbt_collection_ = new TitleBlockTemplatesFilesCollection(QETApp::commonTitleBlockTemplatesDir());
 		common_tbt_collection_ -> setTitle(tr("Cartouches QET", "title of the title block templates collection provided by QElectroTech"));
 		common_tbt_collection_ -> setProtocol(QETAPP_COMMON_TBT_PROTOCOL);
+		common_tbt_collection_ -> setCollection(QET::QetCollection::Common);
 	}
 	return(common_tbt_collection_);
 }
@@ -394,6 +395,7 @@
 		custom_tbt_collection_ = new TitleBlockTemplatesFilesCollection(QETApp::customTitleBlockTemplatesDir());
 		custom_tbt_collection_ -> setTitle(tr("Cartouches utilisateur", "title of the user's title block templates collection"));
 		custom_tbt_collection_ -> setProtocol(QETAPP_CUSTOM_TBT_PROTOCOL);
+		custom_tbt_collection_ -> setCollection(QET::QetCollection::Custom);
 	}
 	return(custom_tbt_collection_);
 }

Modified: trunk/sources/qetproject.cpp
===================================================================
--- trunk/sources/qetproject.cpp	2015-04-16 16:20:38 UTC (rev 3911)
+++ trunk/sources/qetproject.cpp	2015-04-17 11:36:28 UTC (rev 3912)
@@ -455,8 +455,11 @@
 		//Integrate the title block in this project
 	if (!titleblock.template_name.isEmpty())
 	{
+		TitleBlockTemplatesFilesCollection *collection = nullptr;
+		collection = titleblock.collection == QET::QetCollection::Common ? QETApp::commonTitleBlockTemplatesCollection() :
+																		   QETApp::customTitleBlockTemplatesCollection();
 		QScopedPointer<IntegrationMoveTitleBlockTemplatesHandler> m(new IntegrationMoveTitleBlockTemplatesHandler);
-		integrateTitleBlockTemplate(QETApp::commonTitleBlockTemplatesCollection()->location(titleblock.template_name), m.data());
+		integrateTitleBlockTemplate(collection -> location(titleblock.template_name), m.data());
 	}
 }
 

Modified: trunk/sources/titleblock/templatescollection.cpp
===================================================================
--- trunk/sources/titleblock/templatescollection.cpp	2015-04-16 16:20:38 UTC (rev 3911)
+++ trunk/sources/titleblock/templatescollection.cpp	2015-04-17 11:36:28 UTC (rev 3912)
@@ -67,6 +67,23 @@
 }
 
 /**
+ * @brief TitleBlockTemplatesCollection::collection
+ * @return the collection where is stored this collection.
+ */
+QET::QetCollection TitleBlockTemplatesCollection::collection() const {
+	return m_collection;
+}
+
+/**
+ * @brief TitleBlockTemplatesCollection::setCollection
+ * Set the storage of this collection
+ * @param c
+ */
+void TitleBlockTemplatesCollection::setCollection(QET::QetCollection c) {
+	m_collection = c;
+}
+
+/**
 	@return the project this collection is affiliated to, or 0 if this
 	collection is not related to any project.
 */
@@ -96,6 +113,7 @@
 	TitleBlockTemplatesCollection(parent),
 	project_(project)
 {
+	m_collection = QET::QetCollection::Embendded;
 }
 
 /**

Modified: trunk/sources/titleblock/templatescollection.h
===================================================================
--- trunk/sources/titleblock/templatescollection.h	2015-04-16 16:20:38 UTC (rev 3911)
+++ trunk/sources/titleblock/templatescollection.h	2015-04-17 11:36:28 UTC (rev 3912)
@@ -21,6 +21,7 @@
 #include <QtCore>
 #include <QtXml>
 #include "templatelocation.h"
+#include "qet.h"
 class TitleBlockTemplate;
 class QETProject;
 
@@ -55,6 +56,8 @@
 	virtual void setTitle(const QString &);
 	virtual QString protocol() const;
 	virtual void setProtocol(const QString &);
+	virtual QET::QetCollection collection () const;
+	virtual void setCollection (QET::QetCollection);
 	virtual QETProject *parentProject();
 	virtual QList<TitleBlockTemplateLocation> templatesLocations();
 	
@@ -68,6 +71,7 @@
 	QString title_;
 	/// Protocol used to designate this collection
 	QString protocol_;
+	QET::QetCollection m_collection;
 	/// Already parsed embedded titleblock templates
 	QHash<QString, TitleBlockTemplate *> titleblock_templates_;
 };

Modified: trunk/sources/titleblockproperties.cpp
===================================================================
--- trunk/sources/titleblockproperties.cpp	2015-04-16 16:20:38 UTC (rev 3911)
+++ trunk/sources/titleblockproperties.cpp	2015-04-17 11:36:28 UTC (rev 3912)
@@ -26,7 +26,8 @@
 TitleBlockProperties::TitleBlockProperties() :
 	date(),
 	useDate(UseDateValue),
-	display_at(Qt::BottomEdge)
+	display_at(Qt::BottomEdge),
+	collection (QET::QetCollection::Common)
 {
 }
 
@@ -49,7 +50,8 @@
 		ip.folio == folio &&\
 		ip.template_name == template_name &&\
 		ip.context == context &&\
-		ip.display_at == display_at
+		ip.display_at == display_at &&\
+		ip.collection == collection
 	);
 }
 
@@ -73,8 +75,10 @@
 	e.setAttribute("folio",    folio);
 	e.setAttribute("date",     exportDate());
 	e.setAttribute("displayAt", (display_at == Qt::BottomEdge? "bottom" : "right"));
-	if (!template_name.isEmpty()) {
+	if (!template_name.isEmpty())
+	{
 		e.setAttribute("titleblocktemplate", template_name);
+		e.setAttribute("titleblocktemplateCollection", QET::qetCollectionToString(collection));
 	}
 	
 	if (context.keys().count()) {
@@ -97,8 +101,12 @@
 	if (e.hasAttribute("date"))        setDateFromString(e.attribute("date"));
 	if (e.hasAttribute("displayAt")) display_at = (e.attribute("displayAt") == "bottom" ? Qt::BottomEdge : Qt::RightEdge);
 	
-	// reads the template used to render the title block
-	if (e.hasAttribute("titleblocktemplate")) template_name = e.attribute("titleblocktemplate");
+		// reads the template used to render the title block
+	if (e.hasAttribute("titleblocktemplate"))
+	{
+		template_name = e.attribute("titleblocktemplate");
+		collection = QET::qetCollectionFromString(e.attribute("titleblocktemplateCollection"));
+	}
 	
 	// reads the additional fields used to fill the title block
 	context.clear();
@@ -121,6 +129,7 @@
 	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);
+	settings.setValue(prefix + "titleblocktemplateCollection", QET::qetCollectionToString(collection));
 	context.toSettings(settings, prefix + "properties");
 }
 
@@ -137,6 +146,7 @@
 	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();
+	collection = QET::qetCollectionFromString(settings.value(prefix + "titleblocktemplateCollection").toString());
 	context.fromSettings(settings, prefix + "properties");
 }
 

Modified: trunk/sources/titleblockproperties.h
===================================================================
--- trunk/sources/titleblockproperties.h	2015-04-16 16:20:38 UTC (rev 3911)
+++ trunk/sources/titleblockproperties.h	2015-04-17 11:36:28 UTC (rev 3912)
@@ -19,6 +19,7 @@
 #define TITLEBLOCK_PROPERTIES_H
 #include <QtXml>
 #include "diagramcontext.h"
+#include "qet.h"
 /**
 	This class provides a container for the properties of a particular title
 	block, i.e. title, author, date, filename, folio, template, custom
@@ -56,6 +57,7 @@
 	QString template_name;    ///< Name of the template used to render the title block - an empty string means "the default template provided by the application"
 	DiagramContext context;   ///< Container for the additional, user-defined fields
 	Qt::Edge display_at;       ///< Edge to display the titleblock
+	QET::QetCollection collection; ///<Specify the location of the title block
 	
 	private:
 	QString exportDate() const;

Modified: trunk/sources/ui/titleblockpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/titleblockpropertieswidget.cpp	2015-04-16 16:20:38 UTC (rev 3911)
+++ trunk/sources/ui/titleblockpropertieswidget.cpp	2015-04-17 11:36:28 UTC (rev 3912)
@@ -31,8 +31,7 @@
  */
 TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) :
 	QWidget(parent),
-	ui(new Ui::TitleBlockPropertiesWidget),
-	m_tbt_collection(nullptr)
+	ui(new Ui::TitleBlockPropertiesWidget)
 {
 	ui->setupUi(this);
 	initDialog(current_date);
@@ -49,16 +48,36 @@
  */
 TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) :
 	QWidget(parent),
-	ui(new Ui::TitleBlockPropertiesWidget),
-	m_tbt_collection(nullptr)
+	ui(new Ui::TitleBlockPropertiesWidget)
 {
 	ui->setupUi(this);
 	initDialog(current_date);
-	setTitleBlockTemplatesCollection(tbt_collection);
+	addCollection(tbt_collection);
+	updateTemplateList();
 	setProperties(titleblock);
 }
 
 /**
+ * @brief TitleBlockPropertiesWidget::TitleBlockPropertiesWidget
+ * Default constructor with several template collection
+ * @param tbt_collection template list
+ * @param titleblock properties to edit
+ * @param current_date if true, display the radio button "current date"
+ * @param parent parent widget
+ */
+TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(QList<TitleBlockTemplatesCollection *> tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) :
+	QWidget(parent),
+	ui(new Ui::TitleBlockPropertiesWidget)
+{
+	ui->setupUi(this);
+	initDialog(current_date);
+	foreach (TitleBlockTemplatesCollection *c, tbt_collection)
+		addCollection(c);
+	updateTemplateList();
+	setProperties(titleblock);
+}
+
+/**
  * @brief TitleBlockPropertiesWidget::~TitleBlockPropertiesWidget
  * destructor
  */
@@ -108,11 +127,14 @@
 		}
 	} //About date
 
-	if (!properties.template_name.isEmpty()) {
-		int matching_index = ui -> m_tbt_cb -> findData (properties.template_name);
-		if (matching_index != -1)
-			ui -> m_tbt_cb -> setCurrentIndex(matching_index);
+		//Set the current titleblock if any
+	int index = 0;
+	if (!properties.template_name.isEmpty())
+	{
+		index = getIndexFor(properties.template_name, properties.collection);
+		if (index == -1) index = 0;
 	}
+	ui -> m_tbt_cb -> setCurrentIndex(index);
 
 	m_dcw -> setContext(properties.context);
 }
@@ -145,6 +167,7 @@
 	if (!currentTitleBlockTemplateName().isEmpty())
 	{
 		prop.template_name = currentTitleBlockTemplateName();
+		prop.collection = m_map_index_to_collection_type.at(ui->m_tbt_cb->currentIndex());
 	}
 
 	prop.context = m_dcw -> context();
@@ -182,49 +205,17 @@
 }
 
 /**
- * @brief TitleBlockPropertiesWidget::setCurrentTitleBlockTemplateName
- * set the current title block "name", if "name" doesn't match, this method do nothing
- * @param name
- */
-void TitleBlockPropertiesWidget::setCurrentTitleBlockTemplateName (const QString &name) {
-	int index = ui -> m_tbt_cb -> findData(name);
-	if (index != -1)
-		ui -> m_tbt_cb -> setCurrentIndex(index);
-}
-
-/**
- * @brief TitleBlockPropertiesWidget::setTitleBlockTemplatesCollection
- * Set the collection of title block
+ * @brief TitleBlockPropertiesWidget::addCollection
+ * add a collection of title block available in the combo box
  * @param tbt_collection
  */
-void TitleBlockPropertiesWidget::setTitleBlockTemplatesCollection(TitleBlockTemplatesCollection *tbt_collection) {
-	if (!tbt_collection) return;
-	setTitleBlockTemplatesVisible(true);
-	if (m_tbt_collection && tbt_collection != m_tbt_collection) {
-		// forget any connection with the previous collection
-		disconnect(m_tbt_collection, 0, this, 0);
-	}
-
-	m_tbt_collection = tbt_collection;
-	updateTemplateList();
-	connect(m_tbt_collection, SIGNAL(changed(TitleBlockTemplatesCollection*,QString)), this, SLOT(updateTemplateList()));
+void TitleBlockPropertiesWidget::addCollection(TitleBlockTemplatesCollection *tbt_collection)
+{
+	if (!tbt_collection || m_tbt_collection_list.contains(tbt_collection)) return;
+	m_tbt_collection_list << tbt_collection;
 }
 
 /**
- * @brief TitleBlockPropertiesWidget::setTitleBlockTemplatesList
- * Set the list of title block used.
- * Fill the combo box of title box with each name of title block.
- * @param tbt
- */
-void TitleBlockPropertiesWidget::setTitleBlockTemplatesList(const QStringList &tbt) {
-	ui -> m_tbt_cb ->clear();
-	ui -> m_tbt_cb -> addItem(QET::Icons::TitleBlock, tr("Modèle par défaut"));
-	foreach (QString tbt_name, tbt) {
-		ui -> m_tbt_cb -> addItem(QET::Icons::TitleBlock, tbt_name, tbt_name);
-	}
-}
-
-/**
  * @brief TitleBlockPropertiesWidget::initDialog
  * Init this dialog
  * @param current_date true for display current date radio button
@@ -247,9 +238,26 @@
 	m_tbt_menu -> addAction(m_tbt_duplicate);
 	ui -> m_tbt_pb -> setMenu(m_tbt_menu);
 
-	connect(ui->m_tbt_cb, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeCurrentTitleBlockTemplate(QString)));
+	connect(ui->m_tbt_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentTitleBlockTemplate(int)));
 }
 
+/**
+ * @brief TitleBlockPropertiesWidget::getIndexFor
+ * Find the index of the combo box for the title block @tbt_name available on the collection @collection
+ * @param tbt_name : title block name
+ * @param collection : title block collection
+ * @return the index of the title block or -1 if no match
+ */
+int TitleBlockPropertiesWidget::getIndexFor(const QString &tbt_name, const QET::QetCollection collection) const
+{
+	for (int i = 0; i<ui->m_tbt_cb->count(); i++) {
+		if (ui->m_tbt_cb->itemData(i).toString() == tbt_name)
+			if (m_map_index_to_collection_type.at(i) == collection)
+				return i;
+	}
+	return -1;
+}
+
 void TitleBlockPropertiesWidget::editCurrentTitleBlockTemplate() {
 	emit(editTitleBlockTemplate(currentTitleBlockTemplateName(), false));
 }
@@ -260,33 +268,70 @@
 
 /**
  * @brief TitleBlockPropertiesWidget::updateTemplateList
- * Update the title block template list
+ * Update the title block template list available in the combo box
  */
-void TitleBlockPropertiesWidget::updateTemplateList() {
-	if (!m_tbt_collection) return;
+void TitleBlockPropertiesWidget::updateTemplateList()
+{
+	ui -> m_tbt_cb ->clear();
 
-	QString current_template_name = currentTitleBlockTemplateName();
-	setTitleBlockTemplatesList(m_tbt_collection -> templates());
-	setCurrentTitleBlockTemplateName(current_template_name);
+	if (m_tbt_collection_list.isEmpty())
+	{
+		setTitleBlockTemplatesVisible(false);
+		return;
+	}
+	setTitleBlockTemplatesVisible(true);
+
+		//Add the default title block
+	m_map_index_to_collection_type.clear();
+	m_map_index_to_collection_type.append(QET::QetCollection::Common);
+	ui -> m_tbt_cb -> addItem(QET::Icons::QETLogo, tr("Modèle par défaut"));
+
+		//Add every title block stored in m_tbt_collection_list
+	foreach (TitleBlockTemplatesCollection *tbt_c, m_tbt_collection_list)
+	{
+		QIcon icon;
+		QET::QetCollection qc = tbt_c -> collection();
+		if (qc == QET::QetCollection::Common)
+			icon = QET::Icons::QETLogo;
+		else if (qc == QET::QetCollection::Custom)
+			icon = QET::Icons::Home;
+		else if (qc == QET::QetCollection::Embendded)
+			icon = QET::Icons::TitleBlock;
+
+		foreach(QString tbt_name, tbt_c -> templates())
+		{
+			m_map_index_to_collection_type.append(qc);
+			ui -> m_tbt_cb -> addItem(icon, tbt_name, tbt_name);
+		}
+	}
 }
 
 /**
  * @brief TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate
  * Load the additionnal field of title block "text"
  */
-void TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate(QString name) {
-	// delete all entry
+void TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate(int index)
+{
 	m_dcw -> clear();
-	// get template
-	TitleBlockTemplate *tpl = m_tbt_collection -> getTemplate( name );
+
+	QET::QetCollection qc = m_map_index_to_collection_type.at(index);
+	TitleBlockTemplatesCollection *collection = nullptr;
+	foreach (TitleBlockTemplatesCollection *c, m_tbt_collection_list)
+		if (c -> collection() == qc)
+			collection = c;
+
+	if (!collection) return;
+
+		// get template
+	TitleBlockTemplate *tpl = collection -> getTemplate(ui -> m_tbt_cb -> currentText());
 	if(tpl != 0) {
-		// get all template fields
+			// get all template fields
 		QStringList fields = tpl -> listOfVariables();
-		// set fields to additional_fields_ widget
+			// set fields to additional_fields_ widget
 		DiagramContext templateContext;
 		for(int i =0; i<fields.count(); i++)
 			templateContext.addValue(fields.at(i), "");
-		m_dcw->setContext(templateContext);
+		m_dcw -> setContext(templateContext);
 	}
 }
 

Modified: trunk/sources/ui/titleblockpropertieswidget.h
===================================================================
--- trunk/sources/ui/titleblockpropertieswidget.h	2015-04-16 16:20:38 UTC (rev 3911)
+++ trunk/sources/ui/titleblockpropertieswidget.h	2015-04-17 11:36:28 UTC (rev 3912)
@@ -21,6 +21,7 @@
 #include <QWidget>
 #include "titleblockproperties.h"
 #include "diagramcontextwidget.h"
+#include "qet.h"
 
 class QMenu;
 class TitleBlockTemplatesCollection;
@@ -36,6 +37,7 @@
 	public:
 		explicit TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0);
 		explicit TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0);
+		explicit TitleBlockPropertiesWidget(QList <TitleBlockTemplatesCollection *> tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0);
 		~TitleBlockPropertiesWidget();
 
 		void setProperties(const TitleBlockProperties &properties);
@@ -43,19 +45,18 @@
 
 		void setTitleBlockTemplatesVisible(const bool &visible);
 		void setReadOnly (const bool &ro);
-		void setTitleBlockTemplatesCollection(TitleBlockTemplatesCollection *tbt_collection);
 
 	private:
+		void addCollection (TitleBlockTemplatesCollection *tbt_collection);
 		QString currentTitleBlockTemplateName () const;
-		void setCurrentTitleBlockTemplateName (const QString &name);
-		void setTitleBlockTemplatesList(const QStringList &tbt);
 		void initDialog(const bool &current_date);
+		int getIndexFor (const QString &tbt_name, const QET::QetCollection collection) const;
 
 	private slots:
 		void editCurrentTitleBlockTemplate();
 		void duplicateCurrentTitleBlockTemplate();
 		void updateTemplateList();
-		void changeCurrentTitleBlockTemplate(QString name);
+		void changeCurrentTitleBlockTemplate(int);
 		void on_m_date_now_pb_clicked();
 
 	signals:
@@ -64,9 +65,10 @@
 	private:
 		Ui::TitleBlockPropertiesWidget *ui;
 		DiagramContextWidget *m_dcw;
-		TitleBlockTemplatesCollection *m_tbt_collection;
 		QAction *m_tbt_edit, *m_tbt_duplicate;
 		QMenu *m_tbt_menu;
+		QList <TitleBlockTemplatesCollection *> m_tbt_collection_list;
+		QList <QET::QetCollection> m_map_index_to_collection_type;
 };
 
 #endif // TITLEBLOCKPROPERTIESWIDGET_H


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