mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 06:20:53 +01:00
Auto Folio Numbering - Create specific number of new folios with a folio autonumbering or Auto Number selected Folios
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4488 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -19,8 +19,8 @@
|
|||||||
#define CONFIG_PAGES_H
|
#define CONFIG_PAGES_H
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#include "configpage.h"
|
#include "configpage.h"
|
||||||
#include "projectpropertiesdialog.h" //davi
|
#include "projectpropertiesdialog.h"
|
||||||
#include "titleblockpropertieswidget.h" //davi
|
#include "titleblockpropertieswidget.h"
|
||||||
class BorderPropertiesWidget;
|
class BorderPropertiesWidget;
|
||||||
class ConductorPropertiesWidget;
|
class ConductorPropertiesWidget;
|
||||||
class TitleBlockPropertiesWidget;
|
class TitleBlockPropertiesWidget;
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ QStringList NumerotationContext::itemAt(const int i) const {
|
|||||||
* @return all type use to numerotation
|
* @return all type use to numerotation
|
||||||
*/
|
*/
|
||||||
QString NumerotationContext::validRegExpNum () const {
|
QString NumerotationContext::validRegExpNum () const {
|
||||||
return ("unit|ten|hundred|string|folio");
|
return ("unit|ten|hundred|string|idfolio|folio");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -104,7 +104,11 @@ void NumerotationContextCommands::setNumStrategy(const QString &str) {
|
|||||||
strategy_ = new StringNum (diagram_);
|
strategy_ = new StringNum (diagram_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (str == "folio") {
|
else if (str == "idfolio") {
|
||||||
|
strategy_ = new IdFolioNum (diagram_);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (str=="folio"){
|
||||||
strategy_ = new FolioNum (diagram_);
|
strategy_ = new FolioNum (diagram_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -291,6 +295,37 @@ NumerotationContext StringNum::previous(const NumerotationContext &nc, const int
|
|||||||
return (nextString(nc, i));
|
return (nextString(nc, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
IdFolioNum::IdFolioNum (Diagram *d):
|
||||||
|
NumStrategy (d)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief IdFolioNum::toRepresentedString
|
||||||
|
* @return the represented string of num
|
||||||
|
*/
|
||||||
|
QString IdFolioNum::toRepresentedString(const QString str) const {
|
||||||
|
Q_UNUSED(str);
|
||||||
|
return (QString::number(diagram_ -> folioIndex() + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief IdFolioNum::next
|
||||||
|
* @return the next NumerotationContext nc at position i
|
||||||
|
*/
|
||||||
|
NumerotationContext IdFolioNum::next (const NumerotationContext &nc, const int i) const {
|
||||||
|
return (nextString(nc, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief IdFolioNum::previous
|
||||||
|
* @return the previous NumerotationContext nc at posiiton i
|
||||||
|
*/
|
||||||
|
NumerotationContext IdFolioNum::previous(const NumerotationContext &nc, const int i) const {
|
||||||
|
return (nextString(nc, i));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@@ -301,11 +336,11 @@ FolioNum::FolioNum (Diagram *d):
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief FolioNum::toRepresentedString
|
* @brief FolioNum::toRepresentedString
|
||||||
* @return the represented string of num
|
* @return the represented string of folio
|
||||||
*/
|
*/
|
||||||
QString FolioNum::toRepresentedString(const QString str) const {
|
QString FolioNum::toRepresentedString(const QString str) const {
|
||||||
Q_UNUSED(str);
|
Q_UNUSED(str);
|
||||||
return (QString::number(diagram_ -> folioIndex() + 1));
|
return (diagram_->border_and_titleblock.folio());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -96,6 +96,15 @@ class StringNum: public NumStrategy
|
|||||||
NumerotationContext previous (const NumerotationContext &, const int) const;
|
NumerotationContext previous (const NumerotationContext &, const int) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class IdFolioNum: public NumStrategy
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IdFolioNum (Diagram *);
|
||||||
|
QString toRepresentedString(const QString) const;
|
||||||
|
NumerotationContext next (const NumerotationContext &, const int) const;
|
||||||
|
NumerotationContext previous (const NumerotationContext &, const int) const;
|
||||||
|
};
|
||||||
|
|
||||||
class FolioNum: public NumStrategy
|
class FolioNum: public NumStrategy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -104,5 +113,4 @@ class FolioNum: public NumStrategy
|
|||||||
NumerotationContext next (const NumerotationContext &, const int) const;
|
NumerotationContext next (const NumerotationContext &, const int) const;
|
||||||
NumerotationContext previous (const NumerotationContext &, const int) const;
|
NumerotationContext previous (const NumerotationContext &, const int) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NUMEROTATIONCONTEXTCOMMANDS_H
|
#endif // NUMEROTATIONCONTEXTCOMMANDS_H
|
||||||
|
|||||||
@@ -159,10 +159,10 @@ QString ProjectMainConfigPage::projectTitle() const {
|
|||||||
void ProjectMainConfigPage::initWidgets() {
|
void ProjectMainConfigPage::initWidgets() {
|
||||||
title_label_ = new QLabel(tr("Titre du projet :", "label when configuring"));
|
title_label_ = new QLabel(tr("Titre du projet :", "label when configuring"));
|
||||||
title_value_ = new QLineEdit();
|
title_value_ = new QLineEdit();
|
||||||
title_information_ = new QLabel(tr("Ce titre sera disponible pour tous les folios de ce projet en tant que %projecttitle.", "informative label"));
|
title_information_ = new QLabel(tr("Ce titre sera disponible pour tous les folios de ce projet en tant que %projecttitle.", "informative label"));
|
||||||
project_variables_label_ = new QLabel(
|
project_variables_label_ = new QLabel(
|
||||||
tr(
|
tr(
|
||||||
"Vous pouvez définir ci-dessous des propriétés personnalisées qui seront disponibles pour tous les folios de ce projet (typiquement pour les cartouches).",
|
"Vous pouvez définir ci-dessous des propriétés personnalisées qui seront disponibles pour tous les folios de ce projet (typiquement pour les cartouches).",
|
||||||
"informative label"
|
"informative label"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -252,43 +252,42 @@ void ProjectAutoNumConfigPage::applyProjectConf() {}
|
|||||||
*/
|
*/
|
||||||
void ProjectAutoNumConfigPage::initWidgets() {
|
void ProjectAutoNumConfigPage::initWidgets() {
|
||||||
|
|
||||||
tab_widget = new QTabWidget(this);
|
tab_widget = new QTabWidget(this);
|
||||||
tab_widget->setMinimumWidth(440);
|
|
||||||
|
|
||||||
//Conductor Tab
|
//Conductor Tab
|
||||||
conductor_tab_widget = new QWidget(this);
|
conductor_tab_widget = new QWidget(this);
|
||||||
|
|
||||||
m_label = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), conductor_tab_widget);
|
m_label = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), conductor_tab_widget);
|
||||||
|
|
||||||
m_context_cb = new QComboBox(conductor_tab_widget);
|
m_context_cb = new QComboBox(conductor_tab_widget);
|
||||||
m_context_cb->setEditable(true);
|
m_context_cb->setEditable(true);
|
||||||
m_context_cb->lineEdit()->setClearButtonEnabled(true);
|
m_context_cb->lineEdit()->setClearButtonEnabled(true);
|
||||||
m_context_cb->addItem(tr("Nom de la nouvelle numérotation"));
|
m_context_cb->addItem(tr("Nom de la nouvelle numérotation"));
|
||||||
|
|
||||||
m_remove_pb = new QPushButton(QET::Icons::EditDelete, QString(), conductor_tab_widget);
|
m_remove_pb = new QPushButton(QET::Icons::EditDelete, QString(), conductor_tab_widget);
|
||||||
m_remove_pb -> setToolTip(tr("Supprimer la numérotation"));
|
m_remove_pb -> setToolTip(tr("Supprimer la numérotation"));
|
||||||
|
|
||||||
m_saw = new SelectAutonumW(conductor_tab_widget);
|
m_saw = new SelectAutonumW(conductor_tab_widget);
|
||||||
|
|
||||||
//Folio Tab
|
//Folio Tab
|
||||||
folio_tab_widget = new QWidget(this);
|
folio_tab_widget = new QWidget(this);
|
||||||
|
folio_tab_widget->setObjectName("FolioTab");
|
||||||
|
|
||||||
m_label_2 = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), folio_tab_widget);
|
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 = new QComboBox(folio_tab_widget);
|
||||||
m_context_cb_2->setEditable(true);
|
m_context_cb_2->setEditable(true);
|
||||||
m_context_cb_2->lineEdit()->setClearButtonEnabled(true);
|
m_context_cb_2->lineEdit()->setClearButtonEnabled(true);
|
||||||
m_context_cb_2->addItem(tr("Nom de la nouvelle numérotation"));
|
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 = new QPushButton(QET::Icons::EditDelete, QString(), folio_tab_widget);
|
||||||
m_remove_pb_2 -> setToolTip(tr("Supprimer la numérotation"));
|
m_remove_pb_2 -> setToolTip(tr("Supprimer la numérotation"));
|
||||||
|
|
||||||
m_saw_2 = new SelectAutonumW(folio_tab_widget);
|
m_saw_2 = new SelectAutonumW(folio_tab_widget);
|
||||||
|
|
||||||
/* //AutoNumbering Tab - Needs Further Testing
|
//AutoNumbering Tab
|
||||||
autoNumbering_tab_widget = new QWidget(this);
|
autoNumbering_tab_widget = new QWidget(this);
|
||||||
m_faw = new FolioAutonumberingW(project(),autoNumbering_tab_widget);
|
m_faw = new FolioAutonumberingW(project(),autoNumbering_tab_widget);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -296,40 +295,43 @@ void ProjectAutoNumConfigPage::initWidgets() {
|
|||||||
* Init the layout of this page
|
* Init the layout of this page
|
||||||
*/
|
*/
|
||||||
void ProjectAutoNumConfigPage::initLayout() {
|
void ProjectAutoNumConfigPage::initLayout() {
|
||||||
//Conductor tab
|
|
||||||
tab_widget->addTab(conductor_tab_widget, tr("Conductor"));
|
|
||||||
|
|
||||||
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_label);
|
||||||
context_layout -> addWidget (m_context_cb);
|
context_layout -> addWidget (m_context_cb);
|
||||||
context_layout -> addWidget (m_remove_pb);
|
context_layout -> addWidget (m_remove_pb);
|
||||||
|
|
||||||
QVBoxLayout *main_layout = new QVBoxLayout();
|
QVBoxLayout *main_layout = new QVBoxLayout();
|
||||||
QVBoxLayout *aux_layout = new QVBoxLayout();
|
QVBoxLayout *aux_layout = new QVBoxLayout();
|
||||||
aux_layout->addLayout(context_layout);
|
aux_layout->addLayout(context_layout);
|
||||||
aux_layout->addWidget(m_saw);
|
aux_layout->addWidget(m_saw);
|
||||||
|
|
||||||
main_layout->addLayout(aux_layout);
|
main_layout->addLayout(aux_layout);
|
||||||
conductor_tab_widget -> setLayout (main_layout);
|
conductor_tab_widget -> setLayout (main_layout);
|
||||||
|
|
||||||
// Folio Tab
|
// Folio Tab
|
||||||
tab_widget->addTab(folio_tab_widget, tr("Folio"));
|
tab_widget->addTab(folio_tab_widget, tr("Folio"));
|
||||||
|
|
||||||
QHBoxLayout *context_layout_2 = new QHBoxLayout();
|
QHBoxLayout *context_layout_2 = new QHBoxLayout();
|
||||||
context_layout_2 -> addWidget (m_label_2);
|
context_layout_2 -> addWidget (m_label_2);
|
||||||
context_layout_2 -> addWidget (m_context_cb_2);
|
context_layout_2 -> addWidget (m_context_cb_2);
|
||||||
context_layout_2 -> addWidget (m_remove_pb_2);
|
context_layout_2 -> addWidget (m_remove_pb_2);
|
||||||
|
|
||||||
QVBoxLayout *main_layout_2 = new QVBoxLayout();
|
QVBoxLayout *main_layout_2 = new QVBoxLayout();
|
||||||
QVBoxLayout *aux_layout_2 = new QVBoxLayout();
|
QVBoxLayout *aux_layout_2 = new QVBoxLayout();
|
||||||
aux_layout_2->addLayout(context_layout_2);
|
aux_layout_2->addLayout(context_layout_2);
|
||||||
aux_layout_2->addWidget(m_saw_2);
|
aux_layout_2->addWidget(m_saw_2);
|
||||||
|
|
||||||
main_layout_2->addLayout(aux_layout_2);
|
main_layout_2->addLayout(aux_layout_2);
|
||||||
folio_tab_widget -> setLayout (main_layout_2);
|
folio_tab_widget -> setLayout (main_layout_2);
|
||||||
|
|
||||||
//Auto Numbering Tab - Needs Further Testing
|
//Auto Numbering Tab
|
||||||
// tab_widget->addTab(autoNumbering_tab_widget,tr ("Folio Auto Numbering"));
|
tab_widget->addTab(autoNumbering_tab_widget,tr ("Folio Auto Numbering"));
|
||||||
|
|
||||||
|
tab_widget->resize(440,590);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -337,7 +339,7 @@ void ProjectAutoNumConfigPage::initLayout() {
|
|||||||
* Read value stored on project, and update display
|
* Read value stored on project, and update display
|
||||||
*/
|
*/
|
||||||
void ProjectAutoNumConfigPage::readValuesFromProject() {
|
void ProjectAutoNumConfigPage::readValuesFromProject() {
|
||||||
//Conductor Tab
|
//Conductor Tab
|
||||||
QList <QString> keys = project_->conductorAutoNum().keys();
|
QList <QString> keys = project_->conductorAutoNum().keys();
|
||||||
if (!keys.isEmpty()){
|
if (!keys.isEmpty()){
|
||||||
foreach (QString str, keys) { m_context_cb -> addItem(str); }
|
foreach (QString str, keys) { m_context_cb -> addItem(str); }
|
||||||
@@ -349,8 +351,8 @@ void ProjectAutoNumConfigPage::readValuesFromProject() {
|
|||||||
foreach (QString str, keys_2) { m_context_cb_2 -> addItem(str);}
|
foreach (QString str, keys_2) { m_context_cb_2 -> addItem(str);}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Folio AutoNumbering Tab - Needs Further Testing
|
//Folio AutoNumbering Tab
|
||||||
// m_faw->setContext(keys_2);
|
m_faw->setContext(keys_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -370,18 +372,17 @@ void ProjectAutoNumConfigPage::buildConnections() {
|
|||||||
|
|
||||||
//Conductor Tab
|
//Conductor Tab
|
||||||
connect (m_context_cb, SIGNAL (currentIndexChanged(QString)), this, SLOT (updateContext(QString)));
|
connect (m_context_cb, SIGNAL (currentIndexChanged(QString)), this, SLOT (updateContext(QString)));
|
||||||
connect (m_saw, SIGNAL (applyPressed()), this, SLOT (saveContext()));
|
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
|
//Folio Tab
|
||||||
connect (m_context_cb_2, SIGNAL (currentIndexChanged(QString)), this, SLOT (updateContext_2(QString)));
|
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_saw_2, SIGNAL (applyPressed()), this, SLOT (saveContext_2()));
|
||||||
connect (m_remove_pb_2, SIGNAL (clicked()), this, SLOT (removeContext_2()));
|
connect (m_remove_pb_2, SIGNAL (clicked()), this, SLOT (removeContext_2()));
|
||||||
|
|
||||||
/* //Auto Folio Numbering - Needs Further Testing
|
// Auto Folio Numbering
|
||||||
connect (m_faw, SIGNAL (applyPressed()), this, SLOT (applyAutoNum()));
|
connect (m_faw, SIGNAL (applyPressed()), this, SLOT (applyAutoNum()));
|
||||||
connect (m_faw, SIGNAL (m_autonumber_tabs_rb_clicked()), this, SLOT (tabChanged(int)));
|
connect (m_faw, SIGNAL (m_autonumber_tabs_rb_clicked()), this, SLOT (tabChanged(int)));
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -400,8 +401,8 @@ void ProjectAutoNumConfigPage::updateContext(QString str) {
|
|||||||
* @param str, key of context stored in project
|
* @param str, key of context stored in project
|
||||||
*/
|
*/
|
||||||
void ProjectAutoNumConfigPage::updateContext_2(QString str) {
|
void ProjectAutoNumConfigPage::updateContext_2(QString str) {
|
||||||
if (str == tr("Nom de la nouvelle numérotation")) m_saw_2 -> setContext(NumerotationContext());
|
if (str == tr("Nom de la nouvelle numérotation")) m_saw_2 -> setContext(NumerotationContext());
|
||||||
else m_saw_2 ->setContext(project_->folioAutoNum(str));
|
else m_saw_2 ->setContext(project_->folioAutoNum(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,48 +432,47 @@ void ProjectAutoNumConfigPage::saveContext() {
|
|||||||
* Save the current displayed folio context in project
|
* Save the current displayed folio context in project
|
||||||
*/
|
*/
|
||||||
void ProjectAutoNumConfigPage::saveContext_2() {
|
void ProjectAutoNumConfigPage::saveContext_2() {
|
||||||
// If the text is the default text "Name of new numerotation" save the edited context
|
// If the text is the default text "Name of new numerotation" save the edited context
|
||||||
// With the the name "No name"
|
// With the the name "No name"
|
||||||
if (m_context_cb_2 -> currentText() == tr("Nom de la nouvelle numérotation")) {
|
if (m_context_cb_2 -> currentText() == tr("Nom de la nouvelle numérotation")) {
|
||||||
project_->addFolioAutoNum (tr("Sans nom"), m_saw_2 -> toNumContext());
|
project_->addFolioAutoNum (tr("Sans nom"), m_saw_2 -> toNumContext());
|
||||||
m_context_cb_2 -> addItem(tr("Sans nom"));
|
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.
|
// 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())) {
|
else if ( !project_ -> folioAutoNum().keys().contains( m_context_cb_2->currentText())) {
|
||||||
project()->addFolioAutoNum(m_context_cb_2->currentText(), m_saw_2->toNumContext());
|
project()->addFolioAutoNum(m_context_cb_2->currentText(), m_saw_2->toNumContext());
|
||||||
m_context_cb_2 -> addItem(m_context_cb_2->currentText());
|
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, the text already exist in the autonum of the project, just update the context
|
||||||
else {
|
else {
|
||||||
project_->addFolioAutoNum (m_context_cb_2 -> currentText(), m_saw_2 -> toNumContext());
|
project_->addFolioAutoNum (m_context_cb_2 -> currentText(), m_saw_2 -> toNumContext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ProjectAutoNumConfigPage::applyAutoNum
|
* @brief ProjectAutoNumConfigPage::applyAutoNum
|
||||||
* Apply auto folio numbering, New Folios or Selected Folios
|
* Apply auto folio numbering, New Folios or Selected Folios
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
void ProjectAutoNumConfigPage::applyAutoNum() {
|
void ProjectAutoNumConfigPage::applyAutoNum() {
|
||||||
|
|
||||||
if (m_faw->newFolios){
|
if (m_faw->newFolios){
|
||||||
int foliosRemaining = m_faw->newFoliosNumber();
|
int foliosRemaining = m_faw->newFoliosNumber();
|
||||||
emit (saveCurrentTbp());
|
emit (saveCurrentTbp());
|
||||||
emit (setAutoNum(m_faw->autoNumSelected()));
|
emit (setAutoNum(m_faw->autoNumSelected()));
|
||||||
while (foliosRemaining > 0){
|
while (foliosRemaining > 0){
|
||||||
project()->autoFolioNumberingNewFolios();
|
qDebug() << foliosRemaining;
|
||||||
foliosRemaining = foliosRemaining-1;
|
project()->autoFolioNumberingNewFolios();
|
||||||
}
|
foliosRemaining = foliosRemaining-1;
|
||||||
emit (loadSavedTbp());
|
}
|
||||||
}
|
emit (loadSavedTbp());
|
||||||
else{
|
}
|
||||||
|
else{
|
||||||
QString autoNum = m_faw->autoNumSelected();
|
QString autoNum = m_faw->autoNumSelected();
|
||||||
int fromFolio = m_faw->fromFolio();
|
int fromFolio = m_faw->fromFolio();
|
||||||
int toFolio = m_faw->toFolio();
|
int toFolio = m_faw->toFolio();
|
||||||
project_->autoFolioNumberingSelectedFolios(fromFolio,toFolio,autoNum);
|
project_->autoFolioNumberingSelectedFolios(fromFolio,toFolio,autoNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ProjectAutoNumConfigPage::removeContext
|
* @brief ProjectAutoNumConfigPage::removeContext
|
||||||
@@ -481,18 +481,18 @@ void ProjectAutoNumConfigPage::applyAutoNum() {
|
|||||||
void ProjectAutoNumConfigPage::removeContext() {
|
void ProjectAutoNumConfigPage::removeContext() {
|
||||||
//if default text, return
|
//if default text, return
|
||||||
if ( m_context_cb -> currentText() == tr("Nom de la nouvelle numérotation") ) return;
|
if ( m_context_cb -> currentText() == tr("Nom de la nouvelle numérotation") ) return;
|
||||||
project_ -> removeConductorAutonum (m_context_cb -> currentText() );
|
project_ -> removeConductorAutonum (m_context_cb -> currentText() );
|
||||||
m_context_cb -> removeItem (m_context_cb -> currentIndex() );
|
m_context_cb -> removeItem (m_context_cb -> currentIndex() );
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief ProjectAutoNumConfigPage::removeContext_2
|
* @brief ProjectAutoNumConfigPage::removeContext_2
|
||||||
* Remove from project the current folio numerotation context
|
* Remove from project the current folio numerotation context
|
||||||
*/
|
*/
|
||||||
void ProjectAutoNumConfigPage::removeContext_2() {
|
void ProjectAutoNumConfigPage::removeContext_2() {
|
||||||
//if default text, return
|
//if default text, return
|
||||||
if ( m_context_cb_2 -> currentText() == tr("Nom de la nouvelle numérotation") ) return;
|
if ( m_context_cb_2 -> currentText() == tr("Nom de la nouvelle numérotation") ) return;
|
||||||
project_ -> removeFolioAutoNum (m_context_cb_2 -> currentText() );
|
project_ -> removeFolioAutoNum (m_context_cb_2 -> currentText() );
|
||||||
m_context_cb_2 -> removeItem (m_context_cb_2 -> currentIndex() );
|
m_context_cb_2 -> removeItem (m_context_cb_2 -> currentIndex() );
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief ProjectAutoNumConfigPage::changeToTab
|
* @brief ProjectAutoNumConfigPage::changeToTab
|
||||||
@@ -500,7 +500,7 @@ void ProjectAutoNumConfigPage::removeContext_2() {
|
|||||||
* Change to Selected Tab
|
* Change to Selected Tab
|
||||||
*/
|
*/
|
||||||
void ProjectAutoNumConfigPage::changeToTab(int i){
|
void ProjectAutoNumConfigPage::changeToTab(int i){
|
||||||
tab_widget->setCurrentIndex(i);
|
tab_widget->setCurrentIndex(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -514,7 +514,7 @@ void ProjectAutoNumConfigPage::tabChanged(int i){
|
|||||||
tab_widget->resize(470,tab_widget->height());
|
tab_widget->resize(470,tab_widget->height());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tab_widget->adjustSize();
|
tab_widget->resize(440,tab_widget->height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage {
|
|||||||
void saveContext_2();
|
void saveContext_2();
|
||||||
void removeContext_2();
|
void removeContext_2();
|
||||||
|
|
||||||
// void applyAutoNum(); - Needs Further Testing
|
void applyAutoNum();
|
||||||
|
|
||||||
void tabChanged(int);
|
void tabChanged(int);
|
||||||
|
|
||||||
|
|||||||
@@ -77,11 +77,10 @@ QETProject *ProjectView::project() {
|
|||||||
void ProjectView::setProject(QETProject *project) {
|
void ProjectView::setProject(QETProject *project) {
|
||||||
if (!project_) {
|
if (!project_) {
|
||||||
project_ = project;
|
project_ = project;
|
||||||
connect(project_, SIGNAL(projectTitleChanged(QETProject *, const QString &)), this, SLOT(updateWindowTitle()));
|
connect(project_, SIGNAL(projectTitleChanged(QETProject *, const QString &)), this, SLOT(updateWindowTitle()));
|
||||||
connect(project_, SIGNAL(projectModified (QETProject *, bool)), this, SLOT(updateWindowTitle()));
|
connect(project_, SIGNAL(projectModified (QETProject *, bool)), this, SLOT(updateWindowTitle()));
|
||||||
connect(project_, SIGNAL(readOnlyChanged (QETProject *, bool)), this, SLOT(adjustReadOnlyState()));
|
connect(project_, SIGNAL(readOnlyChanged (QETProject *, bool)), this, SLOT(adjustReadOnlyState()));
|
||||||
connect(project_, SIGNAL(addAutoNumDiagram()), this, SLOT(addNewDiagram()));
|
connect(project_, SIGNAL(addAutoNumDiagram()), this, SLOT(addNewDiagram()));
|
||||||
connect(project_, SIGNAL(addAutoNumDiagram()), this, SLOT(addNewDiagram()));
|
|
||||||
adjustReadOnlyState();
|
adjustReadOnlyState();
|
||||||
loadDiagrams();
|
loadDiagrams();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,23 +20,22 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#include "qdebug.h"
|
|
||||||
#include "qetproject.h"
|
#include "qetproject.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
FolioAutonumberingW::FolioAutonumberingW(QETProject *project, QWidget *parent) :
|
FolioAutonumberingW::FolioAutonumberingW(QETProject *project, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
project_(project),
|
project_(project),
|
||||||
ui(new Ui::FolioAutonumberingW)
|
ui(new Ui::FolioAutonumberingW)
|
||||||
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
applyEnable(false);
|
applyEnable(false);
|
||||||
ui->m_from_cb->setEnabled(false);
|
ui->m_from_cb->setEnabled(false);
|
||||||
ui->m_new_tabs_sb->setEnabled(false);
|
ui->m_new_tabs_sb->setEnabled(false);
|
||||||
ui->m_to_cb->setEnabled(false);
|
ui->m_to_cb->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +51,7 @@ FolioAutonumberingW::~FolioAutonumberingW()
|
|||||||
* construct autonums in the comboBox selected in the @autonum_chooser QcomboBox
|
* construct autonums in the comboBox selected in the @autonum_chooser QcomboBox
|
||||||
*/
|
*/
|
||||||
void FolioAutonumberingW::setContext(QList <QString> autonums) {
|
void FolioAutonumberingW::setContext(QList <QString> autonums) {
|
||||||
foreach (QString str, autonums) { ui->m_autonums_cb->addItem(str);}
|
foreach (QString str, autonums) { ui->m_autonums_cb->addItem(str);}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,7 +59,7 @@ void FolioAutonumberingW::setContext(QList <QString> autonums) {
|
|||||||
* returns the current autonum selected
|
* returns the current autonum selected
|
||||||
*/
|
*/
|
||||||
QString FolioAutonumberingW::autoNumSelected(){
|
QString FolioAutonumberingW::autoNumSelected(){
|
||||||
return ui->m_autonums_cb->currentText();
|
return ui->m_autonums_cb->currentText();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,7 +83,7 @@ int FolioAutonumberingW::toFolio(){
|
|||||||
* returns the number of folios to create
|
* returns the number of folios to create
|
||||||
*/
|
*/
|
||||||
int FolioAutonumberingW::newFoliosNumber(){
|
int FolioAutonumberingW::newFoliosNumber(){
|
||||||
return ui->m_new_tabs_sb->value();
|
return ui->m_new_tabs_sb->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,9 +91,9 @@ int FolioAutonumberingW::newFoliosNumber(){
|
|||||||
* update Folio List in From and To ComboBox
|
* update Folio List in From and To ComboBox
|
||||||
*/
|
*/
|
||||||
void FolioAutonumberingW::updateFolioList(){
|
void FolioAutonumberingW::updateFolioList(){
|
||||||
ui -> m_from_cb->clear();
|
ui -> m_from_cb->clear();
|
||||||
ui -> m_to_cb->clear();
|
ui -> m_to_cb->clear();
|
||||||
if (newFolios){
|
if (newFolios){
|
||||||
this -> on_m_create_new_tabs_rb_clicked();
|
this -> on_m_create_new_tabs_rb_clicked();
|
||||||
} else {
|
} else {
|
||||||
this -> on_m_autonumber_tabs_rb_clicked();
|
this -> on_m_autonumber_tabs_rb_clicked();
|
||||||
@@ -106,11 +105,11 @@ void FolioAutonumberingW::updateFolioList(){
|
|||||||
* Enable New Tabs SpinBox
|
* Enable New Tabs SpinBox
|
||||||
*/
|
*/
|
||||||
void FolioAutonumberingW::on_m_create_new_tabs_rb_clicked() {
|
void FolioAutonumberingW::on_m_create_new_tabs_rb_clicked() {
|
||||||
ui->m_from_cb->setEnabled(false);
|
ui->m_from_cb->setEnabled(false);
|
||||||
ui->m_to_cb->setEnabled(false);
|
ui->m_to_cb->setEnabled(false);
|
||||||
ui->m_new_tabs_sb->setEnabled(true);
|
ui->m_new_tabs_sb->setEnabled(true);
|
||||||
applyEnable();
|
applyEnable();
|
||||||
newFolios = true;
|
newFolios = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,18 +117,18 @@ void FolioAutonumberingW::on_m_create_new_tabs_rb_clicked() {
|
|||||||
* Enable From ComboBox, fill From ComboBox
|
* Enable From ComboBox, fill From ComboBox
|
||||||
*/
|
*/
|
||||||
void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked() {
|
void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked() {
|
||||||
ui->m_new_tabs_sb->setEnabled(false);
|
ui->m_new_tabs_sb->setEnabled(false);
|
||||||
ui->m_from_cb->setEnabled(true);
|
ui->m_from_cb->setEnabled(true);
|
||||||
ui->m_to_cb->setEnabled(true);
|
ui->m_to_cb->setEnabled(true);
|
||||||
if (ui->m_from_cb->count()<=0){
|
if (ui->m_from_cb->count()<=0){
|
||||||
ui->m_from_cb->clear();
|
ui->m_from_cb->clear();
|
||||||
ui->m_from_cb->addItem("");
|
ui->m_from_cb->addItem("");
|
||||||
foreach (Diagram *diagram, project_->diagrams()){
|
foreach (Diagram *diagram, project_->diagrams()){
|
||||||
ui->m_from_cb->addItem(diagram->title());
|
ui->m_from_cb->addItem(diagram->title());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
applyEnable();
|
applyEnable();
|
||||||
newFolios = false;
|
newFolios = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -137,8 +136,8 @@ void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked() {
|
|||||||
* Enable Apply if any new folio is to be created
|
* Enable Apply if any new folio is to be created
|
||||||
*/
|
*/
|
||||||
void FolioAutonumberingW::on_m_new_tabs_sb_valueChanged(){
|
void FolioAutonumberingW::on_m_new_tabs_sb_valueChanged(){
|
||||||
if (ui->m_new_tabs_sb->value()>0) applyEnable(true);
|
if (ui->m_new_tabs_sb->value()>0) applyEnable(true);
|
||||||
else applyEnable(false);
|
else applyEnable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -146,17 +145,17 @@ void FolioAutonumberingW::on_m_new_tabs_sb_valueChanged(){
|
|||||||
* Enable To ComboBox
|
* Enable To ComboBox
|
||||||
*/
|
*/
|
||||||
void FolioAutonumberingW::on_m_from_cb_currentIndexChanged(){
|
void FolioAutonumberingW::on_m_from_cb_currentIndexChanged(){
|
||||||
int index = ui->m_from_cb->currentIndex();
|
int index = ui->m_from_cb->currentIndex();
|
||||||
ui->m_to_cb->clear();
|
ui->m_to_cb->clear();
|
||||||
if (index > 0){
|
if (index > 0){
|
||||||
ui->m_to_cb->setEnabled(true);
|
ui->m_to_cb->setEnabled(true);
|
||||||
for (int i=index;i<project_->diagrams().size();i++)
|
for (int i=index;i<project_->diagrams().size();i++)
|
||||||
ui->m_to_cb->addItem(project_->diagrams().at(i)->title());
|
ui->m_to_cb->addItem(project_->diagrams().at(i)->title());
|
||||||
applyEnable(true);
|
applyEnable(true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
applyEnable();
|
applyEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,35 +164,34 @@ void FolioAutonumberingW::on_m_from_cb_currentIndexChanged(){
|
|||||||
* Action on @buttonBox clicked
|
* Action on @buttonBox clicked
|
||||||
*/
|
*/
|
||||||
void FolioAutonumberingW::on_buttonBox_clicked(QAbstractButton *button) {
|
void FolioAutonumberingW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||||
//transform button to int
|
//transform button to int
|
||||||
int answer = ui -> buttonBox -> buttonRole(button);
|
int answer = ui -> buttonBox -> buttonRole(button);
|
||||||
|
|
||||||
switch (answer) {
|
switch (answer) {
|
||||||
//help dialog - not implemented yet -
|
//help dialog - not implemented yet -
|
||||||
case QDialogButtonBox::HelpRole:
|
case QDialogButtonBox::HelpRole:
|
||||||
break;
|
QMessageBox::information (this, tr("Folio Autonumbering", "title window"),
|
||||||
/*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 folios.\n"
|
||||||
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"
|
"-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"
|
"-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"
|
"-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\", "
|
"\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"
|
"qui s'incrémente à chaque nouveau folio 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"
|
"-\"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,"
|
"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"
|
"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 \"Texte\", représente un texte fixe.\nLe champs \"Incrémentation\" n'est pas utilisé.\n",
|
||||||
|
"help dialog about the folio autonumerotation"
|
||||||
"\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;
|
break;
|
||||||
}
|
case QDialogButtonBox::ApplyRole:
|
||||||
|
applyEnable(true);
|
||||||
|
emit applyPressed();
|
||||||
|
updateFolioList();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,18 +199,18 @@ void FolioAutonumberingW::on_buttonBox_clicked(QAbstractButton *button) {
|
|||||||
* enable/disable the apply button
|
* enable/disable the apply button
|
||||||
*/
|
*/
|
||||||
void FolioAutonumberingW::applyEnable(bool b) {
|
void FolioAutonumberingW::applyEnable(bool b) {
|
||||||
if (b){
|
if (b){
|
||||||
bool valid = true;
|
bool valid = true;
|
||||||
if (ui->m_create_new_tabs_rb->isChecked()){
|
if (ui->m_create_new_tabs_rb->isChecked()){
|
||||||
if (ui->m_new_tabs_sb->value()==0) valid = false;
|
if (ui->m_new_tabs_sb->value()==0) valid = false;
|
||||||
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(valid);
|
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(valid);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (ui->m_to_cb->currentText()=="") valid = false;
|
if (ui->m_to_cb->currentText()=="") valid = false;
|
||||||
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(valid);
|
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(valid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(b);
|
ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>New Tabs</string>
|
<string>New Folios</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -212,7 +212,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Create New Tabs</string>
|
<string>Create New Folios</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -225,7 +225,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Autonumber Selected Tabs</string>
|
<string>Autonumber Selected Folios</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -284,7 +284,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Help|QDialogButtonBox::Reset</set>
|
<set>QDialogButtonBox::Apply</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ NumPartEditorW::NumPartEditorW(QWidget *parent) :
|
|||||||
intValidator (new QIntValidator(0,99999,this))
|
intValidator (new QIntValidator(0,99999,this))
|
||||||
{
|
{
|
||||||
ui -> setupUi(this);
|
ui -> setupUi(this);
|
||||||
|
if (parentWidget()->parentWidget()->objectName()=="FolioTab") ui->type_combo->setMaxCount(4);
|
||||||
setType(NumPartEditorW::unit, true);
|
setType(NumPartEditorW::unit, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ NumPartEditorW::NumPartEditorW (NumerotationContext &context, int i, QWidget *pa
|
|||||||
intValidator (new QIntValidator(0,99999,this))
|
intValidator (new QIntValidator(0,99999,this))
|
||||||
{
|
{
|
||||||
ui -> setupUi(this);
|
ui -> setupUi(this);
|
||||||
|
if (parentWidget()->parentWidget()->objectName()=="FolioTab") ui->type_combo->setMaxCount(5);
|
||||||
//if @context contains nothing build with default value
|
//if @context contains nothing build with default value
|
||||||
if(context.size()==0) setType(NumPartEditorW::unit, true);
|
if(context.size()==0) setType(NumPartEditorW::unit, true);
|
||||||
|
|
||||||
@@ -51,7 +52,8 @@ NumPartEditorW::NumPartEditorW (NumerotationContext &context, int i, QWidget *pa
|
|||||||
else if (strl.at(0)=="ten") setType(NumPartEditorW::ten, true);
|
else if (strl.at(0)=="ten") setType(NumPartEditorW::ten, true);
|
||||||
else if (strl.at(0)=="hundred") setType(NumPartEditorW::hundred, true);
|
else if (strl.at(0)=="hundred") setType(NumPartEditorW::hundred, true);
|
||||||
else if (strl.at(0)=="string") setType(NumPartEditorW::string);
|
else if (strl.at(0)=="string") setType(NumPartEditorW::string);
|
||||||
else if (strl.at(0)== "folio") setType(NumPartEditorW::folio);
|
else if (strl.at(0)=="idfolio") setType(NumPartEditorW::idfolio);
|
||||||
|
else if (strl.at(0)=="folio") setType(NumPartEditorW::folio);
|
||||||
ui -> value_field -> setText(strl.at(1));
|
ui -> value_field -> setText(strl.at(1));
|
||||||
ui -> increase_spinBox -> setValue(strl.at(2).toInt());
|
ui -> increase_spinBox -> setValue(strl.at(2).toInt());
|
||||||
}
|
}
|
||||||
@@ -86,6 +88,9 @@ NumerotationContext NumPartEditorW::toNumContext() {
|
|||||||
case string:
|
case string:
|
||||||
type_str = "string";
|
type_str = "string";
|
||||||
break;
|
break;
|
||||||
|
case idfolio:
|
||||||
|
type_str = "idfolio";
|
||||||
|
break;
|
||||||
case folio:
|
case folio:
|
||||||
type_str = "folio";
|
type_str = "folio";
|
||||||
break;
|
break;
|
||||||
@@ -99,8 +104,9 @@ NumerotationContext NumPartEditorW::toNumContext() {
|
|||||||
* @return true if value field isn't empty or if type is folio
|
* @return true if value field isn't empty or if type is folio
|
||||||
*/
|
*/
|
||||||
bool NumPartEditorW::isValid() {
|
bool NumPartEditorW::isValid() {
|
||||||
if (type_ != folio && ui -> value_field -> text().isEmpty()) return false;
|
if (type_ == folio||type_ == idfolio) {return true;}
|
||||||
return true;
|
else if(ui -> value_field -> text().isEmpty()) {return false;}
|
||||||
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,6 +127,9 @@ void NumPartEditorW::on_type_combo_activated(int index) {
|
|||||||
case string:
|
case string:
|
||||||
setType(string);
|
setType(string);
|
||||||
break;
|
break;
|
||||||
|
case idfolio:
|
||||||
|
setType(idfolio);
|
||||||
|
break;
|
||||||
case folio:
|
case folio:
|
||||||
setType(folio);
|
setType(folio);
|
||||||
break;
|
break;
|
||||||
@@ -155,7 +164,7 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
|
|||||||
|
|
||||||
//if @t is a numeric type and preview type @type_ isn't a numeric type
|
//if @t is a numeric type and preview type @type_ isn't a numeric type
|
||||||
//or @fnum is true, we set numeric behavior
|
//or @fnum is true, we set numeric behavior
|
||||||
if ( ((t==unit || t==ten || t==hundred) && (type_==string || type_==folio)) || fnum) {
|
if ( ((t==unit || t==ten || t==hundred) && (type_==string || type_==folio || type_==idfolio)) || fnum) {
|
||||||
ui -> value_field -> clear();
|
ui -> value_field -> clear();
|
||||||
ui -> value_field -> setEnabled(true);
|
ui -> value_field -> setEnabled(true);
|
||||||
ui -> value_field -> setValidator(intValidator);
|
ui -> value_field -> setValidator(intValidator);
|
||||||
@@ -163,7 +172,7 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
|
|||||||
ui -> increase_spinBox -> setValue(1);
|
ui -> increase_spinBox -> setValue(1);
|
||||||
}
|
}
|
||||||
//@t isn't a numeric type
|
//@t isn't a numeric type
|
||||||
else if (t==string || t==folio) {
|
else if (t==string || t==folio || t==idfolio) {
|
||||||
ui -> value_field -> clear();
|
ui -> value_field -> clear();
|
||||||
ui -> increase_spinBox -> setDisabled(true);
|
ui -> increase_spinBox -> setDisabled(true);
|
||||||
if (t==string) {
|
if (t==string) {
|
||||||
@@ -174,6 +183,10 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
|
|||||||
ui -> value_field -> setDisabled(true);
|
ui -> value_field -> setDisabled(true);
|
||||||
ui -> increase_spinBox -> setDisabled(true);
|
ui -> increase_spinBox -> setDisabled(true);
|
||||||
}
|
}
|
||||||
|
else if (t==idfolio) {
|
||||||
|
ui -> value_field -> setDisabled(true);
|
||||||
|
ui -> increase_spinBox -> setDisabled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
type_= t;
|
type_= t;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class NumPartEditorW : public QWidget
|
|||||||
NumPartEditorW (NumerotationContext &, int, QWidget *parent=0);
|
NumPartEditorW (NumerotationContext &, int, QWidget *parent=0);
|
||||||
~NumPartEditorW();
|
~NumPartEditorW();
|
||||||
|
|
||||||
enum type {unit,ten,hundred,string,folio};
|
enum type {unit,ten,hundred,string,idfolio,folio};
|
||||||
NumerotationContext toNumContext();
|
NumerotationContext toNumContext();
|
||||||
bool isValid ();
|
bool isValid ();
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>259</width>
|
<width>308</width>
|
||||||
<height>42</height>
|
<height>45</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -28,6 +28,9 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Chiffre 1</string>
|
<string>Chiffre 1</string>
|
||||||
@@ -53,6 +56,11 @@
|
|||||||
<string>N° folio</string>
|
<string>N° folio</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Folio</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#include "ui_selectautonumw.h"
|
#include "ui_selectautonumw.h"
|
||||||
#include "numparteditorw.h"
|
#include "numparteditorw.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "qdebug.h"
|
|
||||||
#include "numerotationcontextcommands.h"
|
#include "numerotationcontextcommands.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -125,7 +124,6 @@ void SelectAutonumW::on_remove_button_clicked() {
|
|||||||
void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
|
void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||||
//transform button to int
|
//transform button to int
|
||||||
int answer = ui -> buttonBox -> buttonRole(button);
|
int answer = ui -> buttonBox -> buttonRole(button);
|
||||||
|
|
||||||
switch (answer) {
|
switch (answer) {
|
||||||
//Reset the curent context
|
//Reset the curent context
|
||||||
case QDialogButtonBox::ResetRole:
|
case QDialogButtonBox::ResetRole:
|
||||||
@@ -133,23 +131,46 @@ void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
|
|||||||
break;
|
break;
|
||||||
//help dialog
|
//help dialog
|
||||||
case QDialogButtonBox::HelpRole:
|
case QDialogButtonBox::HelpRole:
|
||||||
QMessageBox::information (this, tr("Autonumérotation", "title window"),
|
if (this->parentWidget() -> objectName()=="FolioTab"){
|
||||||
tr("C'est ici que vous pouvez définir la manière dont sera numéroté les nouveaux conducteurs.\n"
|
QMessageBox::information (this, tr("Folio Autonumérotation", "title window"),
|
||||||
"-Une numérotation est composée d'une variable minimum.\n"
|
tr("C'est ici que vous pouvez définir la manière dont sera numéroté les nouveaux folios.\n"
|
||||||
"-Vous pouvez ajouter ou supprimer une variable de numérotation par le biais des boutons - et +.\n"
|
"-Une numérotation est composée d'une variable minimum.\n"
|
||||||
"-Une variable de numérotation comprant: un type, une valeur et une incrémentation.\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\", "
|
"\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"
|
"qui s'incrémente à chaque nouveau folio 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"
|
"-\"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,"
|
"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"
|
"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 \"Texte\", représente un texte fixe.\nLe champs \"Incrémentation\" n'est pas utilisé.\n",
|
||||||
|
"help dialog about the folio autonumerotation"
|
||||||
|
));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
QMessageBox::information (this, tr("Conductor Autonumérotation", "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-Le type \"N° folio\" représente le n° du folio en cours.\nLes autres champs ne sont pas utilisés.",
|
"\n-les types \"Chiffre 1\", \"Chiffre 01\" et \"Chiffre 001\", représente un type numérique définie dans le champs \"Valeur\", "
|
||||||
"help dialog about the autonumerotation"));
|
"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.\n"
|
||||||
|
|
||||||
|
"\n-Le type \"Folio\" représente le nom du folio en cours.\nLes autres champs ne sont pas utilisés.",
|
||||||
|
"help dialog about the conductor autonumerotation"
|
||||||
|
));
|
||||||
|
break;
|
||||||
|
}
|
||||||
//apply the context in the diagram displayed by @diagram_chooser.
|
//apply the context in the diagram displayed by @diagram_chooser.
|
||||||
case QDialogButtonBox::ApplyRole:
|
case QDialogButtonBox::ApplyRole:
|
||||||
applyEnable(false);
|
applyEnable(false);
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>466</width>
|
<width>418</width>
|
||||||
<height>506</height>
|
<height>506</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -23,14 +23,14 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>430</width>
|
<width>400</width>
|
||||||
<height>455</height>
|
<height>455</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@@ -66,19 +66,19 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>460</width>
|
<width>400</width>
|
||||||
<height>453</height>
|
<height>453</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>460</width>
|
<width>400</width>
|
||||||
<height>450</height>
|
<height>450</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="definition_groupe">
|
<widget class="QGroupBox" name="definition_groupe">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
|||||||
Reference in New Issue
Block a user