From 314263fd8cfa8b3cfc7b4840819194e31f710870 Mon Sep 17 00:00:00 2001 From: scorpio810 Date: Wed, 10 Aug 2016 12:25:47 +0000 Subject: [PATCH] TitleBlockProperties add new variable %version git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4620 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/bordertitleblock.cpp | 5 ++++- sources/bordertitleblock.h | 7 ++++++- sources/titleblock/templatecellwidget.cpp | 1 + sources/titleblockproperties.cpp | 5 +++++ sources/titleblockproperties.h | 1 + 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index b4eebc68f..b0ac9c890 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -240,10 +240,11 @@ TitleBlockProperties BorderTitleBlock::exportTitleBlock() { ip.date = date(); ip.title = title(); ip.filename = fileName(); + ip.version = version(); ip.folio = folio(); ip.template_name = titleBlockTemplateName(); ip.display_at = m_edge; - ip.auto_page_num = autoPageNum(); + ip.auto_page_num = autoPageNum(); ip.context = additional_fields_; ip.collection = QET::QetCollection::Embedded; @@ -259,6 +260,7 @@ void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip) { setDate(ip.date); setTitle(ip.title); setFileName(ip.filename); + setVersion(QET::displayedVersion); setFolio(ip.folio); setAutoPageNum(ip.auto_page_num); 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("title", btb_title_); context.addValue("filename", btb_filename_); + context.addValue("version", btb_version_); context.addValue("folio", btb_final_folio_); context.addValue("folio-id", folio_index_); context.addValue("folio-total", folio_total_); diff --git a/sources/bordertitleblock.h b/sources/bordertitleblock.h index 128f45c7c..afbb0f42e 100644 --- a/sources/bordertitleblock.h +++ b/sources/bordertitleblock.h @@ -98,6 +98,8 @@ class BorderTitleBlock : public QObject /// @return the value of the title block "File" field QString fileName() const { return(btb_filename_); } /// @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_); } /// @return the value of the title block 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()); /// @param author the new value of the "File" field 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 titleBlockToXml(QDomElement &); @@ -226,6 +230,7 @@ class BorderTitleBlock : public QObject int folio_index_; int folio_total_; QString btb_filename_; + QString btb_version_; DiagramContext additional_fields_; Qt::Edge m_edge; diff --git a/sources/titleblock/templatecellwidget.cpp b/sources/titleblock/templatecellwidget.cpp index c1ef98dee..db3e8a3ef 100644 --- a/sources/titleblock/templatecellwidget.cpp +++ b/sources/titleblock/templatecellwidget.cpp @@ -437,6 +437,7 @@ QString TitleBlockTemplateCellWidget::defaultVariablesString() const { "
  • %{date} : date du folio
  • " "
  • %{title} : titre du folio
  • " "
  • %{filename} : nom de fichier du projet
  • " + "
  • %{version} : version du projet
  • " "
  • %{folio} : indications relatives au folio
  • " "
  • %{folio-id} : position du folio dans le projet
  • " "
  • %{folio-total} : nombre total de folios dans le projet
  • " diff --git a/sources/titleblockproperties.cpp b/sources/titleblockproperties.cpp index 239de7a03..17be63bf2 100644 --- a/sources/titleblockproperties.cpp +++ b/sources/titleblockproperties.cpp @@ -47,6 +47,7 @@ bool TitleBlockProperties::operator==(const TitleBlockProperties &ip) { ip.author == author &&\ ip.date == date &&\ ip.filename == filename &&\ + ip.version == version &&\ ip.folio == folio &&\ ip.auto_page_num == auto_page_num &&\ ip.template_name == template_name &&\ @@ -73,6 +74,7 @@ void TitleBlockProperties::toXml(QDomElement &e) const { e.setAttribute("author", author); e.setAttribute("title", title); e.setAttribute("filename", filename); + e.setAttribute("version", version); e.setAttribute("folio", folio); e.setAttribute("auto_page_num", auto_page_num); 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("title")) title = e.attribute("title"); 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("auto_page_num")) auto_page_num = e.attribute("auto_page_num"); 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 + "author", author); settings.setValue(prefix + "filename", filename); + settings.setValue(prefix + "version", version); settings.setValue(prefix + "folio", folio); settings.setValue(prefix + "auto_page_num", auto_page_num); settings.setValue(prefix + "date", exportDate()); @@ -146,6 +150,7 @@ void TitleBlockProperties::fromSettings(QSettings &settings, const QString &pref title = settings.value(prefix + "title").toString(); author = settings.value(prefix + "author").toString(); filename = settings.value(prefix + "filename").toString(); + version = settings.value(prefix + "version").toString(); folio = settings.value(prefix + "folio", "%id/%total").toString(); auto_page_num = settings.value(prefix + "auto_page_num").toString(); setDateFromString(settings.value(prefix + "date").toString()); diff --git a/sources/titleblockproperties.h b/sources/titleblockproperties.h index 7c8038873..57b13103e 100644 --- a/sources/titleblockproperties.h +++ b/sources/titleblockproperties.h @@ -54,6 +54,7 @@ class TitleBlockProperties { QString author; ///< Author of the diagram/folio (displayed by the default template) QDate date; ///< Date (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 auto_page_num; QString location;