mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 08:10:52 +01:00
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:
@@ -44,7 +44,7 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent) :
|
|||||||
// dimensions by default for diagram
|
// dimensions by default for diagram
|
||||||
bpw = new BorderPropertiesWidget(BorderProperties::defaultProperties());
|
bpw = new BorderPropertiesWidget(BorderProperties::defaultProperties());
|
||||||
// default titleblock properties
|
// default titleblock properties
|
||||||
ipw = new TitleBlockPropertiesWidget(TitleBlockProperties::defaultProperties(), true);
|
ipw = new TitleBlockPropertiesWidget(QETApp::commonTitleBlockTemplatesCollection(), TitleBlockProperties::defaultProperties(), true);
|
||||||
// default conductor properties
|
// default conductor properties
|
||||||
cpw = new ConductorPropertiesWidget(ConductorProperties::defaultProperties());
|
cpw = new ConductorPropertiesWidget(ConductorProperties::defaultProperties());
|
||||||
// default propertie of report label
|
// default propertie of report label
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "ui/dialogwaiting.h"
|
#include "ui/dialogwaiting.h"
|
||||||
#include "numerotationcontext.h"
|
#include "numerotationcontext.h"
|
||||||
#include "reportproperties.h"
|
#include "reportproperties.h"
|
||||||
|
#include "integrationmovetemplateshandler.h"
|
||||||
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
@@ -445,12 +446,18 @@ TitleBlockProperties QETProject::defaultTitleBlockProperties() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Permet de specifier le cartouche par defaut utilise lors de la creation
|
* @brief QETProject::setDefaultTitleBlockProperties
|
||||||
d'un nouveau schema dans ce projet.
|
* Specify the title block to be used at the creation of a new diagram for this project
|
||||||
@param titleblock Cartouche d'un schema
|
* @param titleblock
|
||||||
*/
|
*/
|
||||||
void QETProject::setDefaultTitleBlockProperties(const TitleBlockProperties &titleblock) {
|
void QETProject::setDefaultTitleBlockProperties(const TitleBlockProperties &titleblock) {
|
||||||
default_titleblock_properties_ = 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
|
// check whether a TBT having the same name already exists within this project
|
||||||
QString target_name = dst_tbt.name();
|
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);
|
QET::Action action = handler -> templateAlreadyExists(src_tbt, dst_tbt);
|
||||||
if (action == QET::Retry) {
|
if (action == QET::Retry) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -108,9 +108,10 @@ void TitleBlockProperties::fromXml(const QDomElement &e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Exporte le cartouche dans une configuration.
|
* @brief TitleBlockProperties::toSettings
|
||||||
@param settings Parametres a ecrire
|
* Export the TitleBlockProperties into a QSettings
|
||||||
@param prefix prefixe a ajouter devant les noms des parametres
|
* @param settings : setting to use
|
||||||
|
* @param prefix : name to use as prefix for this property
|
||||||
*/
|
*/
|
||||||
void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix) const {
|
void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix) const {
|
||||||
settings.setValue(prefix + "title", title);
|
settings.setValue(prefix + "title", title);
|
||||||
@@ -119,6 +120,7 @@ void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix
|
|||||||
settings.setValue(prefix + "folio", folio);
|
settings.setValue(prefix + "folio", folio);
|
||||||
settings.setValue(prefix + "date", exportDate());
|
settings.setValue(prefix + "date", exportDate());
|
||||||
settings.setValue(prefix + "displayAt", (display_at == Qt::BottomEdge? "bottom" : "right"));
|
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");
|
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();
|
folio = settings.value(prefix + "folio", "%id/%total").toString();
|
||||||
setDateFromString(settings.value(prefix + "date").toString());
|
setDateFromString(settings.value(prefix + "date").toString());
|
||||||
display_at = (settings.value(prefix + "displayAt", QVariant("bottom")).toString() == "bottom" ? Qt::BottomEdge : Qt::RightEdge);
|
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");
|
context.fromSettings(settings, prefix + "properties");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,9 @@ TitleBlockProperties TitleBlockPropertiesWidget::properties() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!currentTitleBlockTemplateName().isEmpty())
|
if (!currentTitleBlockTemplateName().isEmpty())
|
||||||
|
{
|
||||||
prop.template_name = currentTitleBlockTemplateName();
|
prop.template_name = currentTitleBlockTemplateName();
|
||||||
|
}
|
||||||
|
|
||||||
prop.context = m_dcw -> context();
|
prop.context = m_dcw -> context();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user