Improve some widget

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4921 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2017-02-26 19:39:36 +00:00
parent 945d8562ca
commit ce7f1cb3ad
5 changed files with 165 additions and 196 deletions

View File

@@ -34,6 +34,7 @@ SelectAutonumW::SelectAutonumW(int type, QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
ui->m_comboBox->lineEdit()->setClearButtonEnabled(true);
if (m_edited_type == 0) if (m_edited_type == 0)
{ {
m_feaw = new FormulaAutonumberingW(); m_feaw = new FormulaAutonumberingW();
@@ -162,6 +163,11 @@ QString SelectAutonumW::formula()
return ""; return "";
} }
QComboBox *SelectAutonumW::contextComboBox() const
{
return ui->m_comboBox;
}
/** /**
* @brief SelectAutonumW::on_buttonBox_clicked * @brief SelectAutonumW::on_buttonBox_clicked
* Action on @buttonBox clicked * Action on @buttonBox clicked
@@ -226,14 +232,6 @@ void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
}; };
} }
/**
* @brief SelectAutonumW::applyEnableOnContextChanged
* enable/disable the apply button after changing the autonum name
*/
void SelectAutonumW::applyEnableOnContextChanged(QString) {
applyEnable(true);
}
/** /**
* @brief SelectAutonumW::applyEnable * @brief SelectAutonumW::applyEnable
* enable/disable the apply button * enable/disable the apply button
@@ -276,7 +274,8 @@ void SelectAutonumW::contextToFormula()
* @brief SelectAutonumW::on_m_next_pb_clicked * @brief SelectAutonumW::on_m_next_pb_clicked
* Increase NumerotationContext * Increase NumerotationContext
*/ */
void SelectAutonumW::on_m_next_pb_clicked() { void SelectAutonumW::on_m_next_pb_clicked()
{
NumerotationContextCommands ncc (toNumContext()); NumerotationContextCommands ncc (toNumContext());
setContext(ncc.next()); setContext(ncc.next());
applyEnable(true); applyEnable(true);
@@ -286,8 +285,20 @@ void SelectAutonumW::on_m_next_pb_clicked() {
* @brief SelectAutonumW::on_m_previous_pb_clicked * @brief SelectAutonumW::on_m_previous_pb_clicked
* Decrease NumerotationContext * Decrease NumerotationContext
*/ */
void SelectAutonumW::on_m_previous_pb_clicked() { void SelectAutonumW::on_m_previous_pb_clicked()
{
NumerotationContextCommands ncc (toNumContext()); NumerotationContextCommands ncc (toNumContext());
setContext(ncc.previous()); setContext(ncc.previous());
applyEnable(true); applyEnable(true);
} }
void SelectAutonumW::on_m_comboBox_currentTextChanged(const QString &arg1)
{
Q_UNUSED(arg1);
applyEnable(true);
}
void SelectAutonumW::on_m_remove_pb_clicked()
{
emit removeClicked();
}

View File

@@ -25,6 +25,7 @@
class NumPartEditorW; class NumPartEditorW;
class QAbstractButton; class QAbstractButton;
class FormulaAutonumberingW; class FormulaAutonumberingW;
class QComboBox;
namespace Ui { namespace Ui {
class SelectAutonumW; class SelectAutonumW;
@@ -44,24 +45,25 @@ class SelectAutonumW : public QWidget
NumerotationContext toNumContext() const; NumerotationContext toNumContext() const;
void contextToFormula (); void contextToFormula ();
QString formula(); QString formula();
QComboBox *contextComboBox() const;
signals: signals:
void applyPressed(); void applyPressed();
void removeClicked();
//SLOT //SLOT
public slots:
void applyEnableOnContextChanged(QString);
private slots: private slots:
void on_add_button_clicked(); void on_add_button_clicked();
void on_remove_button_clicked(); void on_remove_button_clicked();
void on_buttonBox_clicked(QAbstractButton *); void on_buttonBox_clicked(QAbstractButton *);
void applyEnable (bool = true); void applyEnable (bool = true);
//ATTRIBUTES
void on_m_next_pb_clicked(); void on_m_next_pb_clicked();
void on_m_previous_pb_clicked(); void on_m_previous_pb_clicked();
void on_m_comboBox_currentTextChanged(const QString &arg1);
//ATTRIBUTES
void on_m_remove_pb_clicked();
private: private:
Ui::SelectAutonumW *ui; Ui::SelectAutonumW *ui;
QList <NumPartEditorW *> num_part_list_; QList <NumPartEditorW *> num_part_list_;

View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>616</width> <width>473</width>
<height>421</height> <height>175</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@@ -20,6 +20,56 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Numérotations disponibles :</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<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="QComboBox" name="m_comboBox">
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>Nom de la nouvelle numérotation</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_remove_pb">
<property name="toolTip">
<string>Supprimer la numérotation</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../qelectrotech.qrc">
<normaloff>:/ico/16x16/edit-delete.png</normaloff>:/ico/16x16/edit-delete.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<widget class="QWidget" name="m_widget" native="true"> <widget class="QWidget" name="m_widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">

View File

@@ -262,119 +262,46 @@ void ProjectAutoNumConfigPage::initWidgets()
tab_widget->addTab(m_amw, tr("Management")); tab_widget->addTab(m_amw, tr("Management"));
//Conductor tab //Conductor tab
QWidget *conductor_widget = new QWidget();
QVBoxLayout *conductor_layout = new QVBoxLayout(conductor_widget);
QHBoxLayout *bp_conductor_layout = new QHBoxLayout();
QLabel *label_conductor = new QLabel(tr("Numérotations disponibles :", "availables numerotations"));
m_context_cb_conductor= new QComboBox();
m_context_cb_conductor->setEditable(true);
m_context_cb_conductor->lineEdit()->setClearButtonEnabled(true);
m_context_cb_conductor->addItem(tr("Nom de la nouvelle numérotation"));
m_remove_pb_conductor= new QPushButton(QET::Icons::EditDelete, QString());
m_remove_pb_conductor-> setToolTip(tr("Supprimer la numérotation"));
m_saw_conductor = new SelectAutonumW(1); m_saw_conductor = new SelectAutonumW(1);
tab_widget->addTab(m_saw_conductor, tr("Conducteur"));
bp_conductor_layout->addWidget(label_conductor);
bp_conductor_layout->addStretch();
bp_conductor_layout->addWidget(m_context_cb_conductor);
bp_conductor_layout->addWidget(m_remove_pb_conductor);
conductor_layout->addLayout(bp_conductor_layout);
conductor_layout->addWidget(m_saw_conductor);
tab_widget->addTab(conductor_widget, tr("Conducteur"));
//Element tab //Element tab
QWidget *element_widget = new QWidget();
QVBoxLayout *element_layout = new QVBoxLayout(element_widget);
QHBoxLayout *bp_element_layout = new QHBoxLayout();
QLabel *label_element = new QLabel(tr("Numérotations disponibles :", "availables numerotations"));
m_context_cb_element = new QComboBox();
m_context_cb_element->setEditable(true);
m_context_cb_element->lineEdit()->setClearButtonEnabled(true);
m_context_cb_element->addItem(tr("Nom de la nouvelle numérotation"));
m_remove_pb_element = new QPushButton(QET::Icons::EditDelete, QString());
m_remove_pb_element -> setToolTip(tr("Supprimer la numérotation"));
m_saw_element = new SelectAutonumW(0); m_saw_element = new SelectAutonumW(0);
tab_widget->addTab(m_saw_element, tr("Element"));
bp_element_layout->addWidget(label_element);
bp_element_layout->addStretch();
bp_element_layout->addWidget(m_context_cb_element);
bp_element_layout->addWidget(m_remove_pb_element);
element_layout->addLayout(bp_element_layout);
element_layout->addWidget(m_saw_element);
tab_widget->addTab(element_widget, tr("Element"));
//Folio Tab //Folio Tab
QWidget *folio_widget = new QWidget();
QVBoxLayout *folio_layout = new QVBoxLayout(folio_widget);
QHBoxLayout *bp_folio_layout = new QHBoxLayout();
QLabel *label_folio = new QLabel(tr("Numérotations disponibles :", "availables numerotations"));
m_context_cb_folio = new QComboBox();
m_context_cb_folio->setEditable(true);
m_context_cb_folio->lineEdit()->setClearButtonEnabled(true);
m_context_cb_folio->addItem(tr("Nom de la nouvelle numérotation"));
m_remove_pb_folio = new QPushButton(QET::Icons::EditDelete, QString());
m_remove_pb_folio -> setToolTip(tr("Supprimer la numérotation"));
m_saw_folio = new SelectAutonumW(2); m_saw_folio = new SelectAutonumW(2);
tab_widget->addTab(m_saw_folio, tr("Folio"));
bp_folio_layout->addWidget(label_folio);
bp_folio_layout->addStretch();
bp_folio_layout->addWidget(m_context_cb_folio);
bp_folio_layout->addWidget(m_remove_pb_folio);
folio_layout->addLayout(bp_folio_layout);
folio_layout->addWidget(m_saw_folio);
tab_widget->addTab(folio_widget, tr("Folio"));
//AutoNumbering Tab //AutoNumbering Tab
m_faw = new FolioAutonumberingW(project()); m_faw = new FolioAutonumberingW(project());
tab_widget->addTab(m_faw, tr("Folio autonumérotation")); tab_widget->addTab(m_faw, tr("Folio autonumérotation"));
m_main_layout = new QHBoxLayout(); QHBoxLayout *main_layout = new QHBoxLayout();
m_main_layout->addWidget(tab_widget); main_layout->addWidget(tab_widget);
setLayout(m_main_layout); setLayout(main_layout);
} }
/** /**
* @brief ProjectAutoNumConfigPage::readValuesFromProject * @brief ProjectAutoNumConfigPage::readValuesFromProject
* Read value stored on project, and update display * Read value stored on project, and update display
*/ */
void ProjectAutoNumConfigPage::readValuesFromProject() { void ProjectAutoNumConfigPage::readValuesFromProject()
//Conductor Tab {
QList <QString> keys_conductor = m_project->conductorAutoNum().keys(); //Conductor Tab
if (!keys_conductor.isEmpty()){ const QStringList strlc(m_project->conductorAutoNum().keys());
foreach (QString str, keys_conductor) { m_context_cb_conductor-> addItem(str); } m_saw_conductor->contextComboBox()->addItems(strlc);
}
//Element Tab
//Element Tab const QStringList strle(m_project->elementAutoNum().keys());
QList <QString> keys_element = m_project->elementAutoNum().keys(); m_saw_element->contextComboBox()->addItems(strle);
if (!keys_element.isEmpty()){
foreach (QString str, keys_element) { m_context_cb_element -> addItem(str);} //Folio Tab
} const QStringList strlf(m_project->folioAutoNum().keys());
m_saw_folio->contextComboBox()->addItems(strlf);
//Folio Tab
QList <QString> keys_folio = m_project->folioAutoNum().keys(); //Folio AutoNumbering Tab
if (!keys_folio.isEmpty()){ m_faw->setContext(m_project->folioAutoNum().keys());
foreach (QString str, keys_folio) { m_context_cb_folio -> addItem(str);}
}
//Folio AutoNumbering Tab
m_faw->setContext(keys_folio);
} }
/** /**
@@ -388,32 +315,27 @@ void ProjectAutoNumConfigPage::adjustReadOnly() {
* @brief ProjectAutoNumConfigPage::buildConnections * @brief ProjectAutoNumConfigPage::buildConnections
* setup some connections * setup some connections
*/ */
void ProjectAutoNumConfigPage::buildConnections() { void ProjectAutoNumConfigPage::buildConnections()
{
//connect(m_tab_widget,SIGNAL(currentChanged(int)),this,SLOT(tabChanged(int))); //Management Tab
//Management Tab
connect (m_amw, SIGNAL(applyPressed()), this, SLOT(applyManagement())); connect (m_amw, SIGNAL(applyPressed()), this, SLOT(applyManagement()));
//Conductor Tab //Conductor Tab
connect (m_context_cb_conductor, SIGNAL (currentTextChanged(QString)), m_saw_conductor, SLOT (applyEnableOnContextChanged(QString))); connect(m_saw_conductor, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextConductor);
connect (m_context_cb_conductor, SIGNAL (currentIndexChanged(QString)), this, SLOT (updateContext_conductor(QString))); connect(m_saw_conductor, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextConductor);
connect (m_saw_conductor, SIGNAL (applyPressed()), this, SLOT (saveContext_conductor())); connect(m_saw_conductor->contextComboBox(), SIGNAL(currentIndexChanged(QString)), this, SLOT(updateContextConductor(QString)));
connect (m_remove_pb_conductor, SIGNAL (clicked()), this, SLOT (removeContext_conductor()));
//Element Tab //Element Tab
connect (m_context_cb_element, SIGNAL (currentTextChanged(QString)), m_saw_element, SLOT(applyEnableOnContextChanged(QString))); connect(m_saw_element, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextElement);
connect (m_context_cb_element, SIGNAL (currentIndexChanged(QString)), this, SLOT (updateContextElement(QString))); connect(m_saw_element, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextElement);
connect (m_saw_element, SIGNAL (applyPressed()), this, SLOT (saveContextElement())); connect(m_saw_element->contextComboBox(), SIGNAL(currentIndexChanged(QString)), this, SLOT(updateContextElement(QString)));
connect (m_remove_pb_element, SIGNAL (clicked()), this, SLOT (removeContextElement()));
//Folio Tab //Folio Tab
connect (m_context_cb_folio, SIGNAL (currentTextChanged(QString)), m_saw_folio, SLOT(applyEnableOnContextChanged(QString))); connect(m_saw_folio, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextFolio);
connect (m_context_cb_folio, SIGNAL (currentIndexChanged(QString)), this, SLOT (updateContext_folio(QString))); connect(m_saw_folio, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextFolio);
connect (m_saw_folio, SIGNAL (applyPressed()), this, SLOT (saveContext_folio())); connect(m_saw_folio->contextComboBox(), SIGNAL(currentIndexChanged(QString)), this, SLOT(updateContextFolio(QString)));
connect (m_remove_pb_folio, SIGNAL (clicked()), this, SLOT (removeContext_folio()));
// Auto Folio Numbering // Auto Folio Numbering
connect (m_faw, SIGNAL (applyPressed()), this, SLOT (applyAutoNum())); connect (m_faw, SIGNAL (applyPressed()), this, SLOT (applyAutoNum()));
} }
@@ -422,7 +344,7 @@ void ProjectAutoNumConfigPage::buildConnections() {
* Display the current selected context for conductor * Display the current selected context for conductor
* @param str, key of context stored in project * @param str, key of context stored in project
*/ */
void ProjectAutoNumConfigPage::updateContext_conductor(QString str) { void ProjectAutoNumConfigPage::updateContextConductor(QString str) {
if (str == tr("Nom de la nouvelle numérotation")) m_saw_conductor -> setContext(NumerotationContext()); if (str == tr("Nom de la nouvelle numérotation")) m_saw_conductor -> setContext(NumerotationContext());
else m_saw_conductor ->setContext(m_project->conductorAutoNum(str)); else m_saw_conductor ->setContext(m_project->conductorAutoNum(str));
} }
@@ -432,7 +354,7 @@ void ProjectAutoNumConfigPage::updateContext_conductor(QString str) {
* Display the current selected context for folio * Display the current selected context for folio
* @param str, key of context stored in project * @param str, key of context stored in project
*/ */
void ProjectAutoNumConfigPage::updateContext_folio(QString str) { void ProjectAutoNumConfigPage::updateContextFolio(QString str) {
if (str == tr("Nom de la nouvelle numérotation")) m_saw_folio -> setContext(NumerotationContext()); if (str == tr("Nom de la nouvelle numérotation")) m_saw_folio -> setContext(NumerotationContext());
else m_saw_folio ->setContext(m_project->folioAutoNum(str)); else m_saw_folio ->setContext(m_project->folioAutoNum(str));
} }
@@ -462,26 +384,26 @@ void ProjectAutoNumConfigPage::saveContextElement()
{ {
// 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_element->currentText() == tr("Nom de la nouvelle numérotation")) if (m_saw_element->contextComboBox()->currentText() == tr("Nom de la nouvelle numérotation"))
{ {
QString title(tr("Sans nom")); QString title(tr("Sans nom"));
m_project->addElementAutoNum (title, m_saw_element -> toNumContext()); m_project->addElementAutoNum (title, m_saw_element -> toNumContext());
m_project->setCurrrentElementAutonum(title); m_project->setCurrrentElementAutonum(title);
m_context_cb_element->addItem(tr("Sans nom")); m_saw_element->contextComboBox()->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 ( !m_project -> elementAutoNum().keys().contains( m_context_cb_element->currentText())) else if ( !m_project -> elementAutoNum().keys().contains( m_saw_element->contextComboBox()->currentText()))
{ {
m_project->addElementAutoNum(m_context_cb_element->currentText(), m_saw_element->toNumContext()); m_project->addElementAutoNum(m_saw_element->contextComboBox()->currentText(), m_saw_element->toNumContext());
m_project->setCurrrentElementAutonum(m_context_cb_element->currentText()); m_project->setCurrrentElementAutonum(m_saw_element->contextComboBox()->currentText());
m_context_cb_element->addItem(m_context_cb_element->currentText()); m_saw_element->contextComboBox()->addItem(m_saw_element->contextComboBox()->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
{ {
m_project->addElementAutoNum (m_context_cb_element -> currentText(), m_saw_element -> toNumContext()); m_project->addElementAutoNum (m_saw_element->contextComboBox() -> currentText(), m_saw_element -> toNumContext());
m_project->setCurrrentElementAutonum(m_context_cb_element->currentText()); m_project->setCurrrentElementAutonum(m_saw_element->contextComboBox()->currentText());
} }
} }
@@ -492,37 +414,38 @@ void ProjectAutoNumConfigPage::saveContextElement()
void ProjectAutoNumConfigPage::removeContextElement() void ProjectAutoNumConfigPage::removeContextElement()
{ {
//if default text, return //if default text, return
if (m_context_cb_element->currentText() == tr("Nom de la nouvelle numérotation")) if (m_saw_element->contextComboBox()->currentText() == tr("Nom de la nouvelle numérotation"))
return; return;
m_project->removeElementAutoNum (m_context_cb_element->currentText()); m_project->removeElementAutoNum (m_saw_element->contextComboBox()->currentText());
m_context_cb_element->removeItem (m_context_cb_element->currentIndex()); m_saw_element->contextComboBox()->removeItem (m_saw_element->contextComboBox()->currentIndex());
} }
/** /**
* @brief ProjectAutoNumConfigPage::saveContext_conductor * @brief ProjectAutoNumConfigPage::saveContext_conductor
* Save the current displayed conductor context in project * Save the current displayed conductor context in project
*/ */
void ProjectAutoNumConfigPage::saveContext_conductor() { void ProjectAutoNumConfigPage::saveContextConductor()
// If the text is the default text "Name of new numerotation" save the edited context {
// With the the name "No name" // If the text is the default text "Name of new numerotation" save the edited context
if (m_context_cb_conductor-> currentText() == tr("Nom de la nouvelle numérotation")) // With the the name "No name"
if (m_saw_conductor->contextComboBox()-> currentText() == tr("Nom de la nouvelle numérotation"))
{ {
m_project->addConductorAutoNum (tr("Sans nom"), m_saw_conductor -> toNumContext()); m_project->addConductorAutoNum (tr("Sans nom"), m_saw_conductor -> toNumContext());
project()->setCurrentConductorAutoNum(tr("Sans nom")); project()->setCurrentConductorAutoNum(tr("Sans nom"));
m_context_cb_conductor-> addItem(tr("Sans nom")); m_saw_conductor->contextComboBox()-> 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 ( !m_project -> conductorAutoNum().keys().contains( m_context_cb_conductor->currentText())) else if ( !m_project -> conductorAutoNum().keys().contains( m_saw_conductor->contextComboBox()->currentText()))
{ {
project()->addConductorAutoNum(m_context_cb_conductor->currentText(), m_saw_conductor->toNumContext()); project()->addConductorAutoNum(m_saw_conductor->contextComboBox()->currentText(), m_saw_conductor->toNumContext());
project()->setCurrentConductorAutoNum(m_context_cb_conductor->currentText()); project()->setCurrentConductorAutoNum(m_saw_conductor->contextComboBox()->currentText());
m_context_cb_conductor-> addItem(m_context_cb_conductor->currentText()); m_saw_conductor->contextComboBox()-> addItem(m_saw_conductor->contextComboBox()->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()->setCurrentConductorAutoNum(m_context_cb_conductor->currentText()); project()->setCurrentConductorAutoNum(m_saw_conductor->contextComboBox()->currentText());
m_project->addConductorAutoNum (m_context_cb_conductor-> currentText(), m_saw_conductor -> toNumContext()); m_project->addConductorAutoNum (m_saw_conductor->contextComboBox()-> currentText(), m_saw_conductor -> toNumContext());
} }
project()->conductorAutoNumAdded(); project()->conductorAutoNumAdded();
} }
@@ -531,21 +454,21 @@ void ProjectAutoNumConfigPage::saveContext_conductor() {
* @brief ProjectAutoNumConfigPage::saveContext_folio * @brief ProjectAutoNumConfigPage::saveContext_folio
* Save the current displayed folio context in project * Save the current displayed folio context in project
*/ */
void ProjectAutoNumConfigPage::saveContext_folio() { void ProjectAutoNumConfigPage::saveContextFolio() {
// 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_folio -> currentText() == tr("Nom de la nouvelle numérotation")) { if (m_saw_folio->contextComboBox() -> currentText() == tr("Nom de la nouvelle numérotation")) {
m_project->addFolioAutoNum (tr("Sans nom"), m_saw_folio -> toNumContext()); m_project->addFolioAutoNum (tr("Sans nom"), m_saw_folio -> toNumContext());
m_context_cb_folio -> addItem(tr("Sans nom")); m_saw_folio->contextComboBox() -> 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 ( !m_project -> folioAutoNum().keys().contains( m_context_cb_folio->currentText())) { else if ( !m_project -> folioAutoNum().keys().contains( m_saw_folio->contextComboBox()->currentText())) {
project()->addFolioAutoNum(m_context_cb_folio->currentText(), m_saw_folio->toNumContext()); project()->addFolioAutoNum(m_saw_folio->contextComboBox()->currentText(), m_saw_folio->toNumContext());
m_context_cb_folio -> addItem(m_context_cb_folio->currentText()); m_saw_folio->contextComboBox() -> addItem(m_saw_folio->contextComboBox()->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 {
m_project->addFolioAutoNum (m_context_cb_folio -> currentText(), m_saw_folio -> toNumContext()); m_project->addFolioAutoNum (m_saw_folio->contextComboBox() -> currentText(), m_saw_folio -> toNumContext());
} }
project()->folioAutoNumAdded(); project()->folioAutoNumAdded();
} }
@@ -672,11 +595,11 @@ void ProjectAutoNumConfigPage::applyManagement() {
* @brief ProjectAutoNumConfigPage::removeContext * @brief ProjectAutoNumConfigPage::removeContext
* Remove from project the current conductor numerotation context * Remove from project the current conductor numerotation context
*/ */
void ProjectAutoNumConfigPage::removeContext_conductor() { void ProjectAutoNumConfigPage::removeContextConductor() {
//if default text, return //if default text, return
if ( m_context_cb_conductor-> currentText() == tr("Nom de la nouvelle numérotation") ) return; if ( m_saw_conductor->contextComboBox()-> currentText() == tr("Nom de la nouvelle numérotation") ) return;
m_project -> removeConductorAutoNum (m_context_cb_conductor-> currentText() ); m_project -> removeConductorAutoNum (m_saw_conductor->contextComboBox()-> currentText() );
m_context_cb_conductor-> removeItem (m_context_cb_conductor-> currentIndex() ); m_saw_conductor->contextComboBox()-> removeItem (m_saw_conductor->contextComboBox()-> currentIndex() );
project()->conductorAutoNumRemoved(); project()->conductorAutoNumRemoved();
} }
@@ -684,11 +607,11 @@ void ProjectAutoNumConfigPage::removeContext_conductor() {
* @brief ProjectAutoNumConfigPage::removeContext_folio * @brief ProjectAutoNumConfigPage::removeContext_folio
* Remove from project the current folio numerotation context * Remove from project the current folio numerotation context
*/ */
void ProjectAutoNumConfigPage::removeContext_folio() { void ProjectAutoNumConfigPage::removeContextFolio() {
//if default text, return //if default text, return
if ( m_context_cb_folio -> currentText() == tr("Nom de la nouvelle numérotation") ) return; if ( m_saw_folio->contextComboBox() -> currentText() == tr("Nom de la nouvelle numérotation") ) return;
m_project -> removeFolioAutoNum (m_context_cb_folio -> currentText() ); m_project -> removeFolioAutoNum (m_saw_folio->contextComboBox() -> currentText() );
m_context_cb_folio -> removeItem (m_context_cb_folio -> currentIndex() ); m_saw_folio->contextComboBox() -> removeItem (m_saw_folio->contextComboBox() -> currentIndex() );
project()->folioAutoNumRemoved(); project()->folioAutoNumRemoved();
} }

View File

@@ -28,13 +28,9 @@ class DiagramContextWidget;
class ReportPropertieWidget; class ReportPropertieWidget;
class XRefPropertiesWidget; class XRefPropertiesWidget;
class SelectAutonumW; class SelectAutonumW;
class QComboBox;
class QPushButton;
class FolioAutonumberingW; class FolioAutonumberingW;
class FormulaAutonumberingW; class FormulaAutonumberingW;
class AutoNumberingManagementW; class AutoNumberingManagementW;
class QScrollArea;
class QHBoxLayout;
/** /**
This class, derived from ConfigPage, aims at providing the basic skeleton This class, derived from ConfigPage, aims at providing the basic skeleton
@@ -140,12 +136,12 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage {
private: private:
void buildConnections(); void buildConnections();
private slots: private slots:
void updateContext_conductor(QString);//conductor void updateContextConductor(QString);//conductor
void saveContext_conductor(); void saveContextConductor();
void removeContext_conductor(); void removeContextConductor();
void updateContext_folio(QString);//folio void updateContextFolio(QString);//folio
void saveContext_folio(); void saveContextFolio();
void removeContext_folio(); void removeContextFolio();
void updateContextElement(QString);//element void updateContextElement(QString);//element
void saveContextElement(); void saveContextElement();
void removeContextElement(); void removeContextElement();
@@ -161,19 +157,6 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage {
//Attributes //Attributes
private: private:
QHBoxLayout *m_main_layout = nullptr;
QWidget *m_management_tab_widget;
QWidget *conductor_tab_widget;
QWidget *element_tab_widget;
QWidget *folio_tab_widget;
QWidget *autoNumbering_tab_widget;
QScrollArea *scrollArea;
QComboBox *m_context_cb_conductor;
QComboBox *m_context_cb_folio;
QComboBox *m_context_cb_element;
QPushButton *m_remove_pb_conductor;
QPushButton *m_remove_pb_folio;
QPushButton *m_remove_pb_element;
SelectAutonumW *m_saw_conductor; SelectAutonumW *m_saw_conductor;
SelectAutonumW *m_saw_folio; SelectAutonumW *m_saw_folio;
SelectAutonumW *m_saw_element; SelectAutonumW *m_saw_element;