[qet] [4478] Restore commit 4476 |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4478
Author: scorpio810
Date: 2016-05-13 17:00:22 +0200 (Fri, 13 May 2016)
Log Message:
-----------
Restore commit 4476
Modified Paths:
--------------
trunk/sources/bordertitleblock.cpp
trunk/sources/bordertitleblock.h
trunk/sources/configdialog.h
trunk/sources/configpages.cpp
trunk/sources/configpages.h
trunk/sources/diagram.cpp
trunk/sources/diagramview.cpp
trunk/sources/elementspanelwidget.cpp
trunk/sources/elementspanelwidget.h
trunk/sources/projectconfigpages.cpp
trunk/sources/projectconfigpages.h
trunk/sources/projectview.cpp
trunk/sources/projectview.h
trunk/sources/qetdiagrameditor.cpp
trunk/sources/qetdiagrameditor.h
trunk/sources/qetproject.cpp
trunk/sources/qetproject.h
trunk/sources/titleblockproperties.cpp
trunk/sources/titleblockproperties.h
trunk/sources/ui/diagrampropertiesdialog.cpp
trunk/sources/ui/diagrampropertiesdialog.h
trunk/sources/ui/projectpropertiesdialog.cpp
trunk/sources/ui/projectpropertiesdialog.h
trunk/sources/ui/selectautonumw.ui
trunk/sources/ui/titleblockpropertieswidget.cpp
trunk/sources/ui/titleblockpropertieswidget.h
trunk/sources/ui/titleblockpropertieswidget.ui
Added Paths:
-----------
trunk/sources/ui/folioautonumbering.cpp
trunk/sources/ui/folioautonumbering.h
trunk/sources/ui/folioautonumbering.ui
Removed Paths:
-------------
trunk/qelectrotech.pro.user
Deleted: trunk/qelectrotech.pro.user
===================================================================
--- trunk/qelectrotech.pro.user 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/qelectrotech.pro.user 2016-05-13 15:00:22 UTC (rev 4478)
@@ -1,271 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 3.5.1, 2016-01-18T18:52:49. -->
-<qtcreator>
- <data>
- <variable>EnvironmentId</variable>
- <value type="QByteArray">{6eea4121-5ff9-4cef-b169-5ef0ff03834b}</value>
- </data>
- <data>
- <variable>ProjectExplorer.Project.ActiveTarget</variable>
- <value type="int">0</value>
- </data>
- <data>
- <variable>ProjectExplorer.Project.EditorSettings</variable>
- <valuemap type="QVariantMap">
- <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
- <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
- <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
- <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
- <value type="QString" key="language">Cpp</value>
- <valuemap type="QVariantMap" key="value">
- <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
- </valuemap>
- </valuemap>
- <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
- <value type="QString" key="language">QmlJS</value>
- <valuemap type="QVariantMap" key="value">
- <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
- </valuemap>
- </valuemap>
- <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
- <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
- <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
- <value type="int" key="EditorConfiguration.IndentSize">4</value>
- <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
- <value type="int" key="EditorConfiguration.MarginColumn">80</value>
- <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
- <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
- <value type="int" key="EditorConfiguration.PaddingMode">1</value>
- <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
- <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
- <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
- <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
- <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
- <value type="int" key="EditorConfiguration.TabSize">8</value>
- <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
- <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
- <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
- <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
- <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
- <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
- </valuemap>
- </data>
- <data>
- <variable>ProjectExplorer.Project.PluginSettings</variable>
- <valuemap type="QVariantMap"/>
- </data>
- <data>
- <variable>ProjectExplorer.Project.Target.0</variable>
- <valuemap type="QVariantMap">
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.5.1 GCC 64bit</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.5.1 GCC 64bit</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.55.gcc_64_kit</value>
- <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
- <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
- <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
- <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/davi/Documents/qelectro/build-qelectrotech-Desktop_Qt_5_5_1_GCC_64bit-Debug</value>
- <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
- <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
- <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
- <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
- <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
- <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
- <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
- <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
- <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
- </valuemap>
- <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
- <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
- <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
- <value type="QString">-w</value>
- <value type="QString">-r</value>
- </valuelist>
- <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
- <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
- <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
- </valuemap>
- <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
- </valuemap>
- <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
- <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
- <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
- <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
- <value type="QString">-w</value>
- <value type="QString">-r</value>
- </valuelist>
- <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
- <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
- <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
- </valuemap>
- <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
- </valuemap>
- <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
- <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
- <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
- <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
- <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
- </valuemap>
- <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/davi/Documents/qelectro/build-qelectrotech-Desktop_Qt_5_5_1_GCC_64bit-Release</value>
- <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
- <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
- <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
- <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
- <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
- <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
- <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
- <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
- <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
- </valuemap>
- <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
- <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
- <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
- <value type="QString">-w</value>
- <value type="QString">-r</value>
- </valuelist>
- <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
- <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
- <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
- </valuemap>
- <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
- </valuemap>
- <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
- <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
- <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
- <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
- <value type="QString">-w</value>
- <value type="QString">-r</value>
- </valuelist>
- <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
- <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
- <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
- </valuemap>
- <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
- </valuemap>
- <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
- <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
- <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
- <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
- <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
- </valuemap>
- <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
- <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
- <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
- <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
- </valuemap>
- <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
- </valuemap>
- <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
- <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
- <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
- <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
- <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
- <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
- <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
- <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
- <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
- <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
- <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
- <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
- <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
- <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
- <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
- <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
- <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
- <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
- <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
- <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
- <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
- <value type="int">0</value>
- <value type="int">1</value>
- <value type="int">2</value>
- <value type="int">3</value>
- <value type="int">4</value>
- <value type="int">5</value>
- <value type="int">6</value>
- <value type="int">7</value>
- <value type="int">8</value>
- <value type="int">9</value>
- <value type="int">10</value>
- <value type="int">11</value>
- <value type="int">12</value>
- <value type="int">13</value>
- <value type="int">14</value>
- </valuelist>
- <value type="int" key="PE.EnvironmentAspect.Base">2</value>
- <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qelectrotech</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/davi/Documents/qelectro/qet-0.5_original/qelectrotech.pro</value>
- <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
- <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">qelectrotech.pro</value>
- <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
- <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
- <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
- <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
- <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
- <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
- <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
- <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
- <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
- </valuemap>
- <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
- </valuemap>
- </data>
- <data>
- <variable>ProjectExplorer.Project.TargetCount</variable>
- <value type="int">1</value>
- </data>
- <data>
- <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
- <value type="int">18</value>
- </data>
- <data>
- <variable>Version</variable>
- <value type="int">18</value>
- </data>
-</qtcreator>
Modified: trunk/sources/bordertitleblock.cpp
===================================================================
--- trunk/sources/bordertitleblock.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/bordertitleblock.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -243,6 +243,7 @@
ip.folio = folio();
ip.template_name = titleBlockTemplateName();
ip.display_at = m_edge;
+ ip.auto_page_num = autoPageNum();
ip.context = additional_fields_;
ip.collection = QET::QetCollection::Embedded;
@@ -259,6 +260,7 @@
setTitle(ip.title);
setFileName(ip.filename);
setFolio(ip.folio);
+ setAutoPageNum(ip.auto_page_num);
if (m_edge != ip.display_at)
{
m_edge = ip.display_at;
@@ -685,6 +687,7 @@
context.addValue("folio", btb_final_folio_);
context.addValue("folio-id", folio_index_);
context.addValue("folio-total", folio_total_);
+ context.addValue("auto_page_num", btb_auto_page_num_);
titleblock_template_renderer_ -> setContext(context);
}
@@ -711,7 +714,7 @@
@param total nombre total de schemas dans le projet
@param project_properties Project-wide properties, to be merged with diagram-wide ones.
*/
-void BorderTitleBlock::setFolioData(int index, int total, const DiagramContext &project_properties) {
+void BorderTitleBlock::setFolioData(int index, int total, QString autonum, const DiagramContext &project_properties) {
if (index < 1 || total < 1 || index > total) return;
// memorise les informations
@@ -720,8 +723,14 @@
// regenere le contenu du champ folio
btb_final_folio_ = btb_folio_;
+
+ if (btb_final_folio_.contains("%autonum")){
+ btb_final_folio_.replace("%autonum", autonum);
+ btb_folio_ = btb_final_folio_;
+ }
btb_final_folio_.replace("%id", QString::number(folio_index_));
btb_final_folio_.replace("%total", QString::number(folio_total_));
-
+
+
updateDiagramContextForTitleBlock(project_properties);
}
Modified: trunk/sources/bordertitleblock.h
===================================================================
--- trunk/sources/bordertitleblock.h 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/bordertitleblock.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -23,6 +23,7 @@
#include <QObject>
#include <QRectF>
#include <QDate>
+#include "numerotationcontext.h"
class QPainter;
class DiagramPosition;
class TitleBlockTemplate;
@@ -106,6 +107,8 @@
bool rowsAreDisplayed() const { return(display_rows_); }
/// @return true si la bordure est affichee, false sinon
bool borderIsDisplayed() const { return(display_border_); }
+
+ QString autoPageNum() const { return(btb_auto_page_num_); }
// methods to set dimensions
void setColumnsCount(int);
@@ -132,9 +135,11 @@
}
/// @param author the new value of the "Folio" field
void setFolio(const QString &folio) { btb_folio_ = folio; }
- void setFolioData(int, int, const DiagramContext & = DiagramContext());
+ 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
+ void setAutoPageNum(const QString &auto_page_num) { btb_auto_page_num_ = auto_page_num;}
void titleBlockToXml(QDomElement &);
void titleBlockFromXml(const QDomElement &);
@@ -203,6 +208,7 @@
QString btb_title_;
QString btb_folio_;
QString btb_final_folio_;
+ QString btb_auto_page_num_;
int folio_index_;
int folio_total_;
QString btb_filename_;
Modified: trunk/sources/configdialog.h
===================================================================
--- trunk/sources/configdialog.h 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/configdialog.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -36,6 +36,10 @@
virtual ~ConfigDialog();
private:
ConfigDialog(const ConfigDialog &);
+
+ public:
+ QList<ConfigPage *> pages;
+
// methods
public slots:
@@ -52,6 +56,8 @@
QListWidget *pages_list;
QStackedWidget *pages_widget;
QDialogButtonBox *buttons;
- QList<ConfigPage *> pages;
+
+
+
};
#endif
Modified: trunk/sources/configpages.cpp
===================================================================
--- trunk/sources/configpages.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/configpages.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -35,8 +35,9 @@
* else edit the properties by default of QElectroTech
* @param parent, parent widget
*/
-NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent) :
+NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectPropertiesDialog *ppd) :
ConfigPage (parent),
+ ppd_ (ppd),
m_project (project)
{
//By default we set the global default properties
@@ -47,7 +48,7 @@
QList <TitleBlockTemplatesCollection *> c;
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, project, parent);
// default conductor properties
cpw = new ConductorPropertiesWidget(ConductorProperties::defaultProperties());
// default propertie of report label
@@ -64,6 +65,8 @@
xrefpw -> setProperties (m_project -> defaultXRefProperties());
}
+ connect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab()));
+
// main tab widget
QTabWidget *tab_widget = new QTabWidget(this);
QWidget *diagram_widget = new QWidget();
@@ -87,6 +90,7 @@
* @brief NewDiagramPage::~NewDiagramPage
*/
NewDiagramPage::~NewDiagramPage() {
+ disconnect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab()));
}
/**
@@ -173,12 +177,50 @@
* @return title of this page
*/
QString NewDiagramPage::title() const {
- if (m_project) return(tr("Nouveau folio", "configuration page title"));
+ if (m_project) return(tr("Nouveau folio", "configuration page title"));
return(tr("Nouveau projet", "configuration page title"));
}
+/**
+ * @brief NewDiagramPage::changeToAutoFolioTab
+ * Set the current tab to Autonum
+ */
+void NewDiagramPage::changeToAutoFolioTab(){
+ if (m_project){
+ ppd_->setCurrentPage(ProjectPropertiesDialog::Autonum);
+ ppd_->changeToFolio();
+ ppd_->exec();
+ }
+}
/**
+ * @brief NewDiagramPage::setFolioAutonum
+ * Set temporary TBP to use in auto folio num
+ */
+void NewDiagramPage::setFolioAutonum(QString autoNum){
+ TitleBlockProperties tbptemp = ipw->propertiesAutoNum(autoNum);
+ ipw->setProperties(tbptemp);
+ applyConf();
+}
+
+/**
+ * @brief NewDiagramPage::saveCurrentTbp
+ * Save current TBP to retrieve after auto folio num
+ */
+void NewDiagramPage::saveCurrentTbp(){
+ savedTbp = ipw->properties();
+}
+
+/**
+ * @brief NewDiagramPage::loadSavedTbp
+ * Retrieve saved auto folio num
+ */
+void NewDiagramPage::loadSavedTbp(){
+ ipw->setProperties(savedTbp);
+ applyConf();
+}
+
+/**
Constructeur
@param parent QWidget parent
*/
Modified: trunk/sources/configpages.h
===================================================================
--- trunk/sources/configpages.h 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/configpages.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -19,6 +19,8 @@
#define CONFIG_PAGES_H
#include <QtWidgets>
#include "configpage.h"
+#include "projectpropertiesdialog.h" //davi
+#include "titleblockpropertieswidget.h" //davi
class BorderPropertiesWidget;
class ConductorPropertiesWidget;
class TitleBlockPropertiesWidget;
@@ -26,6 +28,7 @@
class ReportPropertieWidget;
class XRefPropertiesWidget;
class QETProject;
+class TitleBlockProperties;
/**
This configuration page enables users to define the properties of new
@@ -35,10 +38,16 @@
Q_OBJECT
// constructors, destructor
public:
- NewDiagramPage(QETProject *project = 0, QWidget * = 0);
+ NewDiagramPage(QETProject *project = 0, QWidget * = 0, ProjectPropertiesDialog *teste = NULL);
virtual ~NewDiagramPage();
private:
NewDiagramPage(const NewDiagramPage &);
+public slots:
+ void changeToAutoFolioTab();
+ void setFolioAutonum(QString);
+ void saveCurrentTbp();
+ void loadSavedTbp();
+
// methods
public:
@@ -48,12 +57,14 @@
// attributes
private:
+ ProjectPropertiesDialog *ppd_;
QETProject *m_project; ///< Project to edit propertie
BorderPropertiesWidget *bpw; ///< Widget to edit default diagram dimensions
TitleBlockPropertiesWidget *ipw; ///< Widget to edit default title block properties
ConductorPropertiesWidget *cpw; ///< Widget to edit default conductor properties
ReportPropertieWidget *rpw; ///< Widget to edit default report label
XRefPropertiesWidget *xrefpw; ///< Widget to edit default xref properties
+ TitleBlockProperties savedTbp; ///< Used to save current TBP and retrieve later
};
Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/diagram.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -235,6 +235,7 @@
bool transmit_event = true;
if (!isReadOnly()) {
QPointF movement;
+ if (!this->selectedContent().elements.isEmpty()) {
switch(e -> key()) {
case Qt::Key_Left: movement = QPointF(-xGrid, 0.0); break;
case Qt::Key_Right: movement = QPointF(+xGrid, 0.0); break;
@@ -250,6 +251,7 @@
}
if (transmit_event) {
QGraphicsScene::keyPressEvent(e);
+ }
}
}
Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/diagramview.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -1,17 +1,17 @@
/*
Copyright 2006-2015 The QElectroTech Team
This file is part of QElectroTech.
-
+
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
-
+
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -30,6 +30,7 @@
#include "templatelocation.h"
#include "qetapp.h"
#include "qetproject.h"
+#include "projectview.h"
#include "integrationmoveelementshandler.h"
#include "integrationmovetemplateshandler.h"
#include "qetdiagrameditor.h"
@@ -67,12 +68,12 @@
"\"What's this?\" tip"
);
setWhatsThis(whatsthis);
-
+
// active l'antialiasing
setRenderHint(QPainter::Antialiasing, true);
setRenderHint(QPainter::TextAntialiasing, true);
setRenderHint(QPainter::SmoothPixmapTransform, true);
-
+
setScene(scene);
scene -> undoStack().setClean();
setWindowIcon(QET::Icons::QETLogo);
@@ -82,18 +83,18 @@
setSelectionMode();
adjustSceneRect();
updateWindowTitle();
-
+
context_menu = new QMenu(this);
paste_here = new QAction(QET::Icons::EditPaste, tr("Coller ici", "context menu action"), this);
connect(paste_here, SIGNAL(triggered()), this, SLOT(pasteHere()));
-
+
connect(scene, SIGNAL(showDiagram(Diagram*)), this, SIGNAL(showDiagram(Diagram*)));
connect(scene, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
connect(scene, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustSceneRect()));
connect(&(scene -> border_and_titleblock), SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(updateWindowTitle()));
connect(diagram, SIGNAL(editElementRequired(ElementsLocation)), this, SIGNAL(editElementRequired(ElementsLocation)));
connect(diagram, SIGNAL(findElementRequired(ElementsLocation)), this, SIGNAL(findElementRequired(ElementsLocation)));
-
+
connect(
this, SIGNAL(aboutToSetDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &)),
this, SLOT(setDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &)),
@@ -146,7 +147,7 @@
*/
void DiagramView::rotateSelection() {
if (scene -> isReadOnly()) return;
-
+
// recupere les elements et les champs de texte a pivoter
QList<Element *> elements_to_rotate;
QList<DiagramTextItem *> texts_to_rotate;
@@ -167,7 +168,7 @@
images_to_rotate << dii;
}
}
-
+
// effectue les rotations s'il y a quelque chose a pivoter
if (elements_to_rotate.isEmpty() && texts_to_rotate.isEmpty() && images_to_rotate.isEmpty()) return;
scene -> undoStack().push(new RotateElementsCommand(elements_to_rotate, texts_to_rotate, images_to_rotate));
@@ -175,7 +176,7 @@
void DiagramView::rotateTexts() {
if (scene -> isReadOnly()) return;
-
+
// recupere les champs de texte a orienter
QList<DiagramTextItem *> texts_to_rotate;
foreach (QGraphicsItem *item, scene -> selectedItems()) {
@@ -188,10 +189,10 @@
texts_to_rotate << eti;
}
}
-
+
// effectue les rotations s'il y a quelque chose a pivoter
if (texts_to_rotate.isEmpty()) return;
-
+
// demande un angle a l'utilisateur
QDialog ori_text_dialog(diagramEditor());
ori_text_dialog.setSizeGripEnabled(false);
@@ -200,27 +201,27 @@
#endif
ori_text_dialog.setWindowTitle(tr("Orienter les textes sélectionnés", "window title"));
// ori_text_dialog.setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
-
-
+
+
QTextOrientationSpinBoxWidget *ori_widget = QETApp::createTextOrientationSpinBoxWidget();
ori_widget -> setParent(&ori_text_dialog);
if (texts_to_rotate.count() == 1) {
ori_widget -> setOrientation(texts_to_rotate.at(0) -> rotationAngle());
}
ori_widget -> spinBox() -> selectAll();
-
+
// boutons
QDialogButtonBox buttons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(&buttons, SIGNAL(accepted()), &ori_text_dialog, SLOT(accept()));
connect(&buttons, SIGNAL(rejected()), &ori_text_dialog, SLOT(reject()));
-
+
// ajout dans une disposition verticale
QVBoxLayout layout_v(&ori_text_dialog);
layout_v.setSizeConstraint(QLayout::SetFixedSize);
layout_v.addWidget(ori_widget);
layout_v.addStretch();
layout_v.addWidget(&buttons);
-
+
// si le dialogue est accepte
if (ori_text_dialog.exec() == QDialog::Accepted) {
scene -> undoStack().push(new RotateTextsCommand(texts_to_rotate, ori_widget -> orientation()));
@@ -261,7 +262,7 @@
}
/**
- Handle the drops accepted on diagram (elements and title block templates).
+ Handle the drops accepted on diagram (elements and title block templates).
@param e the QDropEvent describing the current drag'n drop
*/
void DiagramView::dropEvent(QDropEvent *e) {
@@ -421,17 +422,17 @@
*/
void DiagramView::paste(const QPointF &pos, QClipboard::Mode clipboard_mode) {
if (!isInteractive() || scene -> isReadOnly()) return;
-
+
QString texte_presse_papier = QApplication::clipboard() -> text(clipboard_mode);
if ((texte_presse_papier).isEmpty()) return;
-
+
QDomDocument document_xml;
if (!document_xml.setContent(texte_presse_papier)) return;
-
+
// objet pour recuperer le contenu ajoute au schema par le coller
DiagramContent content_pasted;
scene -> fromXml(document_xml, pos, false, &content_pasted);
-
+
// si quelque chose a effectivement ete ajoute au schema, on cree un objet d'annulation
if (content_pasted.count()) {
scene -> clearSelection();
@@ -589,7 +590,22 @@
*/
void DiagramView::keyPressEvent(QKeyEvent *e) {
if (m_event_interface && m_event_interface->keyPressEvent(e)) return;
-
+ ProjectView *current_project = this->diagramEditor()->acessCurrentProject();
+switch(e -> key())
+ {
+ case Qt::Key_PageUp:
+ current_project->changeTabUp();
+ return;
+ case Qt::Key_PageDown:
+ current_project->changeTabDown();
+ return;
+ case Qt::Key_Home:
+ current_project->changeFirstTab();
+ return;
+ case Qt::Key_End:
+ current_project->changeLastTab();
+ return;
+ }
switchToVisualisationModeIfNeeded(e);
QGraphicsView::keyPressEvent(e);
}
@@ -751,14 +767,14 @@
QRectF DiagramView::viewedSceneRect() const {
// recupere la taille du widget viewport
QSize viewport_size = viewport() -> size();
-
+
// recupere la transformation viewport -> scene
QTransform view_to_scene = viewportTransform().inverted();
-
+
// mappe le coin superieur gauche et le coin inferieur droit de la viewport sur la scene
QPointF scene_left_top = view_to_scene.map(QPointF(0.0, 0.0));
QPointF scene_right_bottom = view_to_scene.map(QPointF(viewport_size.width(), viewport_size.height()));
-
+
// en deduit le rectangle visualise par la scene
return(QRectF(scene_left_top, scene_right_bottom));
}
@@ -773,7 +789,7 @@
// unlike elements, the integration of title block templates is mandatory, so we simply check whether the parent project of the template is also the parent project of the diagram
QETProject *tbt_parent_project = tbt_loc.parentProject();
if (!tbt_parent_project) return(true);
-
+
return(tbt_parent_project != scene -> project());
}
@@ -783,7 +799,7 @@
*/
void DiagramView::applyReadOnly() {
if (!scene) return;
-
+
bool is_writable = !scene -> isReadOnly();
setInteractive(is_writable);
setAcceptDrops(is_writable);
@@ -795,11 +811,11 @@
void DiagramView::editSelectionProperties() {
// get selection
DiagramContent selection = scene -> selectedContent();
-
+
// if selection contains nothing return
int selected_items_count = selection.count(DiagramContent::All | DiagramContent::SelectedOnly);
if (!selected_items_count) return;
-
+
// if selection contains one item and this item can be editable, edit this item with an appropriate dialog
if (selected_items_count == 1 && selection.items(DiagramContent::Elements |
DiagramContent::AnyConductor |
@@ -811,7 +827,7 @@
else if (selection.elements.size())
selection.elements.toList().first() -> editProperty();
}
-
+
else {
QET::QetMessageBox::information(
this,
@@ -832,7 +848,7 @@
void DiagramView::editSelectedConductorColor() {
// retrieve selected content
DiagramContent selection = scene -> selectedContent();
-
+
// we'll focus on the selected conductor (we do not handle multiple conductors edition)
QList<Conductor *> selected_conductors = selection.conductors(DiagramContent::AnyConductor | DiagramContent::SelectedOnly);
if (selected_conductors.count() == 1) {
@@ -847,10 +863,10 @@
void DiagramView::editConductorColor(Conductor *edited_conductor)
{
if (scene -> isReadOnly() || !edited_conductor) return;
-
+
// store the initial properties of the provided conductor
ConductorProperties initial_properties = edited_conductor -> properties();
-
+
// prepare a color dialog showing the initial conductor color
QColorDialog *color_dialog = new QColorDialog(this);
color_dialog -> setWindowTitle(tr("Choisir la nouvelle couleur de ce conducteur"));
@@ -858,7 +874,7 @@
color_dialog -> setWindowFlags(Qt::Sheet);
#endif
color_dialog -> setCurrentColor(initial_properties.color);
-
+
// asks the user what color he wishes to apply
if (color_dialog -> exec() == QDialog::Accepted)
{
@@ -885,7 +901,7 @@
if (scene -> isReadOnly()) return;
// recupere les conducteurs selectionnes
QSet<Conductor *> selected_conductors = scene -> selectedConductors();
-
+
// repere les conducteurs modifies (= profil non nul)
QHash<Conductor *, ConductorProfilesGroup> conductors_and_profiles;
foreach(Conductor *conductor, selected_conductors) {
@@ -899,7 +915,7 @@
conductors_and_profiles.insert(conductor, profile);
}
}
-
+
if (conductors_and_profiles.isEmpty()) return;
scene -> undoStack().push(new ResetConductorCommand(conductors_and_profiles));
}
@@ -1043,7 +1059,7 @@
if (!qgi -> isSelected()) scene -> clearSelection();
qgi -> setSelected(true);
}
-
+
if (QETDiagramEditor *qde = diagramEditor()) {
context_menu -> clear();
if (scene -> selectedItems().isEmpty()) {
@@ -1061,7 +1077,7 @@
context_menu -> addSeparator();
context_menu -> addActions(qde -> m_selection_actions_group.actions());
}
-
+
// affiche le menu contextuel
context_menu -> popup(e -> globalPos());
}
@@ -1090,10 +1106,10 @@
if (m_event_interface && m_event_interface -> mouseDoubleClickEvent(e)) return;
BorderTitleBlock &bi = scene -> border_and_titleblock;
-
+
//Get the click pos on the diagram
QPointF click_pos = viewportTransform().inverted().map(e -> pos());
-
+
if (bi.titleBlockRect().contains(click_pos) || bi.columnsRect().contains(click_pos) || bi.rowsRect().contains(click_pos)) {
e->accept();
editDiagramProperties();
@@ -1108,14 +1124,14 @@
void DiagramView::setDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &tbt) {
// fetch the current title block properties
TitleBlockProperties titleblock_properties_before = scene -> border_and_titleblock.exportTitleBlock();
-
+
// check the provided template is not already applied
QETProject *tbt_parent_project = tbt.parentProject();
if (tbt_parent_project && tbt_parent_project == scene -> project()) {
// same parent project and same name = same title block template
if (tbt.name() == titleblock_properties_before.template_name) return;
}
-
+
// integrate the provided template into the project if needed
QString integrated_template_name = tbt.name();
if (mustIntegrateTitleBlockTemplate(tbt)) {
@@ -1124,7 +1140,7 @@
integrated_template_name = scene -> project() -> integrateTitleBlockTemplate(tbt, handler);
if (integrated_template_name.isEmpty()) return;
}
-
+
// apply the provided title block template
if (titleblock_properties_before.template_name == integrated_template_name) return;
TitleBlockProperties titleblock_properties_after = titleblock_properties_before;
Modified: trunk/sources/elementspanelwidget.cpp
===================================================================
--- trunk/sources/elementspanelwidget.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/elementspanelwidget.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -67,14 +67,14 @@
prj_activate = new QAction(QET::Icons::ProjectFile, tr("Basculer vers ce projet"), this);
prj_close = new QAction(QET::Icons::DocumentClose, tr("Fermer ce projet"), this);
prj_edit_prop = new QAction(QET::Icons::DialogInformation, tr("Propriétés du projet"), this);
- prj_prop_diagram = new QAction(QET::Icons::DialogInformation, tr("Propriétés du folio"), this);
- prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this);
- prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer ce folio"), this);
- prj_move_diagram_up = new QAction(QET::Icons::GoUp, tr("Remonter ce folio"), this);
- prj_move_diagram_down = new QAction(QET::Icons::GoDown, tr("Abaisser ce folio"), this);
- prj_move_diagram_upx10 = new QAction(QET::Icons::GoUp, tr("Remonter ce folio x10"), this);
- prj_move_diagram_top = new QAction(QET::Icons::GoUp, tr("Remonter ce folio au debut"), this);
- prj_move_diagram_downx10 = new QAction(QET::Icons::GoDown, tr("Abaisser ce folio x10"), this);
+ prj_prop_diagram = new QAction(QET::Icons::DialogInformation, tr("Propriétés du folio"), this);
+ prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this);
+ prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer ce folio"), this);
+ prj_move_diagram_up = new QAction(QET::Icons::GoUp, tr("Remonter ce folio"), this);
+ prj_move_diagram_down = new QAction(QET::Icons::GoDown, tr("Abaisser ce folio"), this);
+ prj_move_diagram_upx10 = new QAction(QET::Icons::GoUp, tr("Remonter ce folio x10"), this);
+ prj_move_diagram_top = new QAction(QET::Icons::GoUp, tr("Remonter ce folio au debut"), this);
+ prj_move_diagram_downx10 = new QAction(QET::Icons::GoDown, tr("Abaisser ce folio x10"), this);
tbt_add = new QAction(QET::Icons::TitleBlock, tr("Nouveau modèle"), this);
tbt_edit = new QAction(QET::Icons::TitleBlock, tr("Éditer ce modèle"), this);
tbt_remove = new QAction(QET::Icons::TitleBlock, tr("Supprimer ce modèle"), this);
@@ -778,6 +778,19 @@
}
/**
+ Treat key press event inside elements panel widget
+*/
+void ElementsPanelWidget::keyPressEvent (QKeyEvent *e) {
+ switch(e -> key()) {
+ case Qt::Key_Delete: //delete diagram through elements panel widget
+ if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
+ emit(requestForDiagramDeletion(selected_diagram));
+ }
+ }
+ return;
+}
+
+/**
Lance l'editeur d'element pour l'element filename
@param location Emplacement de l'element a editer
*/
Modified: trunk/sources/elementspanelwidget.h
===================================================================
--- trunk/sources/elementspanelwidget.h 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/elementspanelwidget.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -110,6 +110,9 @@
void updateProgressBar(int, int);
void loadingFinished();
void filterEdited(const QString &);
+
+ protected:
+ virtual void keyPressEvent (QKeyEvent *e);
private:
void launchElementEditor(const ElementsLocation &);
Modified: trunk/sources/projectconfigpages.cpp
===================================================================
--- trunk/sources/projectconfigpages.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/projectconfigpages.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -27,7 +27,7 @@
#include "ui/xrefpropertieswidget.h"
#include "selectautonumw.h"
#include "numerotationcontext.h"
-
+#include "folioautonumbering.h"
/**
Constructor
@param project Project this page is editing.
@@ -141,7 +141,6 @@
project_ -> setProjectProperties(new_properties);
modified_project = true;
}
-
if (modified_project) {
project_ -> setModified(true);
}
@@ -186,6 +185,8 @@
main_layout0 -> addWidget(project_variables_label_);
main_layout0 -> addWidget(project_variables_);
setLayout(main_layout0);
+ this -> setMinimumWidth(630);
+
}
/**
@@ -250,17 +251,44 @@
* Init some widget of this page
*/
void ProjectAutoNumConfigPage::initWidgets() {
- m_label = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), this);
- m_context_cb = new QComboBox(this);
+ tab_widget = new QTabWidget(this);
+ tab_widget->setMinimumWidth(440);
+
+ //Conductor Tab
+ conductor_tab_widget = new QWidget(this);
+
+ m_label = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), conductor_tab_widget);
+
+ m_context_cb = new QComboBox(conductor_tab_widget);
m_context_cb->setEditable(true);
m_context_cb->lineEdit()->setClearButtonEnabled(true);
m_context_cb->addItem(tr("Nom de la nouvelle numérotation"));
- m_remove_pb = new QPushButton(QET::Icons::EditDelete, QString(), this);
+ m_remove_pb = new QPushButton(QET::Icons::EditDelete, QString(), conductor_tab_widget);
m_remove_pb -> setToolTip(tr("Supprimer la numérotation"));
- m_saw = new SelectAutonumW(this);
+ m_saw = new SelectAutonumW(conductor_tab_widget);
+
+ //Folio Tab
+ folio_tab_widget = new QWidget(this);
+
+ m_label_2 = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), folio_tab_widget);
+
+ m_context_cb_2 = new QComboBox(folio_tab_widget);
+ m_context_cb_2->setEditable(true);
+ m_context_cb_2->lineEdit()->setClearButtonEnabled(true);
+ m_context_cb_2->addItem(tr("Nom de la nouvelle numérotation"));
+
+ m_remove_pb_2 = new QPushButton(QET::Icons::EditDelete, QString(), folio_tab_widget);
+ m_remove_pb_2 -> setToolTip(tr("Supprimer la numérotation"));
+
+ m_saw_2 = new SelectAutonumW(folio_tab_widget);
+
+/* //AutoNumbering Tab - Needs Further Testing
+ autoNumbering_tab_widget = new QWidget(this);
+ m_faw = new FolioAutonumberingW(project(),autoNumbering_tab_widget);
+*/
}
/**
@@ -268,15 +296,40 @@
* Init the layout of this page
*/
void ProjectAutoNumConfigPage::initLayout() {
- QHBoxLayout *context_layout = new QHBoxLayout();
+ //Conductor tab
+ tab_widget->addTab(conductor_tab_widget, tr("Conductor"));
+
+ QHBoxLayout *context_layout = new QHBoxLayout();
context_layout -> addWidget (m_label);
context_layout -> addWidget (m_context_cb);
context_layout -> addWidget (m_remove_pb);
- QVBoxLayout *main_layout = new QVBoxLayout(this);
- this -> setLayout (main_layout);
- main_layout -> addLayout (context_layout);
- main_layout -> addWidget (m_saw);
+ QVBoxLayout *main_layout = new QVBoxLayout();
+ QVBoxLayout *aux_layout = new QVBoxLayout();
+ aux_layout->addLayout(context_layout);
+ aux_layout->addWidget(m_saw);
+
+ main_layout->addLayout(aux_layout);
+ conductor_tab_widget -> setLayout (main_layout);
+
+ // Folio Tab
+ tab_widget->addTab(folio_tab_widget, tr("Folio"));
+
+ QHBoxLayout *context_layout_2 = new QHBoxLayout();
+ context_layout_2 -> addWidget (m_label_2);
+ context_layout_2 -> addWidget (m_context_cb_2);
+ context_layout_2 -> addWidget (m_remove_pb_2);
+
+ QVBoxLayout *main_layout_2 = new QVBoxLayout();
+ QVBoxLayout *aux_layout_2 = new QVBoxLayout();
+ aux_layout_2->addLayout(context_layout_2);
+ aux_layout_2->addWidget(m_saw_2);
+
+ main_layout_2->addLayout(aux_layout_2);
+ folio_tab_widget -> setLayout (main_layout_2);
+
+ //Auto Numbering Tab - Needs Further Testing
+// tab_widget->addTab(autoNumbering_tab_widget,tr ("Folio Auto Numbering"));
}
/**
@@ -284,9 +337,20 @@
* Read value stored on project, and update display
*/
void ProjectAutoNumConfigPage::readValuesFromProject() {
+ //Conductor Tab
QList <QString> keys = project_->conductorAutoNum().keys();
- if (keys.isEmpty()) return;
+ if (!keys.isEmpty()){
foreach (QString str, keys) { m_context_cb -> addItem(str); }
+ }
+
+ //Folio Tab
+ QList <QString> keys_2 = project_->folioAutoNum().keys();
+ if (!keys_2.isEmpty()){
+ foreach (QString str, keys_2) { m_context_cb_2 -> addItem(str);}
+ }
+
+ //Folio AutoNumbering Tab - Needs Further Testing
+// m_faw->setContext(keys_2);
}
/**
@@ -301,14 +365,28 @@
* setup some connections
*/
void ProjectAutoNumConfigPage::buildConnections() {
+
+ connect(tab_widget,SIGNAL(currentChanged(int)),this,SLOT(tabChanged(int)));
+
+ //Conductor Tab
connect (m_context_cb, SIGNAL (currentIndexChanged(QString)), this, SLOT (updateContext(QString)));
connect (m_saw, SIGNAL (applyPressed()), this, SLOT (saveContext()));
- connect (m_remove_pb, SIGNAL(clicked()), this, SLOT(removeContext()));
+ connect (m_remove_pb, SIGNAL (clicked()), this, SLOT(removeContext()));
+
+ //Folio Tab
+ connect (m_context_cb_2, SIGNAL (currentIndexChanged(QString)), this, SLOT (updateContext_2(QString)));
+ connect (m_saw_2, SIGNAL (applyPressed()), this, SLOT (saveContext_2()));
+ connect (m_remove_pb_2, SIGNAL (clicked()), this, SLOT (removeContext_2()));
+
+/* //Auto Folio Numbering - Needs Further Testing
+ connect (m_faw, SIGNAL (applyPressed()), this, SLOT (applyAutoNum()));
+ connect (m_faw, SIGNAL (m_autonumber_tabs_rb_clicked()), this, SLOT (tabChanged(int)));
+*/
}
/**
* @brief ProjectAutoNumConfigPage::updateContext
- * Display the current selected context
+ * Display the current selected context for conductor
* @param str, key of context stored in project
*/
void ProjectAutoNumConfigPage::updateContext(QString str) {
@@ -317,8 +395,18 @@
}
/**
+ * @brief ProjectAutoNumConfigPage::updateContext_2
+ * Display the current selected context for folio
+ * @param str, key of context stored in project
+ */
+void ProjectAutoNumConfigPage::updateContext_2(QString str) {
+ if (str == tr("Nom de la nouvelle numérotation")) m_saw_2 -> setContext(NumerotationContext());
+ else m_saw_2 ->setContext(project_->folioAutoNum(str));
+}
+
+/**
* @brief ProjectAutoNumConfigPage::saveContext
- * Save the current displayed context in project
+ * Save the current displayed conductor context in project
*/
void ProjectAutoNumConfigPage::saveContext() {
// If the text is the default text "Name of new numerotation" save the edited context
@@ -339,8 +427,56 @@
}
/**
+ * @brief ProjectAutoNumConfigPage::saveContext_2
+ * Save the current displayed folio context in project
+ */
+void ProjectAutoNumConfigPage::saveContext_2() {
+ // If the text is the default text "Name of new numerotation" save the edited context
+ // With the the name "No name"
+ if (m_context_cb_2 -> currentText() == tr("Nom de la nouvelle numérotation")) {
+ project_->addFolioAutoNum (tr("Sans nom"), m_saw_2 -> toNumContext());
+ m_context_cb_2 -> addItem(tr("Sans nom"));
+ }
+ // If the text isn't yet to the autonum of the project, add this new item to the combo box.
+ else if ( !project_ -> folioAutoNum().keys().contains( m_context_cb_2->currentText())) {
+ project()->addFolioAutoNum(m_context_cb_2->currentText(), m_saw_2->toNumContext());
+ m_context_cb_2 -> addItem(m_context_cb_2->currentText());
+ }
+ // Else, the text already exist in the autonum of the project, just update the context
+ else {
+ project_->addFolioAutoNum (m_context_cb_2 -> currentText(), m_saw_2 -> toNumContext());
+ }
+}
+
+/**
+ * @brief ProjectAutoNumConfigPage::applyAutoNum
+ * Apply auto folio numbering, New Folios or Selected Folios
+ */
+/*
+void ProjectAutoNumConfigPage::applyAutoNum() {
+
+ if (m_faw->newFolios){
+ int foliosRemaining = m_faw->newFoliosNumber();
+ emit (saveCurrentTbp());
+ emit (setAutoNum(m_faw->autoNumSelected()));
+ while (foliosRemaining > 0){
+ project()->autoFolioNumberingNewFolios();
+ foliosRemaining = foliosRemaining-1;
+ }
+ emit (loadSavedTbp());
+ }
+ else{
+ QString autoNum = m_faw->autoNumSelected();
+ int fromFolio = m_faw->fromFolio();
+ int toFolio = m_faw->toFolio();
+ project_->autoFolioNumberingSelectedFolios(fromFolio,toFolio,autoNum);
+ }
+}
+*/
+
+/**
* @brief ProjectAutoNumConfigPage::removeContext
- * Remove from project the current numerotation context
+ * Remove from project the current conductor numerotation context
*/
void ProjectAutoNumConfigPage::removeContext() {
//if default text, return
@@ -348,3 +484,37 @@
project_ -> removeConductorAutonum (m_context_cb -> currentText() );
m_context_cb -> removeItem (m_context_cb -> currentIndex() );
}
+/**
+ * @brief ProjectAutoNumConfigPage::removeContext_2
+ * Remove from project the current folio numerotation context
+ */
+void ProjectAutoNumConfigPage::removeContext_2() {
+ //if default text, return
+ if ( m_context_cb_2 -> currentText() == tr("Nom de la nouvelle numérotation") ) return;
+ project_ -> removeFolioAutoNum (m_context_cb_2 -> currentText() );
+ m_context_cb_2 -> removeItem (m_context_cb_2 -> currentIndex() );
+}
+/**
+ * @brief ProjectAutoNumConfigPage::changeToTab
+ * @param tab index
+ * Change to Selected Tab
+ */
+void ProjectAutoNumConfigPage::changeToTab(int i){
+ tab_widget->setCurrentIndex(i);
+}
+
+/**
+ * @brief ProjectAutoNumConfigPage::tabChanged
+ * @param tab index
+ * Used to resize window to correct size
+ */
+void ProjectAutoNumConfigPage::tabChanged(int i){
+ if (i>0){
+ if (tab_widget->currentIndex()==2){
+ tab_widget->resize(470,tab_widget->height());
+ }
+ else {
+ tab_widget->adjustSize();
+ }
+ }
+}
Modified: trunk/sources/projectconfigpages.h
===================================================================
--- trunk/sources/projectconfigpages.h 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/projectconfigpages.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -20,6 +20,8 @@
#ifndef PROJECTCONFIGPAGES_H
#define PROJECTCONFIGPAGES_H
#include "configpage.h"
+#include <QtWidgets>
+
class QLabel;
class QLineEdit;
class QETProject;
@@ -32,6 +34,7 @@
class SelectAutonumW;
class QComboBox;
class QPushButton;
+class FolioAutonumberingW;
/**
This class, derived from ConfigPage, aims at providing the basic skeleton
@@ -128,27 +131,49 @@
virtual QString title() const;
virtual QIcon icon() const;
virtual void applyProjectConf();
-
+ virtual void changeToTab(int);
protected:
virtual void initWidgets();
virtual void initLayout();
virtual void readValuesFromProject();
virtual void adjustReadOnly();
-
private:
void buildConnections();
-
private slots:
void updateContext(QString);
void saveContext();
void removeContext();
+ void updateContext_2(QString);
+ void saveContext_2();
+ void removeContext_2();
+// void applyAutoNum(); - Needs Further Testing
+
+ void tabChanged(int);
+
+ signals:
+ void setAutoNum(QString);
+ void setAutoNum(int,int);
+ void saveCurrentTbp();
+ void loadSavedTbp();
+
//Attributes
private:
- QLabel *m_label;
- QComboBox *m_context_cb;
- QPushButton *m_remove_pb;
- SelectAutonumW *m_saw;
+ QTabWidget *tab_widget;
+ QWidget *element_widget;
+ QWidget *conductor_tab_widget;
+ QWidget *folio_tab_widget;
+ QWidget *autoNumbering_tab_widget;
+ QScrollArea *scrollArea;
+ QLabel *m_label;
+ QLabel *m_label_2;
+ QComboBox *m_context_cb;
+ QComboBox *m_context_cb_2;
+ QPushButton *m_remove_pb;
+ QPushButton *m_remove_pb_2;
+ SelectAutonumW *m_saw;
+ SelectAutonumW *m_saw_2;
+ FolioAutonumberingW *m_faw;
};
Modified: trunk/sources/projectview.cpp
===================================================================
--- trunk/sources/projectview.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/projectview.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -1,17 +1,17 @@
/*
Copyright 2006-2015 The QElectroTech Team
This file is part of QElectroTech.
-
+
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
-
+
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -32,7 +32,6 @@
#include "qettemplateeditor.h"
#include "diagramfoliolist.h"
#include "projectpropertiesdialog.h"
-
#include <QTabWidget>
/**
@@ -47,7 +46,7 @@
initActions();
initWidgets();
initLayout();
-
+
setProject(project);
}
@@ -79,8 +78,9 @@
if (!project_) {
project_ = project;
connect(project_, SIGNAL(projectTitleChanged(QETProject *, const QString &)), this, SLOT(updateWindowTitle()));
- connect(project_, SIGNAL(projectModified (QETProject *, bool)), this, SLOT(updateWindowTitle()));
- connect(project_, SIGNAL(readOnlyChanged (QETProject *, bool)), this, SLOT(adjustReadOnlyState()));
+ connect(project_, SIGNAL(projectModified (QETProject *, bool)), this, SLOT(updateWindowTitle()));
+ connect(project_, SIGNAL(readOnlyChanged (QETProject *, bool)), this, SLOT(adjustReadOnlyState()));
+ connect(project_, SIGNAL(addAutoNumDiagram()), this, SLOT(addNewDiagram()));
adjustReadOnlyState();
loadDiagrams();
}
@@ -112,7 +112,7 @@
selection.removeOne(current);
}
}
-
+
return(selection);
}
@@ -139,6 +139,83 @@
}
/**
+ @brief change current diagramview to next folio
+*/
+void ProjectView::changeTabDown(){
+ DiagramView *nextDiagramView = this->nextDiagram();
+ if (nextDiagramView!=NULL){
+ rebuildDiagramsMap();
+ m_tab -> setCurrentWidget(nextDiagramView);
+ }
+}
+
+/**
+ @return next folio of current diagramview
+*/
+DiagramView *ProjectView::nextDiagram() {
+ int current_tab_index = m_tab -> currentIndex();
+ int next_tab_index = current_tab_index + 1; //get next tab index
+ if (next_tab_index<diagram_ids_.count()) //if next tab index >= greatest tab the last tab is activated so no need to change tab.
+ return(diagram_ids_[next_tab_index]);
+ else
+ return NULL;
+}
+
+/**
+ @brief change current diagramview to previous tab
+*/
+void ProjectView::changeTabUp(){
+ DiagramView *previousDiagramView = this->previousDiagram();
+ if (previousDiagramView!=NULL){
+ rebuildDiagramsMap();
+ m_tab -> setCurrentWidget(previousDiagramView);
+ }
+}
+
+/**
+ @return previous folio of current diagramview
+*/
+DiagramView *ProjectView::previousDiagram() {
+ int current_tab_index = m_tab -> currentIndex();
+ int previous_tab_index = current_tab_index - 1; //get previous tab index
+ if (previous_tab_index>=0) //if previous tab index = 0 then the first tab is activated so no need to change tab.
+ return(diagram_ids_[previous_tab_index]);
+ else
+ return NULL;
+}
+
+/**
+ @brief change current diagramview to last tab
+*/
+void ProjectView::changeLastTab(){
+ DiagramView *lastDiagramView = this->lastDiagram();
+ m_tab->setCurrentWidget(lastDiagramView);
+}
+
+/**
+ @return last folio of current project
+*/
+DiagramView *ProjectView::lastDiagram(){
+ return(diagram_ids_.last());
+}
+
+/**
+ @brief change current diagramview to first tab
+*/
+void ProjectView::changeFirstTab(){
+ DiagramView *firstDiagramView = this->firstDiagram();
+ m_tab->setCurrentWidget(firstDiagramView);
+}
+
+/**
+ @return first folio of current project
+*/
+DiagramView *ProjectView::firstDiagram(){
+ return(diagram_ids_.first());
+}
+
+
+/**
Cette methode essaye de fermer successivement les editeurs d'element puis
les schemas du projet. L'utilisateur peut refuser de fermer un schema ou un
editeur.
@@ -148,19 +225,19 @@
*/
bool ProjectView::tryClosing() {
if (!project_) return(true);
-
+
// First step: require external editors closing -- users may either cancel
// the whole closing process or save (and therefore add) content into this
// project. Of course, they may also discard them.
if (!tryClosingElementEditors()) {
return(false);
}
-
+
// Check how different the current situation is from a brand new, untouched project
if (project_ -> filePath().isEmpty() && !project_ -> projectWasModified()) {
return(true);
}
-
+
// Second step: users are presented with a dialog that enables them to
// choose whether they want to:
// - cancel the closing process,
@@ -173,12 +250,12 @@
} else if (user_input == QMessageBox::Discard) {
return(true); // all modifications were discarded
}
-
+
// Check how different the current situation is from a brand new, untouched project (yes , again)
if (project_ -> filePath().isEmpty() && !project_ -> projectWasModified()) {
return(true);
}
-
+
if (project_ -> filePath().isEmpty()) {
QString filepath = askUserForFilePath();
if (filepath.isEmpty()) return(false); // users may cancel the closing
@@ -205,7 +282,7 @@
foreach(QETElementEditor *editor, editors) {
if (!editor -> close()) return(false);
}
-
+
QList<QETTitleBlockTemplateEditor *> template_editors = QETApp::titleBlockTemplateEditors(project_);
foreach(QETTitleBlockTemplateEditor *template_editor, template_editors) {
if (!template_editor -> close()) return(false);
@@ -243,7 +320,7 @@
if (close_dialog == QMessageBox::Save) {
saveDiagrams(project()->diagrams());
}
-
+
return(close_dialog);
}
@@ -260,20 +337,20 @@
this,
tr("Enregistrer sous", "dialog title"),
project_ -> currentDir(),
- tr("Projet QElectroTech (*.qet)", "filetypes allowed when saving a project file")
+ tr("Projet QElectroTech (*.qet)", "filetypes allowed when saving a project file")
);
-
+
// if no filepath is provided, return an empty string
if (filepath.isEmpty()) return(filepath);
-
+
// if the name does not end with the .qet extension, append it
if (!filepath.endsWith(".qet", Qt::CaseInsensitive)) filepath += ".qet";
-
+
if (assign) {
// assign the provided filepath to the currently edited project
project_ -> setFilePath(filepath);
}
-
+
return(filepath);
}
@@ -292,7 +369,7 @@
*/
void ProjectView::addNewDiagram() {
if (project_ -> isReadOnly()) return;
-
+
Diagram *new_diagram = project_ -> addNewDiagram();
DiagramView *new_diagram_view = new DiagramView(new_diagram);
addDiagram(new_diagram_view);
@@ -335,7 +412,7 @@
// check diagram isn't present in the project
if (diagram_ids_.values().contains(diagram)) return;
-
+
// Add new tab for the diagram
m_tab -> addTab(diagram, QET::Icons::Diagram, diagram -> title());
diagram -> setFrameStyle(QFrame::Plain | QFrame::NoFrame);
@@ -348,7 +425,7 @@
connect(diagram, SIGNAL(findElementRequired(const ElementsLocation &)), this, SIGNAL(findElementRequired(const ElementsLocation &)));
connect(diagram, SIGNAL(editElementRequired(const ElementsLocation &)), this, SIGNAL(editElementRequired(const ElementsLocation &)));
connect(diagram, SIGNAL(editTitleBlockTemplate(const QString &, bool)), this, SLOT(editTitleBlockTemplateRequired(const QString &, bool)));
-
+
// signal diagram was added
emit(diagramAdded(diagram));
}
@@ -360,36 +437,36 @@
void ProjectView::removeDiagram(DiagramView *diagram_view) {
if (!diagram_view) return;
if (project_ -> isReadOnly()) return;
-
+
// verifie que le schema est bien present dans le projet
if (!diagram_ids_.values().contains(diagram_view)) return;
-
+
//Ask confirmation to user.
int answer = QET::QetMessageBox::question(
this,
- tr("Supprimer le folio ?", "message box title"),
- tr("Êtes-vous sûr de vouloir supprimer ce folio du projet ? Ce changement est irréversible.", "message box content"),
+ tr("Supprimer le folio ?", "message box title"),
+ tr("Êtes-vous sûr de vouloir supprimer ce folio du projet ? Ce changement est irréversible.", "message box content"),
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
QMessageBox::No
);
if (answer != QMessageBox::Yes) {
return;
}
-
+
// enleve le DiagramView des onglets
int diagram_tab_id = diagram_ids_.key(diagram_view);
m_tab -> removeTab(diagram_tab_id);
diagrams_.removeAll(diagram_view);
rebuildDiagramsMap();
-
+
// supprime le DiagramView, puis le Diagram
project_ -> removeDiagram(diagram_view -> diagram());
delete diagram_view;
-
+
// signale le retrait du schema
emit(diagramRemoved(diagram_view));
-
+
// rend definitif le retrait du schema
project_ -> write();
}
@@ -400,7 +477,7 @@
*/
void ProjectView::removeDiagram(Diagram *diagram) {
if (!diagram) return;
-
+
if (DiagramView *diagram_view = findDiagram(diagram)) {
removeDiagram(diagram_view);
}
@@ -464,7 +541,7 @@
*/
void ProjectView::moveDiagramUp(DiagramView *diagram_view) {
if (!diagram_view) return;
-
+
int diagram_view_position = diagram_ids_.key(diagram_view);
if (!diagram_view_position) {
// le schema est le premier du projet
@@ -485,7 +562,7 @@
*/
void ProjectView::moveDiagramDown(DiagramView *diagram_view) {
if (!diagram_view) return;
-
+
int diagram_view_position = diagram_ids_.key(diagram_view);
if (diagram_view_position + 1 == diagram_ids_.count()) {
// le schema est le dernier du projet
@@ -572,7 +649,7 @@
*/
void ProjectView::printProject() {
if (!project_) return;
-
+
// transforme le titre du projet en nom utilisable pour le document
QString doc_name;
if (!(project_ -> title().isEmpty())) {
@@ -584,13 +661,13 @@
if (doc_name.isEmpty()) {
doc_name = tr("projet", "string used to generate a filename");
}
-
+
// recupere le dossier contenant le fichier courant
QString dir_path = project_ -> currentDir();
-
+
// determine un chemin pour le pdf / ps
QString file_name = QDir::toNativeSeparators(QDir::cleanPath(dir_path + "/" + doc_name));
-
+
DiagramPrintDialog print_dialog(project_, this);
print_dialog.setDocName(doc_name);
print_dialog.setFileName(file_name);
@@ -602,7 +679,7 @@
*/
void ProjectView::exportProject() {
if (!project_) return;
-
+
ExportDialog ed(project_, parentWidget());
#ifdef Q_OS_MAC
ed.setWindowFlags(Qt::Sheet);
@@ -629,7 +706,7 @@
*/
QETResult ProjectView::saveAs(ProjectSaveOptions options) {
if (!project_) return(noProjectResult());
-
+
QString filepath = askUserForFilePath();
if (filepath.isEmpty()) return(QETResult());
return(doSave(options));
@@ -645,16 +722,16 @@
*/
QETResult ProjectView::doSave(ProjectSaveOptions options) {
if (!project_) return(noProjectResult());
-
+
if (project_ -> filePath().isEmpty()) {
// The project has not been saved to a file yet,
// so save() actually means saveAs().
return(saveAs(options));
}
-
+
// look for diagrams matching the required save options
saveDiagrams(getDiagrams(options));
-
+
// write to file
QETResult result = project_ -> write();
updateWindowTitle();
@@ -688,7 +765,7 @@
*/
int ProjectView::cleanProject() {
if (!project_) return(0);
-
+
// s'assure que le schema n'est pas en lecture seule
if (project_ -> isReadOnly()) {
QET::QetMessageBox::critical(
@@ -698,22 +775,22 @@
);
return(0);
}
-
+
// construit un petit dialogue pour parametrer le nettoyage
- QCheckBox *clean_tbt = new QCheckBox(tr("Supprimer les modèles de cartouche inutilisés dans le projet"));
+ QCheckBox *clean_tbt = new QCheckBox(tr("Supprimer les modèles de cartouche inutilisés dans le projet"));
QCheckBox *clean_elements = new QCheckBox(tr("Supprimer les éléments inutilisés dans le projet"));
QCheckBox *clean_categories = new QCheckBox(tr("Supprimer les catégories vides"));
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
-
- clean_tbt -> setChecked(true);
+
+ clean_tbt -> setChecked(true);
clean_elements -> setChecked(true);
clean_categories -> setChecked(true);
-
+
QDialog clean_dialog(parentWidget());
#ifdef Q_OS_MAC
clean_dialog.setWindowFlags(Qt::Sheet);
#endif
-
+
clean_dialog.setWindowTitle(tr("Nettoyer le projet", "window title"));
QVBoxLayout *clean_dialog_layout = new QVBoxLayout();
clean_dialog_layout -> addWidget(clean_tbt);
@@ -721,10 +798,10 @@
clean_dialog_layout -> addWidget(clean_categories);
clean_dialog_layout -> addWidget(buttons);
clean_dialog.setLayout(clean_dialog_layout);
-
+
connect(buttons, SIGNAL(accepted()), &clean_dialog, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), &clean_dialog, SLOT(reject()));
-
+
int clean_count = 0;
if (clean_dialog.exec() == QDialog::Accepted)
{
@@ -751,7 +828,7 @@
Initialize actions for this widget.
*/
void ProjectView::initActions() {
- add_new_diagram_ = new QAction(QET::Icons::AddFolio, tr("Ajouter un folio"), this);
+ add_new_diagram_ = new QAction(QET::Icons::AddFolio, tr("Ajouter un folio"), this);
connect(add_new_diagram_, SIGNAL(triggered()), this, SLOT(addNewDiagram()));
}
@@ -761,30 +838,30 @@
void ProjectView::initWidgets() {
setObjectName("ProjectView");
setWindowIcon(QET::Icons::ProjectFileGP);
-
+
// initialize the "fallback" widget
fallback_widget_ = new QWidget();
fallback_label_ = new QLabel(
tr(
- "Ce projet ne contient aucun folio",
+ "Ce projet ne contient aucun folio",
"label displayed when a project contains no diagram"
)
);
fallback_label_ -> setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
-
+
// initialize tabs
m_tab = new QTabWidget(this);
m_tab -> setMovable(true);
-
+
QToolButton *add_new_diagram_button = new QToolButton;
add_new_diagram_button -> setDefaultAction(add_new_diagram_);
add_new_diagram_button -> setAutoRaise(true);
m_tab -> setCornerWidget(add_new_diagram_button, Qt::TopRightCorner);
-
+
connect(m_tab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
connect(m_tab, SIGNAL(tabBarDoubleClicked(int)), this, SLOT(tabDoubleClicked(int)));
connect(m_tab->tabBar(), SIGNAL(tabMoved(int, int)), this, SLOT(tabMoved(int, int)));
-
+
fallback_widget_ -> setVisible(false);
m_tab -> setVisible(false);
}
@@ -795,7 +872,7 @@
void ProjectView::initLayout() {
QVBoxLayout *fallback_widget_layout_ = new QVBoxLayout(fallback_widget_);
fallback_widget_layout_ -> addWidget(fallback_label_);
-
+
layout_ = new QVBoxLayout(this);
#ifdef Q_OS_MAC
layout_ -> setContentsMargins(0, 8, 0, 0);
@@ -816,9 +893,9 @@
*/
void ProjectView::loadDiagrams() {
if (!project_) return;
-
+
setDisplayFallbackWidget(project_ -> diagrams().isEmpty());
-
+
foreach(Diagram *diagram, project_ -> diagrams()) {
DiagramView *sv = new DiagramView(diagram);
addDiagram(sv);
@@ -851,12 +928,12 @@
*/
void ProjectView::adjustReadOnlyState() {
bool editable = !(project_ -> isReadOnly());
-
+
// prevent users from moving existing diagrams
m_tab -> setMovable(editable);
// prevent users from adding new diagrams
add_new_diagram_ -> setEnabled(editable);
-
+
// on met a jour le titre du widget, qui reflete l'etat de lecture seule
updateWindowTitle();
}
@@ -879,13 +956,13 @@
*/
void ProjectView::tabMoved(int from, int to) {
if (!project_) return;
-
+
// signale au QETProject le changement d'ordre des schemas
project_ -> diagramOrderChanged(from, to);
-
+
// reconstruit la liste associant les index des onglets aux schemas
rebuildDiagramsMap();
-
+
// emet un signal pour informer le reste du monde que l'ordre des schemas a change
emit(diagramOrderChanged(this, from, to));
}
@@ -926,7 +1003,7 @@
void ProjectView::rebuildDiagramsMap() {
// vide la map
diagram_ids_.clear();
-
+
foreach(DiagramView *diagram_view, diagrams_) {
int dv_idx = m_tab -> indexOf(diagram_view);
if (dv_idx == -1) continue;
@@ -958,7 +1035,7 @@
// repere le schema concerne
DiagramView *diagram_view = diagram_ids_[tab_id];
if (!diagram_view) return;
-
+
diagram_view -> editDiagramProperties();
}
Modified: trunk/sources/projectview.h
===================================================================
--- trunk/sources/projectview.h 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/projectview.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -1,17 +1,17 @@
/*
Copyright 2006-2015 The QElectroTech Team
This file is part of QElectroTech.
-
+
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
-
+
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -31,7 +31,7 @@
*/
class ProjectView : public QWidget {
Q_OBJECT
-
+
public:
enum ProjectSaveOption {
CurrentDiagram = 2,
@@ -39,15 +39,15 @@
AllDiagrams = 6
};
Q_DECLARE_FLAGS(ProjectSaveOptions, ProjectSaveOption)
-
-
+
+
// constructors, destructor
public:
ProjectView(QETProject *, QWidget * = 0);
virtual ~ProjectView();
private:
ProjectView(const ProjectView &);
-
+
// methods
public:
QETProject *project();
@@ -56,7 +56,11 @@
QList<Diagram *> getDiagrams(ProjectSaveOptions options);
DiagramView *currentDiagram() const;
void closeEvent(QCloseEvent *);
-
+ void changeTabUp();
+ void changeTabDown();
+ void changeFirstTab();
+ void changeLastTab();
+
public slots:
void addNewDiagram();
void addNewDiagramFolioList();
@@ -90,7 +94,7 @@
void updateTabTitle(DiagramView *, const QString &);
void tabMoved(int, int);
void editTitleBlockTemplateRequired(const QString &, bool);
-
+
signals:
void diagramAdded(DiagramView *);
void diagramRemoved(DiagramView *);
@@ -102,26 +106,30 @@
void findElementRequired(const ElementsLocation &);
void editElementRequired(const ElementsLocation &);
void editTitleBlockTemplate(const TitleBlockTemplateLocation &, bool);
-
+
private:
void initActions();
void initWidgets();
void initLayout();
void loadDiagrams();
DiagramView *findDiagram(Diagram *);
+ DiagramView *nextDiagram();
+ DiagramView *previousDiagram();
+ DiagramView *firstDiagram();
+ DiagramView *lastDiagram();
void rebuildDiagramsMap();
bool tryClosing();
bool tryClosingElementEditors();
int tryClosingDiagrams();
QString askUserForFilePath(bool = true);
QETResult noProjectResult() const;
-
+
private slots:
void tabChanged(int);
void tabDoubleClicked(int);
void setDisplayFallbackWidget(bool);
void adjustReadOnlyState();
-
+
// attributes
private:
QAction *add_new_diagram_;
Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/qetdiagrameditor.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -1525,6 +1525,34 @@
}
/**
+ * @brief QETDiagramEditor::acessCurrentProject
+ * Retrieve current Project open in diagram editor
+ */
+ProjectView *QETDiagramEditor::acessCurrentProject (){
+ QMdiSubWindow *current_window = workspace.activeSubWindow();
+ if (!current_window) return(0);
+
+ QWidget *current_widget = current_window -> widget();
+ if (!current_widget) return(0);
+
+ if (ProjectView *project_view = qobject_cast<ProjectView *>(current_widget)) {
+ return(project_view);
+ }
+ return(0);
+}
+
+/**
+ * @brief QETDiagramEditor::acessCurrentDiagramView
+ * Retrieve current DiagramView used in diagram editor
+ */
+DiagramView *QETDiagramEditor::acessCurrentDiagramView () {
+ if (ProjectView *project_view = currentProject()) {
+ return(project_view -> currentDiagram());
+ }
+ return(0);
+}
+
+/**
met a jour le menu "Fenetres"
*/
void QETDiagramEditor::slot_updateWindowsMenu() {
Modified: trunk/sources/qetdiagrameditor.h
===================================================================
--- trunk/sources/qetdiagrameditor.h 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/qetdiagrameditor.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -65,7 +65,9 @@
bool openAndAddProject (const QString &, bool = true, bool = true);
QList<QString> editedFiles () const;
ProjectView *viewForFile (const QString &) const;
-
+ ProjectView *acessCurrentProject ();
+ DiagramView *acessCurrentDiagramView ();
+
protected:
virtual bool event(QEvent *);
Modified: trunk/sources/qetproject.cpp
===================================================================
--- trunk/sources/qetproject.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/qetproject.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -34,7 +34,9 @@
#include "integrationmovetemplateshandler.h"
#include "xmlelementcollection.h"
#include "importelementdialog.h"
+#include "numerotationcontextcommands.h"
+
#include <QStandardPaths>
QString QETProject::integration_category_name = "import";
@@ -54,7 +56,8 @@
titleblocks_ (this ),
folioSheetsQuantity (0 ),
m_auto_conductor (true ),
- m_elements_collection (nullptr)
+ m_elements_collection (nullptr),
+ m_auto_folio (true )
{
// 0 a n schema(s) vide(s)
int diagrams_count = qMax(0, diagrams);
@@ -91,7 +94,8 @@
titleblocks_ (this ),
folioSheetsQuantity (0 ),
m_auto_conductor (true ),
- m_elements_collection (nullptr)
+ m_elements_collection (nullptr),
+ m_auto_folio (true )
{
//Open the file
QFile project_file(path);
@@ -443,8 +447,16 @@
}
/**
+ * @brief QETProject::folioAutoNum
+ * @return All value of conductor autonum stored in project
+ */
+QHash <QString, NumerotationContext> QETProject::folioAutoNum() const {
+ return m_folio_autonum;
+}
+
+/**
* @brief QETProject::addConductorAutoNum
- * Add a new numerotation context. If key already exist,
+ * Add a new conductor numerotation context. If key already exist,
* replace old context by the new context
* @param key
* @param context
@@ -454,8 +466,19 @@
}
/**
+ * @brief QETProject::addFolioAutoNum
+ * Add a new folio numerotation context. If key already exist,
+ * replace old context by the new context
+ * @param key
+ * @param context
+ */
+void QETProject::addFolioAutoNum(QString key, NumerotationContext context) {
+ m_folio_autonum.insert(key, context);
+}
+
+/**
* @brief QETProject::removeConductorAutonum
- * Remove the Numerotation Context stored with key
+ * Remove Conductor Numerotation Context stored with key
* @param key
*/
void QETProject::removeConductorAutonum(QString key) {
@@ -463,8 +486,17 @@
}
/**
+ * @brief QETProject::removeFolioAutonum
+ * Remove Folio Numerotation Context stored with key
+ * @param key
+ */
+void QETProject::removeFolioAutoNum(QString key) {
+ m_folio_autonum.remove(key);
+}
+
+/**
* @brief QETProject::conductorAutoNum
- * Return the numerotation context stored with @key.
+ * Return conductor numerotation context stored with @key.
* If key is not found, return an empty numerotation context
* @param key
*/
@@ -474,6 +506,17 @@
}
/**
+ * @brief QETProject::folioAutoNum
+ * Return folio numerotation context stored with @key.
+ * If key is not found, return an empty numerotation context
+ * @param key
+ */
+NumerotationContext QETProject::folioAutoNum (const QString &key) const {
+ if (m_folio_autonum.contains(key)) return m_folio_autonum[key];
+ else return NumerotationContext();
+}
+
+/**
* @brief QETProject::autoConductor
* @return true if use of auto conductor is authorized.
* See also Q_PROPERTY autoConductor
@@ -484,6 +527,16 @@
}
/**
+ * @brief QETProject::autoFolio
+ * @return true if use of auto folio is authorized.
+ * See also Q_PROPERTY autoFolio
+ */
+bool QETProject::autoFolio() const
+{
+ return m_auto_folio;
+}
+
+/**
* @brief QETProject::setAutoConductor
* @param ac
* Enable the use of auto conductor if true
@@ -496,6 +549,46 @@
}
/**
+ * @brief QETProject::setAutoFolio
+ * @param ac
+ * Enable the use of auto folio if true
+ * See also Q_PROPERTY autoConductor
+ */
+void QETProject::setAutoFolio(bool af)
+{
+ if (af != m_auto_folio)
+ m_auto_folio = af;
+}
+
+/**
+ * @brief QETProject::autoFolioNumberingNewFolios
+ * emit Signal to add new Diagram with autonum
+ * properties
+ */
+void QETProject::autoFolioNumberingNewFolios(){
+ emit addAutoNumDiagram();
+}
+
+/**
+ * @brief QETProject::autoFolioNumberingNewFolios
+ * @param autonum used, index from selected tabs "from" and "to"
+ * rename folios with selected autonum
+ */
+void QETProject::autoFolioNumberingSelectedFolios(int from, int to, QString autonum){
+ int total_folio = diagrams_.count();
+ DiagramContext project_wide_properties = project_properties_;
+ for (int i=from; i<=to; i++) {
+ QString title = diagrams_[i] -> title();
+ NumerotationContext nC = folioAutoNum(autonum);
+ NumerotationContextCommands nCC = NumerotationContextCommands(nC);
+ diagrams_[i] -> border_and_titleblock.setFolio("%autonum");
+ diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, nCC.toRepresentedString(), project_wide_properties);
+ diagrams_[i] -> project() -> addFolioAutoNum(autonum,nCC.next());
+ diagrams_[i] -> update();
+ }
+}
+
+/**
@return un document XML representant le projet
*/
QDomDocument QETProject::toXml() {
@@ -1157,7 +1250,7 @@
m_default_xref_properties = XRefProperties:: defaultProperties();
//Read values indicate in project
- QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt, conds_autonums;
+ QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt, conds_autonums, folio_autonums;
for (QDomNode child = newdiagrams_elmt.firstChild() ; !child.isNull() ; child = child.nextSibling())
{
@@ -1176,6 +1269,8 @@
xref_elmt = child_elmt;
else if (child_elmt.tagName() == "conductors_autonums")
conds_autonums = child_elmt;
+ else if (child_elmt.tagName()== "folio_autonums")
+ folio_autonums = child_elmt;
}
// size, titleblock, conductor, report, conductor autonum
@@ -1201,6 +1296,15 @@
m_conductor_autonum.insert(elmt.attribute("title"), nc);
}
}
+ if (!folio_autonums.isNull())
+ {
+ foreach (QDomElement elmt, QET::findInDomElement(folio_autonums, "folio_autonum"))
+ {
+ NumerotationContext nc;
+ nc.fromXml(elmt);
+ m_folio_autonum.insert(elmt.attribute("title"), nc);
+ }
+ }
}
/**
@@ -1261,6 +1365,15 @@
conds_autonums.appendChild(cond_autonum);
}
xml_element.appendChild(conds_autonums);
+
+ //Export Folio Autonums
+ QDomElement folio_autonums = xml_document.createElement("folio_autonums");
+ foreach (QString key, folioAutoNum().keys()) {
+ QDomElement folio_autonum = folioAutoNum(key).toXml(xml_document, "folio_autonum");
+ folio_autonum.setAttribute("title", key);
+ folio_autonums.appendChild(folio_autonum);
+ }
+ xml_element.appendChild(folio_autonums);
}
/**
@@ -1416,7 +1529,17 @@
project_wide_properties.addValue("projecttitle", title());
for (int i = 0 ; i < total_folio ; ++ i) {
- diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, project_wide_properties);
+ QString title = diagrams_[i] -> title();
+ QString autopagenum = diagrams_[i]->border_and_titleblock.autoPageNum();
+ NumerotationContext nC = folioAutoNum(autopagenum);
+ NumerotationContextCommands nCC = NumerotationContextCommands(nC);
+ if((diagrams_[i]->border_and_titleblock.folio().contains("%autonum"))&&(!autopagenum.isNull())){
+ diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, nCC.toRepresentedString(), project_wide_properties);
+ diagrams_[i]->project()->addFolioAutoNum(autopagenum,nCC.next());
+ }
+ else{
+ diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, NULL, project_wide_properties);
+ }
diagrams_[i] -> update();
}
}
Modified: trunk/sources/qetproject.h
===================================================================
--- trunk/sources/qetproject.h 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/qetproject.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -115,12 +115,21 @@
void setDefaultXRefProperties(QHash <QString, XRefProperties> hash);
QHash <QString, NumerotationContext> conductorAutoNum() const;
+ QHash <QString, NumerotationContext> folioAutoNum() const;
void addConductorAutoNum (QString key, NumerotationContext context);
+ void addFolioAutoNum (QString key, NumerotationContext context);
void removeConductorAutonum (QString key);
+ void removeFolioAutoNum (QString key);
NumerotationContext conductorAutoNum(const QString &key) const;
+ NumerotationContext folioAutoNum(const QString &key) const;
bool autoConductor () const;
+ bool autoFolio () const;
void setAutoConductor (bool ac);
+ void setAutoFolio (bool af);
+ void autoFolioNumberingNewFolios ();
+ void autoFolioNumberingSelectedFolios(int, int, QString);
+
QDomDocument toXml();
bool close();
QETResult write();
@@ -162,6 +171,7 @@
void readOnlyChanged(QETProject *, bool);
void reportPropertiesChanged(QString);
void XRefPropertiesChanged ();
+ void addAutoNumDiagram();
private slots:
void updateDiagramsFolioData();
@@ -226,10 +236,12 @@
QUndoStack *undo_stack_;
/// Conductor auto numerotation
QHash <QString, NumerotationContext> m_conductor_autonum;
+ QHash <QString, NumerotationContext> m_folio_autonum;
/// Folio List Sheets quantity for this project.
int folioSheetsQuantity;
bool m_auto_conductor;
XmlElementCollection *m_elements_collection;
+ bool m_auto_folio;
};
Q_DECLARE_METATYPE(QETProject *)
#endif
Modified: trunk/sources/titleblockproperties.cpp
===================================================================
--- trunk/sources/titleblockproperties.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/titleblockproperties.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -48,6 +48,7 @@
ip.date == date &&\
ip.filename == filename &&\
ip.folio == folio &&\
+ ip.auto_page_num == auto_page_num &&\
ip.template_name == template_name &&\
ip.context == context &&\
ip.display_at == display_at &&\
@@ -73,6 +74,7 @@
e.setAttribute("title", title);
e.setAttribute("filename", filename);
e.setAttribute("folio", folio);
+ e.setAttribute("auto_page_num", auto_page_num);
e.setAttribute("date", exportDate());
e.setAttribute("displayAt", (display_at == Qt::BottomEdge? "bottom" : "right"));
if (!template_name.isEmpty())
@@ -98,6 +100,7 @@
if (e.hasAttribute("title")) title = e.attribute("title");
if (e.hasAttribute("filename")) filename = e.attribute("filename");
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"));
if (e.hasAttribute("displayAt")) display_at = (e.attribute("displayAt") == "bottom" ? Qt::BottomEdge : Qt::RightEdge);
@@ -126,6 +129,7 @@
settings.setValue(prefix + "author", author);
settings.setValue(prefix + "filename", filename);
settings.setValue(prefix + "folio", folio);
+ settings.setValue(prefix + "auto_page_num", auto_page_num);
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);
@@ -143,6 +147,7 @@
author = settings.value(prefix + "author").toString();
filename = settings.value(prefix + "filename").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());
display_at = (settings.value(prefix + "displayAt", QVariant("bottom")).toString() == "bottom" ? Qt::BottomEdge : Qt::RightEdge);
template_name = settings.value(prefix + "titleblocktemplate").toString();
Modified: trunk/sources/titleblockproperties.h
===================================================================
--- trunk/sources/titleblockproperties.h 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/titleblockproperties.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -53,6 +53,7 @@
QDate date; ///< Date (displayed by the default template)
QString filename; ///< Filename (displayed by the default template)
QString folio; ///< Folio information (displayed by the default template)
+ QString auto_page_num;
DateManagement useDate; ///< Wheter to use the date attribute
QString template_name; ///< Name of the template used to render the title block - an empty string means "the default template provided by the application"
DiagramContext context; ///< Container for the additional, user-defined fields
Modified: trunk/sources/ui/diagrampropertiesdialog.cpp
===================================================================
--- trunk/sources/ui/diagrampropertiesdialog.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/ui/diagrampropertiesdialog.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -55,12 +55,14 @@
//Title block widget
TitleBlockPropertiesWidget *titleblock_infos;
if (QETProject *parent_project = diagram -> project()) {
- titleblock_infos = new TitleBlockPropertiesWidget(parent_project -> embeddedTitleBlockTemplatesCollection(), titleblock, false, this);
+ titleblock_infos = new TitleBlockPropertiesWidget(parent_project -> embeddedTitleBlockTemplatesCollection(), titleblock, false, diagram->project(), this);
connect(titleblock_infos, SIGNAL(editTitleBlockTemplate(QString, bool)), diagram->views().first(), SIGNAL(editTitleBlockTemplate(QString, bool)));
}
else
- titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, this);
+ titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, diagram->project(), this);
titleblock_infos -> setReadOnly(diagram_is_read_only);
+ connect(titleblock_infos,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(editAutoFolioNum()));
+ titleblock_infos->setMinimumSize(590,480); //Minimum Size needed for correct display
//Conductor widget
ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(conductors, this);
@@ -124,7 +126,7 @@
/**
* @brief DiagramPropertiesDialog::editAutonum
- * Open the autonum editor
+ * Open conductor autonum editor
*/
void DiagramPropertiesDialog::editAutonum() {
ProjectPropertiesDialog ppd (m_diagram->project(), this);
@@ -132,3 +134,14 @@
ppd.exec();
m_asw -> setItems (m_diagram -> project() -> conductorAutoNum().keys());
}
+
+/**
+ * @brief DiagramPropertiesDialog::editAutonum
+ * Open folio autonum editor
+ */
+void DiagramPropertiesDialog::editAutoFolioNum () {
+ ProjectPropertiesDialog ppd (m_diagram->project(), this);
+ ppd.setCurrentPage(ProjectPropertiesDialog::Autonum);
+ ppd.changeToFolio();
+ ppd.exec();
+}
Modified: trunk/sources/ui/diagrampropertiesdialog.h
===================================================================
--- trunk/sources/ui/diagrampropertiesdialog.h 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/ui/diagrampropertiesdialog.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -37,6 +37,7 @@
public slots:
void editAutonum ();
+ void editAutoFolioNum ();
private:
Diagram *m_diagram;
Copied: trunk/sources/ui/folioautonumbering.cpp (from rev 4476, trunk/sources/ui/folioautonumbering.cpp)
===================================================================
--- trunk/sources/ui/folioautonumbering.cpp (rev 0)
+++ trunk/sources/ui/folioautonumbering.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -0,0 +1,218 @@
+/*
+ Copyright 2006-2015 The QElectroTech Team
+ This file is part of QElectroTech.
+
+ QElectroTech is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ QElectroTech is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "folioautonumbering.h"
+#include "ui_folioautonumbering.h"
+#include <QMessageBox>
+#include <QPushButton>
+#include <QtWidgets>
+#include "qdebug.h"
+#include "qetproject.h"
+#include "diagram.h"
+/**
+ * Constructor
+ */
+FolioAutonumberingW::FolioAutonumberingW(QETProject *project, QWidget *parent) :
+ QWidget(parent),
+ project_(project),
+ ui(new Ui::FolioAutonumberingW)
+
+{
+ ui->setupUi(this);
+ applyEnable(false);
+ ui->m_from_cb->setEnabled(false);
+ ui->m_new_tabs_sb->setEnabled(false);
+ ui->m_to_cb->setEnabled(false);
+}
+
+/**
+ * Destructor
+ */
+FolioAutonumberingW::~FolioAutonumberingW()
+{
+ delete ui;
+}
+
+/**
+ * @brief FolioAutonumberingW::setContext
+ * construct autonums in the comboBox selected in the @autonum_chooser QcomboBox
+ */
+void FolioAutonumberingW::setContext(QList <QString> autonums) {
+ foreach (QString str, autonums) { ui->m_autonums_cb->addItem(str);}
+}
+
+/**
+ * @brief FolioAutonumberingW::autoNumSelected
+ * returns the current autonum selected
+ */
+QString FolioAutonumberingW::autoNumSelected(){
+ return ui->m_autonums_cb->currentText();
+}
+
+/**
+ * @brief FolioAutonumberingW::fromFolio
+ * returns the current "From Folio" index
+ */
+int FolioAutonumberingW::fromFolio(){
+ return ui->m_from_cb->currentIndex()-1;
+}
+
+/**
+ * @brief FolioAutonumberingW::toFolio
+ * returns the current "To Folio" index
+ */
+int FolioAutonumberingW::toFolio(){
+ return ui->m_to_cb->currentIndex()+this->fromFolio()+1;
+}
+
+/**
+ * @brief FolioAutonumberingW::newFoliosNumber
+ * returns the number of folios to create
+ */
+int FolioAutonumberingW::newFoliosNumber(){
+ return ui->m_new_tabs_sb->value();
+}
+
+/**
+ * @brief FolioAutonumberingW::updateFolioList
+ * update Folio List in From and To ComboBox
+ */
+void FolioAutonumberingW::updateFolioList(){
+ ui -> m_from_cb->clear();
+ ui -> m_to_cb->clear();
+ if (newFolios){
+ this -> on_m_create_new_tabs_rb_clicked();
+ } else {
+ this -> on_m_autonumber_tabs_rb_clicked();
+ }
+}
+
+/**
+ * @brief FolioAutonumberingW::on_m_create_new_tabs_rb_clicked
+ * Enable New Tabs SpinBox
+ */
+void FolioAutonumberingW::on_m_create_new_tabs_rb_clicked() {
+ ui->m_from_cb->setEnabled(false);
+ ui->m_to_cb->setEnabled(false);
+ ui->m_new_tabs_sb->setEnabled(true);
+ applyEnable();
+ newFolios = true;
+}
+
+/**
+ * @brief FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked
+ * Enable From ComboBox, fill From ComboBox
+ */
+void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked() {
+ ui->m_new_tabs_sb->setEnabled(false);
+ ui->m_from_cb->setEnabled(true);
+ ui->m_to_cb->setEnabled(true);
+ if (ui->m_from_cb->count()<=0){
+ ui->m_from_cb->clear();
+ ui->m_from_cb->addItem("");
+ foreach (Diagram *diagram, project_->diagrams()){
+ ui->m_from_cb->addItem(diagram->title());
+ }
+ }
+ applyEnable();
+ newFolios = false;
+}
+
+/**
+ * @brief FolioAutonumberingW::on_m_new_tabs_sb_valueChanged
+ * Enable Apply if any new folio is to be created
+ */
+void FolioAutonumberingW::on_m_new_tabs_sb_valueChanged(){
+ if (ui->m_new_tabs_sb->value()>0) applyEnable(true);
+ else applyEnable(false);
+}
+
+/**
+ * @brief FolioAutonumberingW::on_m_from_cb_currentIndexChanged
+ * Enable To ComboBox
+ */
+void FolioAutonumberingW::on_m_from_cb_currentIndexChanged(){
+ int index = ui->m_from_cb->currentIndex();
+ ui->m_to_cb->clear();
+ if (index > 0){
+ ui->m_to_cb->setEnabled(true);
+ for (int i=index;i<project_->diagrams().size();i++)
+ ui->m_to_cb->addItem(project_->diagrams().at(i)->title());
+ applyEnable(true);
+ }
+ else{
+ applyEnable();
+ }
+
+}
+
+/**
+ * @brief SelectAutonumW::on_buttonBox_clicked
+ * Action on @buttonBox clicked
+ */
+void FolioAutonumberingW::on_buttonBox_clicked(QAbstractButton *button) {
+ //transform button to int
+ int answer = ui -> buttonBox -> buttonRole(button);
+
+ switch (answer) {
+ //help dialog - not implemented yet -
+ case QDialogButtonBox::HelpRole:
+ break;
+ /*QMessageBox::information (this, tr("Folio Autonumbering", "title window"),
+ tr("C'est ici que vous pouvez définir la manière dont sera numéroté les nouveaux conducteurs.\n"
+ "-Une numérotation est composée d'une variable minimum.\n"
+ "-Vous pouvez ajouter ou supprimer une variable de numérotation par le biais des boutons - et +.\n"
+ "-Une variable de numérotation comprant: un type, une valeur et une incrémentation.\n"
+
+ "\n-les types \"Chiffre 1\", \"Chiffre 01\" et \"Chiffre 001\", représente un type numérique définie dans le champs \"Valeur\", "
+ "qui s'incrémente à chaque nouveau conducteur de la valeur du champ \"Incrémentation\".\n"
+ "-\"Chiffre 01\" et \"Chiffre 001\", sont respectivement représenté sur le schéma par deux et trois digits minimum.\n"
+ "Si le chiffre définie dans le champs Valeur posséde moins de digits que le type choisit,"
+ "celui-ci sera précédé par un ou deux 0 afin de respecter son type.\n"
+
+ "\n-Le type \"Texte\", représente un texte fixe.\nLe champs \"Incrémentation\" n'est pas utilisé.\n"
+
+ "\n-Le type \"N° folio\" représente le n° du folio en cours.\nLes autres champs ne sont pas utilisés.",
+ "help dialog about the autonumerotation")); */
+ case QDialogButtonBox::ApplyRole:
+ applyEnable(true);
+ emit applyPressed();
+ updateFolioList();
+ break;
+ }
+}
+
+/**
+ * @brief SelectAutonumW::applyEnable
+ * enable/disable the apply button
+ */
+void FolioAutonumberingW::applyEnable(bool b) {
+ if (b){
+ bool valid = true;
+ if (ui->m_create_new_tabs_rb->isChecked()){
+ if (ui->m_new_tabs_sb->value()==0) valid = false;
+ ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(valid);
+ }
+ else{
+ if (ui->m_to_cb->currentText()=="") valid = false;
+ ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(valid);
+ }
+ }
+ else{
+ ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(b);
+ }
+}
Copied: trunk/sources/ui/folioautonumbering.h (from rev 4476, trunk/sources/ui/folioautonumbering.h)
===================================================================
--- trunk/sources/ui/folioautonumbering.h (rev 0)
+++ trunk/sources/ui/folioautonumbering.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -0,0 +1,72 @@
+/*
+ Copyright 2006-2015 The QElectroTech Team
+ This file is part of QElectroTech.
+
+ QElectroTech is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ QElectroTech is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef FOLIOAUTONUMBERING_H
+#define FOLIOAUTONUMBERING_H
+
+#include <QWidget>
+#include "numerotationcontext.h"
+
+class NumPartEditorW;
+class QAbstractButton;
+class QETProject;
+
+namespace Ui {
+ class FolioAutonumberingW;
+}
+
+class FolioAutonumberingW : public QWidget
+{
+ Q_OBJECT
+
+ //METHODS
+ public:
+ explicit FolioAutonumberingW(QETProject *project, QWidget *parent = 0);
+ ~FolioAutonumberingW();
+
+ void setContext (QList <QString> autonums);
+ NumerotationContext toNumContext() const;
+ QString autoNumSelected();
+ int newFoliosNumber();
+ bool newFolios;
+ int fromFolio();
+ int toFolio();
+
+ // SIGNALS
+ signals:
+ void applyPressed();
+ void m_autonumber_tabs_rb_clicked();
+
+ //SLOTS
+ private slots:
+ void on_m_create_new_tabs_rb_clicked();
+ void on_m_autonumber_tabs_rb_clicked();
+ void on_m_new_tabs_sb_valueChanged();
+ void on_buttonBox_clicked(QAbstractButton *);
+ void on_m_from_cb_currentIndexChanged();
+ void applyEnable (bool = true);
+
+ //ATTRIBUTES
+ private:
+ QETProject *project_;
+ Ui::FolioAutonumberingW *ui;
+ QList <NumPartEditorW *> num_part_list_;
+ NumerotationContext m_context;
+ void updateFolioList();
+};
+
+#endif // FOLIOAUTONUMBERING_H
Copied: trunk/sources/ui/folioautonumbering.ui (from rev 4476, trunk/sources/ui/folioautonumbering.ui)
===================================================================
--- trunk/sources/ui/folioautonumbering.ui (rev 0)
+++ trunk/sources/ui/folioautonumbering.ui 2016-05-13 15:00:22 UTC (rev 4478)
@@ -0,0 +1,295 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FolioAutonumberingW</class>
+ <widget class="QWidget" name="FolioAutonumberingW">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>467</width>
+ <height>550</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>460</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>50</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>450</width>
+ <height>253</height>
+ </size>
+ </property>
+ <property name="sizeIncrement">
+ <size>
+ <width>0</width>
+ <height>50</height>
+ </size>
+ </property>
+ <property name="mouseTracking">
+ <bool>false</bool>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="verticalScrollBarPolicy">
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QAbstractScrollArea::AdjustToContents</enum>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignHCenter|Qt::AlignTop</set>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>448</width>
+ <height>497</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>430</width>
+ <height>250</height>
+ </size>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
+ <item row="2" column="1" colspan="2">
+ <widget class="QGroupBox" name="Options">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Numbering Options</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="2" column="1">
+ <widget class="QComboBox" name="m_to_cb">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QComboBox::AdjustToContents</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>New Tabs</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="m_from_cb">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QComboBox::AdjustToContents</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="m_new_tabs_sb">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ <property name="displayIntegerBase">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>To</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>From</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="1" colspan="2">
+ <widget class="QGroupBox" name="Select">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Select:</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QRadioButton" name="m_create_new_tabs_rb">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Create New Tabs</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="m_autonumber_tabs_rb">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Autonumber Selected Tabs</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Folio Auto Numbering:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QComboBox" name="m_autonums_cb">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QComboBox::AdjustToContents</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" colspan="2">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Apply|QDialogButtonBox::Help|QDialogButtonBox::Reset</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Modified: trunk/sources/ui/projectpropertiesdialog.cpp
===================================================================
--- trunk/sources/ui/projectpropertiesdialog.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/ui/projectpropertiesdialog.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -28,11 +28,18 @@
* @param parent : parent widget of this dialog
*/
ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *parent) {
+ NewDiagramPage *newDiagramPage = new NewDiagramPage(project,parent,this);
+ ProjectAutoNumConfigPage *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project);
m_properties_dialog = new ConfigDialog (parent);
m_properties_dialog -> setWindowTitle(QObject::tr("Propriétés du projet", "window title"));
m_properties_dialog -> addPage(new ProjectMainConfigPage (project));
- m_properties_dialog -> addPage(new NewDiagramPage (project));
- m_properties_dialog -> addPage(new ProjectAutoNumConfigPage (project));
+ m_properties_dialog -> addPage(newDiagramPage);
+ m_properties_dialog -> addPage(projectAutoNumConfigPage);
+ connect(projectAutoNumConfigPage,SIGNAL(setAutoNum(QString)),newDiagramPage,SLOT(setFolioAutonum(QString)));
+ connect(projectAutoNumConfigPage,SIGNAL(saveCurrentTbp()),newDiagramPage,SLOT(saveCurrentTbp()));
+ connect(projectAutoNumConfigPage,SIGNAL(loadSavedTbp()),newDiagramPage,SLOT(loadSavedTbp()));
+ m_properties_dialog->setMinimumHeight(690);
+
}
/**
@@ -58,3 +65,12 @@
void ProjectPropertiesDialog::setCurrentPage(ProjectPropertiesDialog::Page p) {
m_properties_dialog -> setCurrentPage(static_cast <int> (p));
}
+
+/**
+ * @brief ProjectPropertiesDialog::changeToFolio
+ * Change the current displayed tab to folio tab.
+ */
+void ProjectPropertiesDialog::changeToFolio() {
+ ProjectAutoNumConfigPage *autoNumPage = static_cast <ProjectAutoNumConfigPage*>(m_properties_dialog->pages.at(2));
+ autoNumPage->changeToTab(1);
+}
Modified: trunk/sources/ui/projectpropertiesdialog.h
===================================================================
--- trunk/sources/ui/projectpropertiesdialog.h 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/ui/projectpropertiesdialog.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -17,6 +17,7 @@
*/
#ifndef PROJECTPROPERTIESDIALOG_H
#define PROJECTPROPERTIESDIALOG_H
+#include <QtCore>
class QETProject;
class QWidget;
@@ -26,8 +27,7 @@
* @brief The ProjectPropertiesDialog class
* this class builds a dialog to edit whole properties of a project
*/
-class ProjectPropertiesDialog
-{
+class ProjectPropertiesDialog : public QObject {
public:
enum Page {
Main = 0,
@@ -39,6 +39,7 @@
~ProjectPropertiesDialog();
void exec();
void setCurrentPage(ProjectPropertiesDialog::Page);
+ void changeToFolio();
private:
ConfigDialog *m_properties_dialog;
Modified: trunk/sources/ui/selectautonumw.ui
===================================================================
--- trunk/sources/ui/selectautonumw.ui 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/ui/selectautonumw.ui 2016-05-13 15:00:22 UTC (rev 4478)
@@ -6,183 +6,289 @@
<rect>
<x>0</x>
<y>0</y>
- <width>432</width>
- <height>273</height>
+ <width>466</width>
+ <height>506</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QGroupBox" name="definition_groupe">
- <property name="title">
- <string>Définition</string>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <property name="minimumSize">
+ <size>
+ <width>430</width>
+ <height>455</height>
+ </size>
+ </property>
+ <property name="sizeIncrement">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="mouseTracking">
+ <bool>false</bool>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="verticalScrollBarPolicy">
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QAbstractScrollArea::AdjustToContents</enum>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>460</width>
+ <height>453</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>460</width>
+ <height>450</height>
+ </size>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="definition_groupe">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Définition</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="remove_button">
- <property name="toolTip">
- <string><html><head/><body><p>Supprimer une variable de numérotation</p></body></html></string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../qelectrotech.qrc">
- <normaloff>:/ico/22x22/list-remove.png</normaloff>:/ico/22x22/list-remove.png</iconset>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="add_button">
- <property name="toolTip">
- <string><html><head/><body><p>Ajouter une variable de numérotation</p></body></html></string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../qelectrotech.qrc">
- <normaloff>:/ico/22x22/list-add.png</normaloff>:/ico/22x22/list-add.png</iconset>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="m_previous_pb">
- <property name="toolTip">
- <string>Précédent</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../qelectrotech.qrc">
- <normaloff>:/ico/16x16/arrow-left.png</normaloff>:/ico/16x16/arrow-left.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="m_next_pb">
- <property name="toolTip">
- <string>Suivant</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../qelectrotech.qrc">
- <normaloff>:/ico/16x16/arrow-right.png</normaloff>:/ico/16x16/arrow-right.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="editor_layout">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <layout class="QHBoxLayout" name="label_layout">
- <property name="spacing">
- <number>0</number>
- </property>
<item>
- <widget class="QLabel" name="type_label">
- <property name="text">
- <string>Type</string>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="spacing">
+ <number>0</number>
</property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
</property>
- </widget>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="remove_button">
+ <property name="toolTip">
+ <string><html><head/><body><p>Supprimer une variable de numérotation</p></body></html></string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../qelectrotech.qrc">
+ <normaloff>:/ico/22x22/list-remove.png</normaloff>:/ico/22x22/list-remove.png</iconset>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="add_button">
+ <property name="toolTip">
+ <string><html><head/><body><p>Ajouter une variable de numérotation</p></body></html></string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../qelectrotech.qrc">
+ <normaloff>:/ico/22x22/list-add.png</normaloff>:/ico/22x22/list-add.png</iconset>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_previous_pb">
+ <property name="toolTip">
+ <string>Précédent</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../qelectrotech.qrc">
+ <normaloff>:/ico/16x16/arrow-left.png</normaloff>:/ico/16x16/arrow-left.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_next_pb">
+ <property name="toolTip">
+ <string>Suivant</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../qelectrotech.qrc">
+ <normaloff>:/ico/16x16/arrow-right.png</normaloff>:/ico/16x16/arrow-right.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</item>
<item>
- <widget class="QLabel" name="value_label">
- <property name="text">
- <string>Valeur</string>
+ <layout class="QVBoxLayout" name="editor_layout" stretch="0">
+ <property name="spacing">
+ <number>0</number>
</property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
</property>
- </widget>
+ <item>
+ <layout class="QHBoxLayout" name="label_layout" stretch="0,0,0">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
+ <item>
+ <widget class="QLabel" name="type_label">
+ <property name="text">
+ <string>Type</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="value_label">
+ <property name="text">
+ <string>Valeur</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="increase_label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Incrémentation</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</item>
<item>
- <widget class="QLabel" name="increase_label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <property name="text">
- <string>Incrémentation</string>
+ <property name="sizeType">
+ <enum>QSizePolicy::MinimumExpanding</enum>
</property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
</property>
- </widget>
+ </spacer>
</item>
</layout>
- </item>
- </layout>
- </item>
- </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</widget>
</item>
<item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Help|QDialogButtonBox::Reset</set>
</property>
Modified: trunk/sources/ui/titleblockpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/titleblockpropertieswidget.cpp 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/ui/titleblockpropertieswidget.cpp 2016-05-13 15:00:22 UTC (rev 4478)
@@ -29,13 +29,13 @@
* @param current_date if true, display the radio button "current date"
* @param parent parent widget
*/
-TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) :
+TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock, bool current_date, QETProject *project, QWidget *parent) :
QWidget(parent),
ui(new Ui::TitleBlockPropertiesWidget)
{
ui->setupUi(this);
- initDialog(current_date);
- setProperties(titleblock);
+ initDialog(current_date, project);
+ setProperties(titleblock);
}
/**
@@ -46,12 +46,12 @@
* @param current_date if true, display the radio button "current date"
* @param parent parent widget
*/
-TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) :
+TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QETProject *project, QWidget *parent) :
QWidget(parent),
ui(new Ui::TitleBlockPropertiesWidget)
{
ui->setupUi(this);
- initDialog(current_date);
+ initDialog(current_date,project);
addCollection(tbt_collection);
updateTemplateList();
setProperties(titleblock);
@@ -65,12 +65,12 @@
* @param current_date if true, display the radio button "current date"
* @param parent parent widget
*/
-TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(QList<TitleBlockTemplatesCollection *> tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) :
+TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(QList<TitleBlockTemplatesCollection *> tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QETProject *project, QWidget *parent) :
QWidget(parent),
ui(new Ui::TitleBlockPropertiesWidget)
{
ui->setupUi(this);
- initDialog(current_date);
+ initDialog(current_date,project);
foreach (TitleBlockTemplatesCollection *c, tbt_collection)
addCollection(c);
updateTemplateList();
@@ -96,6 +96,7 @@
ui -> m_file_le -> setText (properties.filename);
ui -> m_folio_le -> setText (properties.folio);
ui -> m_display_at_cb -> setCurrentIndex(properties.display_at == Qt::BottomEdge ? 0 : 1);
+ ui->auto_page_cb->setCurrentText(properties.auto_page_num);
//About date
ui -> m_date_now_pb -> setDisabled(true);
@@ -172,10 +173,50 @@
prop.context = m_dcw -> context();
+ prop.auto_page_num = ui->auto_page_cb->currentText();
+
return prop;
}
/**
+ * @brief TitleBlockPropertiesWidget::properties
+ * @return return properties to enable folio autonum
+ */
+TitleBlockProperties TitleBlockPropertiesWidget::propertiesAutoNum(QString autoNum) const {
+ TitleBlockProperties prop;
+ prop.title = ui -> m_title_le -> text();
+ prop.author = ui -> m_author_le -> text();
+ prop.filename = ui -> m_file_le -> text();
+ prop.folio = "%autonum";
+ prop.display_at = ui -> m_display_at_cb -> currentIndex() == 0 ? Qt::BottomEdge : Qt::RightEdge;
+
+ if (ui->m_no_date_rb->isChecked()) {
+ prop.useDate = TitleBlockProperties::UseDateValue;
+ prop.date = QDate();
+ }
+ else if (ui -> m_fixed_date_rb -> isChecked()) {
+ prop.useDate = TitleBlockProperties::UseDateValue;
+ prop.date = ui->m_date_edit->date();
+ }
+ else if (ui->m_current_date_rb->isVisible() && ui->m_current_date_rb->isChecked()) {
+ prop.useDate = TitleBlockProperties::CurrentDate;
+ prop.date = QDate::currentDate();
+ }
+
+ if (!currentTitleBlockTemplateName().isEmpty())
+ {
+ prop.template_name = currentTitleBlockTemplateName();
+ prop.collection = m_map_index_to_collection_type.at(ui->m_tbt_cb->currentIndex());
+ }
+
+ prop.context = m_dcw -> context();
+
+ prop.auto_page_num = autoNum;
+
+ return prop;
+}
+
+/**
* @brief TitleBlockPropertiesWidget::setTitleBlockTemplatesVisible
* if true, title block template combo box and menu button is visible
*/
@@ -220,7 +261,7 @@
* Init this dialog
* @param current_date true for display current date radio button
*/
-void TitleBlockPropertiesWidget::initDialog(const bool ¤t_date) {
+void TitleBlockPropertiesWidget::initDialog(const bool ¤t_date, QETProject *project) {
m_dcw = new DiagramContextWidget();
ui -> m_tab2_vlayout -> addWidget(m_dcw);
@@ -239,6 +280,19 @@
ui -> m_tbt_pb -> setMenu(m_tbt_menu);
connect(ui->m_tbt_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentTitleBlockTemplate(int)));
+
+ if (project!= NULL){
+ keys_2 = project -> folioAutoNum().keys();
+ foreach (QString str, keys_2) { ui -> auto_page_cb -> addItem(str); }
+ if (ui->auto_page_cb->currentText()==NULL)
+ ui->auto_page_cb->addItem("Create an Auto Folio Numbering");
+ }
+ else{
+ ui->auto_page_cb->hide();
+ ui->m_edit_autofolionum_pb->hide();
+ ui->label_9->hide();
+ }
+
}
/**
@@ -342,3 +396,15 @@
void TitleBlockPropertiesWidget::on_m_date_now_pb_clicked() {
ui -> m_date_edit -> setDate(QDate::currentDate());
}
+
+/**
+ * @brief TitleBlockPropertiesWidget::on_m_edit_autofolionum_pb_clicked
+ * Open Auto Folio Num dialog
+ */
+void TitleBlockPropertiesWidget::on_m_edit_autofolionum_pb_clicked() {
+ emit openAutoNumFolioEditor(ui->auto_page_cb->currentText());
+ if (ui->auto_page_cb->currentText()!="Create an Auto Folio Numbering")
+ {
+ //still to implement: load current auto folio num settings
+ }
+}
Modified: trunk/sources/ui/titleblockpropertieswidget.h
===================================================================
--- trunk/sources/ui/titleblockpropertieswidget.h 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/ui/titleblockpropertieswidget.h 2016-05-13 15:00:22 UTC (rev 4478)
@@ -18,11 +18,15 @@
#ifndef TITLEBLOCKPROPERTIESWIDGET_H
#define TITLEBLOCKPROPERTIESWIDGET_H
+#include "qetproject.h"
#include <QWidget>
#include "titleblockproperties.h"
#include "diagramcontextwidget.h"
#include "qet.h"
+#include "numerotationcontext.h"
+class NumerotationContext;
+class QETProject;
class QMenu;
class TitleBlockTemplatesCollection;
@@ -35,13 +39,15 @@
Q_OBJECT
public:
- explicit TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0);
- explicit TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0);
- explicit TitleBlockPropertiesWidget(QList <TitleBlockTemplatesCollection *> tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0);
+ explicit TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QETProject *project = NULL, QWidget *parent = 0);
+ explicit TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QETProject *project = NULL, QWidget *parent = 0);
+ explicit TitleBlockPropertiesWidget(QList <TitleBlockTemplatesCollection *> tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QETProject *project = NULL, QWidget *parent = 0);
~TitleBlockPropertiesWidget();
void setProperties(const TitleBlockProperties &properties);
TitleBlockProperties properties() const;
+ TitleBlockProperties propertiesAutoNum(QString autoNum) const;
+ void setPropertiesWithAutoNum(const TitleBlockProperties &properties, QString autoNum);
void setTitleBlockTemplatesVisible(const bool &visible);
void setReadOnly (const bool &ro);
@@ -49,7 +55,7 @@
private:
void addCollection (TitleBlockTemplatesCollection *tbt_collection);
QString currentTitleBlockTemplateName () const;
- void initDialog(const bool ¤t_date);
+ void initDialog(const bool ¤t_date, QETProject *project);
int getIndexFor (const QString &tbt_name, const QET::QetCollection collection) const;
private slots:
@@ -58,9 +64,12 @@
void updateTemplateList();
void changeCurrentTitleBlockTemplate(int);
void on_m_date_now_pb_clicked();
+ void on_m_edit_autofolionum_pb_clicked();
signals:
void editTitleBlockTemplate(const QString &, bool);
+ void set_auto_page_num() const;
+ void openAutoNumFolioEditor (QString);
private:
Ui::TitleBlockPropertiesWidget *ui;
@@ -69,6 +78,7 @@
QMenu *m_tbt_menu;
QList <TitleBlockTemplatesCollection *> m_tbt_collection_list;
QList <QET::QetCollection> m_map_index_to_collection_type;
+ QList <QString> keys_2;
};
#endif // TITLEBLOCKPROPERTIESWIDGET_H
Modified: trunk/sources/ui/titleblockpropertieswidget.ui
===================================================================
--- trunk/sources/ui/titleblockpropertieswidget.ui 2016-05-13 13:48:36 UTC (rev 4477)
+++ trunk/sources/ui/titleblockpropertieswidget.ui 2016-05-13 15:00:22 UTC (rev 4478)
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>530</width>
- <height>452</height>
+ <width>572</width>
+ <height>590</height>
</rect>
</property>
<property name="sizePolicy">
@@ -33,256 +33,316 @@
<number>9</number>
</property>
<item>
- <widget class="QGroupBox" name="m_tbt_gb">
- <property name="title">
- <string>Informations des cartouches</string>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="widgetResizable">
+ <bool>true</bool>
</property>
- <property name="checkable">
- <bool>false</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <layout class="QHBoxLayout" name="m_tbt_hlayout" stretch="0,1,0">
- <property name="sizeConstraint">
- <enum>QLayout::SetDefaultConstraint</enum>
- </property>
- <item>
- <widget class="QLabel" name="m_tbt_label">
- <property name="text">
- <string>Modèle :</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="m_tbt_cb"/>
- </item>
- <item>
- <widget class="QPushButton" name="m_tbt_pb">
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../qelectrotech.qrc">
- <normaloff>:/ico/16x16/label.png</normaloff>:/ico/16x16/label.png</iconset>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="tabPosition">
- <enum>QTabWidget::South</enum>
- </property>
- <property name="tabShape">
- <enum>QTabWidget::Rounded</enum>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <property name="elideMode">
- <enum>Qt::ElideNone</enum>
- </property>
- <property name="usesScrollButtons">
- <bool>true</bool>
- </property>
- <property name="tabsClosable">
- <bool>false</bool>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Principales</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <widget class="QWidget" name="scrollAreaWidgetContents_1">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>552</width>
+ <height>570</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QGroupBox" name="m_tbt_gb">
+ <property name="title">
+ <string>Informations des cartouches</string>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="5" column="2">
- <widget class="QLineEdit" name="m_folio_le">
- <property name="toolTip">
- <string>Disponible en tant que %folio pour les modèles de cartouches</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="label_3">
+ <layout class="QHBoxLayout" name="m_tbt_hlayout" stretch="0,1,0">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
+ <item>
+ <widget class="QLabel" name="m_tbt_label">
<property name="text">
- <string>Auteur :</string>
+ <string>Modèle :</string>
</property>
</widget>
</item>
- <item row="7" column="1">
- <widget class="QLabel" name="label">
+ <item>
+ <widget class="QComboBox" name="m_tbt_cb"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_tbt_pb">
<property name="text">
- <string>Afficher :</string>
+ <string/>
</property>
- </widget>
- </item>
- <item row="6" column="2">
- <widget class="QLabel" name="label_7">
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
+ <property name="icon">
+ <iconset resource="../../qelectrotech.qrc">
+ <normaloff>:/ico/16x16/label.png</normaloff>:/ico/16x16/label.png</iconset>
</property>
- <property name="text">
- <string>Les variables suivantes sont utilisables dans le champ Folio :
-- %id : numéro du folio courant dans le projet
-- %total : nombre total de folios dans le projet</string>
- </property>
- <property name="scaledContents">
+ <property name="flat">
<bool>false</bool>
</property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
</widget>
</item>
- <item row="3" column="2">
- <layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,0">
- <item row="0" column="0">
- <widget class="QRadioButton" name="m_no_date_rb">
- <property name="text">
- <string>Pas de date</string>
- </property>
- </widget>
+ </layout>
+ </item>
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="tabPosition">
+ <enum>QTabWidget::South</enum>
+ </property>
+ <property name="tabShape">
+ <enum>QTabWidget::Rounded</enum>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <property name="elideMode">
+ <enum>Qt::ElideNone</enum>
+ </property>
+ <property name="usesScrollButtons">
+ <bool>true</bool>
+ </property>
+ <property name="tabsClosable">
+ <bool>false</bool>
+ </property>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>Principales</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="4" column="1">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Fichier :</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="2">
+ <widget class="QLabel" name="label_7">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>Les variables suivantes sont utilisables dans le champ Folio :
+- %id : numéro du folio courant dans le projet
+- %total : nombre total de folios dans le projet
+- %autonum : Folio Auto Numeration</string>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Date :</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Folio :</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Titre :</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2">
+ <widget class="QLineEdit" name="m_folio_le">
+ <property name="toolTip">
+ <string>Disponible en tant que %folio pour les modèles de cartouches</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLineEdit" name="m_title_le">
+ <property name="toolTip">
+ <string>Disponible en tant que %title pour les modèles de cartouches</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="2">
+ <widget class="QComboBox" name="m_display_at_cb">
+ <property name="toolTip">
+ <string><html><head/><body><p>Affiche le cartouche en bas (horizontalement) ou à droite (verticalement) du folio.</p></body></html></string>
+ </property>
+ <item>
+ <property name="text">
+ <string>en bas</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>à droite (expérimental)</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="4" column="2">
+ <widget class="QLineEdit" name="m_file_le">
+ <property name="toolTip">
+ <string>Disponible en tant que %filename pour les modèles de cartouches</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Auteur :</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,0">
+ <item row="0" column="0">
+ <widget class="QRadioButton" name="m_no_date_rb">
+ <property name="text">
+ <string>Pas de date</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QRadioButton" name="m_current_date_rb">
+ <property name="text">
+ <string>Date courante</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QPushButton" name="m_date_now_pb">
+ <property name="toolTip">
+ <string>Appliquer la date actuelle</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../qelectrotech.qrc">
+ <normaloff>:/ico/22x22/start.png</normaloff>:/ico/22x22/start.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QDateEdit" name="m_date_edit">
+ <property name="toolTip">
+ <string>Disponible en tant que %date pour les modèles de cartouches</string>
+ </property>
+ <property name="frame">
+ <bool>true</bool>
+ </property>
+ <property name="calendarPopup">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QRadioButton" name="m_fixed_date_rb">
+ <property name="text">
+ <string>Date fixe :</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLineEdit" name="m_author_le">
+ <property name="toolTip">
+ <string>Disponible en tant que %author pour les modèles de cartouches</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="1">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Afficher :</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="2">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QComboBox" name="auto_page_cb">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QPushButton" name="m_edit_autofolionum_pb">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../qelectrotech.qrc">
+ <normaloff>:/ico/16x16/configure.png</normaloff>:/ico/16x16/configure.png</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="7" column="1">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Page Num:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="1" column="0">
- <widget class="QRadioButton" name="m_current_date_rb">
- <property name="text">
- <string>Date courante</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QPushButton" name="m_date_now_pb">
- <property name="toolTip">
- <string>Appliquer la date actuelle</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../qelectrotech.qrc">
- <normaloff>:/ico/22x22/start.png</normaloff>:/ico/22x22/start.png</iconset>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QDateEdit" name="m_date_edit">
- <property name="toolTip">
- <string>Disponible en tant que %date pour les modèles de cartouches</string>
- </property>
- <property name="frame">
- <bool>true</bool>
- </property>
- <property name="calendarPopup">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QRadioButton" name="m_fixed_date_rb">
- <property name="text">
- <string>Date fixe :</string>
- </property>
- </widget>
- </item>
</layout>
- </item>
- <item row="3" column="1">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Date :</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Fichier :</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QLineEdit" name="m_title_le">
- <property name="toolTip">
- <string>Disponible en tant que %title pour les modèles de cartouches</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Titre :</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QLineEdit" name="m_author_le">
- <property name="toolTip">
- <string>Disponible en tant que %author pour les modèles de cartouches</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Folio :</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="QLineEdit" name="m_file_le">
- <property name="toolTip">
- <string>Disponible en tant que %filename pour les modèles de cartouches</string>
- </property>
- </widget>
- </item>
- <item row="7" column="2">
- <widget class="QComboBox" name="m_display_at_cb">
- <property name="toolTip">
- <string><html><head/><body><p>Affiche le cartouche en bas (horizontalement) ou à droite (verticalement) du folio.</p></body></html></string>
- </property>
+ </widget>
+ <widget class="QWidget" name="tab_2">
+ <attribute name="title">
+ <string>Personnalisées</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <property name="text">
- <string>en bas</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>à droite (expérimental)</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_2">
- <attribute name="title">
- <string>Personnalisées</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QVBoxLayout" name="m_tab2_vlayout">
- <item>
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Vous pouvez définir ici vos propres associations noms/valeurs pour que le cartouche en tienne compte. Exemple :
+ <layout class="QVBoxLayout" name="m_tab2_vlayout">
+ <item>
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>Vous pouvez définir ici vos propres associations noms/valeurs pour que le cartouche en tienne compte. Exemple :
associer le nom "volta" et la valeur "1745" remplacera %{volta} par 1745 dans le cartouche.</string>
</property>
<property name="wordWrap">
@@ -301,6 +361,10 @@
</item>
</layout>
</widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
<resources>
<include location="../../qelectrotech.qrc"/>
</resources>