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. 


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3919 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2015-04-25 08:43:00 +00:00
parent 68a9c850ad
commit a58ed2d91c
2 changed files with 16 additions and 2 deletions

View File

@@ -46,6 +46,7 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent) :
// default titleblock properties // default titleblock properties
QList <TitleBlockTemplatesCollection *> c; QList <TitleBlockTemplatesCollection *> c;
c << QETApp::commonTitleBlockTemplatesCollection() << QETApp::customTitleBlockTemplatesCollection(); c << QETApp::commonTitleBlockTemplatesCollection() << QETApp::customTitleBlockTemplatesCollection();
if (m_project) c << m_project->embeddedTitleBlockTemplatesCollection();
ipw = new TitleBlockPropertiesWidget(c, TitleBlockProperties::defaultProperties(), true); ipw = new TitleBlockPropertiesWidget(c, TitleBlockProperties::defaultProperties(), true);
// default conductor properties // default conductor properties
cpw = new ConductorPropertiesWidget(ConductorProperties::defaultProperties()); cpw = new ConductorPropertiesWidget(ConductorProperties::defaultProperties());

View File

@@ -456,8 +456,21 @@ void QETProject::setDefaultTitleBlockProperties(const TitleBlockProperties &titl
if (!titleblock.template_name.isEmpty()) if (!titleblock.template_name.isEmpty())
{ {
TitleBlockTemplatesFilesCollection *collection = nullptr; TitleBlockTemplatesFilesCollection *collection = nullptr;
collection = titleblock.collection == QET::QetCollection::Common ? QETApp::commonTitleBlockTemplatesCollection() : switch (titleblock.collection)
QETApp::customTitleBlockTemplatesCollection(); {
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); QScopedPointer<IntegrationMoveTitleBlockTemplatesHandler> m(new IntegrationMoveTitleBlockTemplatesHandler);
integrateTitleBlockTemplate(collection -> location(titleblock.template_name), m.data()); integrateTitleBlockTemplate(collection -> location(titleblock.template_name), m.data());
} }