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

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3901 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun 2015-04-09 09:39:34 +00:00
parent 026b7f43c3
commit 3598d349e7
4 changed files with 24 additions and 11 deletions

View File

@ -42,9 +42,9 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent) :
//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

View File

@ -31,6 +31,7 @@
#include "ui/dialogwaiting.h"
#include "numerotationcontext.h"
#include "reportproperties.h"
#include "integrationmovetemplateshandler.h"
#include <QStandardPaths>
@ -445,12 +446,18 @@ TitleBlockProperties QETProject::defaultTitleBlockProperties() const {
}
/**
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 @@ QString QETProject::integrateTitleBlockTemplate(const TitleBlockTemplateLocation
// 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;

View File

@ -108,10 +108,11 @@ void TitleBlockProperties::fromXml(const QDomElement &e) {
}
/**
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 @@ void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix
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 @@ void TitleBlockProperties::fromSettings(QSettings &settings, const QString &pref
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");
}

View File

@ -143,7 +143,9 @@ TitleBlockProperties TitleBlockPropertiesWidget::properties() const {
}
if (!currentTitleBlockTemplateName().isEmpty())
{
prop.template_name = currentTitleBlockTemplateName();
}
prop.context = m_dcw -> context();