TitleBlockProperties add new variable %version

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4620 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2016-08-10 12:25:47 +00:00
parent fd83a94f76
commit 314263fd8c
5 changed files with 17 additions and 2 deletions

View File

@@ -240,10 +240,11 @@ TitleBlockProperties BorderTitleBlock::exportTitleBlock() {
ip.date = date(); ip.date = date();
ip.title = title(); ip.title = title();
ip.filename = fileName(); ip.filename = fileName();
ip.version = version();
ip.folio = folio(); ip.folio = folio();
ip.template_name = titleBlockTemplateName(); ip.template_name = titleBlockTemplateName();
ip.display_at = m_edge; ip.display_at = m_edge;
ip.auto_page_num = autoPageNum(); ip.auto_page_num = autoPageNum();
ip.context = additional_fields_; ip.context = additional_fields_;
ip.collection = QET::QetCollection::Embedded; ip.collection = QET::QetCollection::Embedded;
@@ -259,6 +260,7 @@ void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip) {
setDate(ip.date); setDate(ip.date);
setTitle(ip.title); setTitle(ip.title);
setFileName(ip.filename); setFileName(ip.filename);
setVersion(QET::displayedVersion);
setFolio(ip.folio); setFolio(ip.folio);
setAutoPageNum(ip.auto_page_num); setAutoPageNum(ip.auto_page_num);
if (m_edge != ip.display_at) if (m_edge != ip.display_at)
@@ -693,6 +695,7 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock(const DiagramContext &i
context.addValue("date", btb_date_.toString(Qt::SystemLocaleShortDate)); context.addValue("date", btb_date_.toString(Qt::SystemLocaleShortDate));
context.addValue("title", btb_title_); context.addValue("title", btb_title_);
context.addValue("filename", btb_filename_); context.addValue("filename", btb_filename_);
context.addValue("version", btb_version_);
context.addValue("folio", btb_final_folio_); context.addValue("folio", btb_final_folio_);
context.addValue("folio-id", folio_index_); context.addValue("folio-id", folio_index_);
context.addValue("folio-total", folio_total_); context.addValue("folio-total", folio_total_);

View File

@@ -98,6 +98,8 @@ class BorderTitleBlock : public QObject
/// @return the value of the title block "File" field /// @return the value of the title block "File" field
QString fileName() const { return(btb_filename_); } QString fileName() const { return(btb_filename_); }
/// @return the value of the title block Additional Fields /// @return the value of the title block Additional Fields
QString version() const { return(btb_version_); }
/// @return the value of the title block Additional Fields
DiagramContext additionalFields() const { return (additional_fields_); } DiagramContext additionalFields() const { return (additional_fields_); }
/// @return the value of the title block /// @return the value of the title block
QString autoPageNum() const { return(btb_auto_page_num_); } QString autoPageNum() const { return(btb_auto_page_num_); }
@@ -145,7 +147,9 @@ class BorderTitleBlock : public QObject
void setFolioData(int, int, QString = NULL, const DiagramContext & = DiagramContext()); void setFolioData(int, int, QString = NULL, const DiagramContext & = DiagramContext());
/// @param author the new value of the "File" field /// @param author the new value of the "File" field
void setFileName(const QString &filename) { btb_filename_ = filename; } void setFileName(const QString &filename) { btb_filename_ = filename; }
/// @param author the new value of the "Auto Page Num" field /// @param author the new value of the "Version" field
void setVersion(const QString &version) { btb_version_ = version; }
/// @param author the new value of the "Auto Page Num" field
void setAutoPageNum(const QString &auto_page_num) { btb_auto_page_num_ = auto_page_num;} void setAutoPageNum(const QString &auto_page_num) { btb_auto_page_num_ = auto_page_num;}
void titleBlockToXml(QDomElement &); void titleBlockToXml(QDomElement &);
@@ -226,6 +230,7 @@ class BorderTitleBlock : public QObject
int folio_index_; int folio_index_;
int folio_total_; int folio_total_;
QString btb_filename_; QString btb_filename_;
QString btb_version_;
DiagramContext additional_fields_; DiagramContext additional_fields_;
Qt::Edge m_edge; Qt::Edge m_edge;

View File

@@ -437,6 +437,7 @@ QString TitleBlockTemplateCellWidget::defaultVariablesString() const {
"<li>%{date} : date du folio</li>" "<li>%{date} : date du folio</li>"
"<li>%{title} : titre du folio</li>" "<li>%{title} : titre du folio</li>"
"<li>%{filename} : nom de fichier du projet</li>" "<li>%{filename} : nom de fichier du projet</li>"
"<li>%{version} : version du projet</li>"
"<li>%{folio} : indications relatives au folio</li>" "<li>%{folio} : indications relatives au folio</li>"
"<li>%{folio-id} : position du folio dans le projet</li>" "<li>%{folio-id} : position du folio dans le projet</li>"
"<li>%{folio-total} : nombre total de folios dans le projet</li>" "<li>%{folio-total} : nombre total de folios dans le projet</li>"

View File

@@ -47,6 +47,7 @@ bool TitleBlockProperties::operator==(const TitleBlockProperties &ip) {
ip.author == author &&\ ip.author == author &&\
ip.date == date &&\ ip.date == date &&\
ip.filename == filename &&\ ip.filename == filename &&\
ip.version == version &&\
ip.folio == folio &&\ ip.folio == folio &&\
ip.auto_page_num == auto_page_num &&\ ip.auto_page_num == auto_page_num &&\
ip.template_name == template_name &&\ ip.template_name == template_name &&\
@@ -73,6 +74,7 @@ void TitleBlockProperties::toXml(QDomElement &e) const {
e.setAttribute("author", author); e.setAttribute("author", author);
e.setAttribute("title", title); e.setAttribute("title", title);
e.setAttribute("filename", filename); e.setAttribute("filename", filename);
e.setAttribute("version", version);
e.setAttribute("folio", folio); e.setAttribute("folio", folio);
e.setAttribute("auto_page_num", auto_page_num); e.setAttribute("auto_page_num", auto_page_num);
e.setAttribute("date", exportDate()); e.setAttribute("date", exportDate());
@@ -99,6 +101,7 @@ void TitleBlockProperties::fromXml(const QDomElement &e) {
if (e.hasAttribute("author")) author = e.attribute("author"); if (e.hasAttribute("author")) author = e.attribute("author");
if (e.hasAttribute("title")) title = e.attribute("title"); if (e.hasAttribute("title")) title = e.attribute("title");
if (e.hasAttribute("filename")) filename = e.attribute("filename"); if (e.hasAttribute("filename")) filename = e.attribute("filename");
if (e.hasAttribute("version")) version = e.attribute("version");
if (e.hasAttribute("folio")) folio = e.attribute("folio"); if (e.hasAttribute("folio")) folio = e.attribute("folio");
if (e.hasAttribute("auto_page_num")) auto_page_num = e.attribute("auto_page_num"); if (e.hasAttribute("auto_page_num")) auto_page_num = e.attribute("auto_page_num");
if (e.hasAttribute("date")) setDateFromString(e.attribute("date")); if (e.hasAttribute("date")) setDateFromString(e.attribute("date"));
@@ -128,6 +131,7 @@ void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix
settings.setValue(prefix + "title", title); settings.setValue(prefix + "title", title);
settings.setValue(prefix + "author", author); settings.setValue(prefix + "author", author);
settings.setValue(prefix + "filename", filename); settings.setValue(prefix + "filename", filename);
settings.setValue(prefix + "version", version);
settings.setValue(prefix + "folio", folio); settings.setValue(prefix + "folio", folio);
settings.setValue(prefix + "auto_page_num", auto_page_num); settings.setValue(prefix + "auto_page_num", auto_page_num);
settings.setValue(prefix + "date", exportDate()); settings.setValue(prefix + "date", exportDate());
@@ -146,6 +150,7 @@ void TitleBlockProperties::fromSettings(QSettings &settings, const QString &pref
title = settings.value(prefix + "title").toString(); title = settings.value(prefix + "title").toString();
author = settings.value(prefix + "author").toString(); author = settings.value(prefix + "author").toString();
filename = settings.value(prefix + "filename").toString(); filename = settings.value(prefix + "filename").toString();
version = settings.value(prefix + "version").toString();
folio = settings.value(prefix + "folio", "%id/%total").toString(); folio = settings.value(prefix + "folio", "%id/%total").toString();
auto_page_num = settings.value(prefix + "auto_page_num").toString(); auto_page_num = settings.value(prefix + "auto_page_num").toString();
setDateFromString(settings.value(prefix + "date").toString()); setDateFromString(settings.value(prefix + "date").toString());

View File

@@ -54,6 +54,7 @@ class TitleBlockProperties {
QString author; ///< Author of the diagram/folio (displayed by the default template) QString author; ///< Author of the diagram/folio (displayed by the default template)
QDate date; ///< Date (displayed by the default template) QDate date; ///< Date (displayed by the default template)
QString filename; ///< Filename (displayed by the default template) QString filename; ///< Filename (displayed by the default template)
QString version; ///< Version (displayed by the default template)
QString folio; ///< Folio information (displayed by the default template) QString folio; ///< Folio information (displayed by the default template)
QString auto_page_num; QString auto_page_num;
QString location; QString location;