mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Added AutoNumbering Dock Widget
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4573 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
e218228ea9
commit
7d3e4e18ce
@ -260,7 +260,7 @@ void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip) {
|
||||
setTitle(ip.title);
|
||||
setFileName(ip.filename);
|
||||
setFolio(ip.folio);
|
||||
setAutoPageNum(ip.auto_page_num);
|
||||
setAutoPageNum(ip.auto_page_num);
|
||||
if (m_edge != ip.display_at)
|
||||
{
|
||||
m_edge = ip.display_at;
|
||||
@ -394,6 +394,15 @@ void BorderTitleBlock::displayBorder(bool db) {
|
||||
if (change) emit(displayChanged());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BorderTitleBlock::slot_setAutoPageNum
|
||||
* @param pageAutoNum
|
||||
* Set Page (Folio) Auto Num
|
||||
*/
|
||||
void BorderTitleBlock::slot_setAutoPageNum(QString pageAutoNum) {
|
||||
btb_auto_page_num_=pageAutoNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BorderTitleBlock::updateRectangles
|
||||
* This method update the diagram rect according to the value of rows and columns (number and size)
|
||||
|
@ -168,6 +168,7 @@ class BorderTitleBlock : public QObject
|
||||
void displayColumns(bool);
|
||||
void displayRows(bool);
|
||||
void displayBorder(bool);
|
||||
void slot_setAutoPageNum (QString);
|
||||
|
||||
private:
|
||||
void updateRectangles();
|
||||
|
@ -161,6 +161,7 @@ void NewDiagramPage::applyConf() {
|
||||
xrp.toSettings(settings, str += key);
|
||||
}
|
||||
}
|
||||
emit (m_project->defaultTitleBlockPropertiesChanged());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -479,6 +479,7 @@ void ProjectAutoNumConfigPage::saveContext_conductor() {
|
||||
else {
|
||||
project_->addConductorAutoNum (m_context_cb_conductor-> currentText(), m_saw_conductor -> toNumContext());
|
||||
}
|
||||
project()->conductorAutoNumAdded();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -501,6 +502,7 @@ void ProjectAutoNumConfigPage::saveContext_folio() {
|
||||
else {
|
||||
project_->addFolioAutoNum (m_context_cb_folio -> currentText(), m_saw_folio -> toNumContext());
|
||||
}
|
||||
project()->folioAutoNumAdded();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -514,22 +516,23 @@ void ProjectAutoNumConfigPage::saveContext_element() {
|
||||
if (m_context_cb_element -> currentText() == tr("Nom de la nouvelle numérotation")) {
|
||||
project_->addElementAutoNum (tr("Sans nom"), m_saw_element -> toNumContext());
|
||||
project()->addElementAutoNumFormula (tr("Sans nom"), m_saw_element->elementFormula()); //add hash <title, formula>
|
||||
project()->addElementAutoNumCurrentFormula (m_saw_element->elementFormula()); //add last added element formula to current formula
|
||||
project()->setElementAutoNumCurrentFormula (m_saw_element->elementFormula()); //add last added element formula to current formula
|
||||
m_context_cb_element -> 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_ -> elementAutoNum().keys().contains( m_context_cb_element->currentText())) {
|
||||
project()->addElementAutoNum(m_context_cb_element->currentText(), m_saw_element->toNumContext()); //add hash <title, numcontext>
|
||||
project()->addElementAutoNumFormula (m_context_cb_element->currentText(), m_saw_element->elementFormula()); //add hash <title, formula>
|
||||
project()->addElementAutoNumCurrentFormula (m_saw_element->elementFormula()); //add last added element formula to current formula
|
||||
project()->setElementAutoNumCurrentFormula (m_saw_element->elementFormula()); //add last added element formula to current formula
|
||||
m_context_cb_element -> addItem(m_context_cb_element->currentText());
|
||||
}
|
||||
// Else, the text already exist in the autonum of the project, just update the context
|
||||
else {
|
||||
project_->addElementAutoNum (m_context_cb_element -> currentText(), m_saw_element -> toNumContext()); //add hash <title, numcontext>
|
||||
project()->addElementAutoNumFormula (m_context_cb_element->currentText(), m_saw_element->elementFormula()); //add hash <title, formula>
|
||||
project()->addElementAutoNumCurrentFormula (m_saw_element->elementFormula()); //add last added element formula to current formula
|
||||
project()->setElementAutoNumCurrentFormula (m_saw_element->elementFormula()); //add last added element formula to current formula
|
||||
}
|
||||
project()->elementAutoNumAdded();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -565,6 +568,7 @@ void ProjectAutoNumConfigPage::removeContext_conductor() {
|
||||
if ( m_context_cb_conductor-> currentText() == tr("Nom de la nouvelle numérotation") ) return;
|
||||
project_ -> removeConductorAutoNum (m_context_cb_conductor-> currentText() );
|
||||
m_context_cb_conductor-> removeItem (m_context_cb_conductor-> currentIndex() );
|
||||
project()->conductorAutoNumRemoved();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -576,6 +580,7 @@ void ProjectAutoNumConfigPage::removeContext_folio() {
|
||||
if ( m_context_cb_folio -> currentText() == tr("Nom de la nouvelle numérotation") ) return;
|
||||
project_ -> removeFolioAutoNum (m_context_cb_folio -> currentText() );
|
||||
m_context_cb_folio -> removeItem (m_context_cb_folio -> currentIndex() );
|
||||
project()->folioAutoNumRemoved();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -587,6 +592,7 @@ void ProjectAutoNumConfigPage::removeContext_element() {
|
||||
if ( m_context_cb_element -> currentText() == tr("Nom de la nouvelle numérotation") ) return;
|
||||
project_ -> removeElementAutoNum (m_context_cb_element -> currentText() );
|
||||
m_context_cb_element -> removeItem (m_context_cb_element -> currentIndex() );
|
||||
project()->elementAutoNumRemoved();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "diagrameventaddimage.h"
|
||||
#include "diagrameventaddtext.h"
|
||||
#include "elementscollectionwidget.h"
|
||||
#include "autonumberingdockwidget.h"
|
||||
|
||||
#include "ui/dialogautonum.h"
|
||||
|
||||
@ -66,7 +67,8 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
||||
m_file_actions_group (this),
|
||||
open_dialog_dir (QStandardPaths::writableLocation(QStandardPaths::DesktopLocation))
|
||||
{
|
||||
//Setup the mdi area at center of application
|
||||
activeSubWindowIndex = 0;
|
||||
//Setup the mdi area at center of application
|
||||
setCentralWidget(&workspace);
|
||||
|
||||
//Set object name to be retrieved by the stylesheets
|
||||
@ -85,6 +87,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
||||
setUpElementsCollectionWidget();
|
||||
setUpUndoStack();
|
||||
setUpSelectionPropertiesEditor();
|
||||
setUpAutonumberingWidget();
|
||||
|
||||
setUpActions();
|
||||
setUpToolBar();
|
||||
@ -205,6 +208,18 @@ void QETDiagramEditor::setUpSelectionPropertiesEditor()
|
||||
addDockWidget(Qt::RightDockWidgetArea, m_selection_properties_editor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETDiagramEditor::setUpAutonumberingWidget
|
||||
* Setup the dock for AutoNumbering Selection
|
||||
*/
|
||||
void QETDiagramEditor::setUpAutonumberingWidget()
|
||||
{
|
||||
m_autonumbering_dock = new AutoNumberingDockWidget(this);
|
||||
m_autonumbering_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
m_autonumbering_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
||||
addDockWidget(Qt::RightDockWidgetArea, m_autonumbering_dock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETDiagramEditor::setUpActions
|
||||
* Set up all Qaction
|
||||
@ -939,6 +954,7 @@ bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) {
|
||||
// met a jour le panel d'elements
|
||||
if (update_panel) {
|
||||
pa -> elementsPanel().projectWasOpened(project);
|
||||
m_autonumbering_dock->setProject(project, project_view);
|
||||
}
|
||||
|
||||
return(true);
|
||||
@ -1300,6 +1316,20 @@ void QETDiagramEditor::slot_updateActions()
|
||||
slot_updateModeActions();
|
||||
slot_updatePasteAction();
|
||||
slot_updateComplexActions();
|
||||
slot_updateAutoNumDock();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETDiagramEditor::slot_updateAutoNumDock
|
||||
* Update Auto Num Dock Widget when changing Project
|
||||
*/
|
||||
void QETDiagramEditor::slot_updateAutoNumDock() {
|
||||
if ( workspace.subWindowList().indexOf(workspace.activeSubWindow()) != activeSubWindowIndex) {
|
||||
activeSubWindowIndex = workspace.subWindowList().indexOf(workspace.activeSubWindow());
|
||||
if (currentProject()!=NULL) {
|
||||
m_autonumbering_dock->setProject(currentProject()->project(),currentProject());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,6 +32,7 @@ class ElementsLocation;
|
||||
class RecentFiles;
|
||||
class DiagramPropertiesEditorDockWidget;
|
||||
class ElementsCollectionWidget;
|
||||
class AutoNumberingDockWidget;
|
||||
|
||||
/**
|
||||
This class represents the main window of the QElectroTech diagram editor and,
|
||||
@ -53,6 +54,7 @@ class QETDiagramEditor : public QETMainWindow {
|
||||
void setUpElementsCollectionWidget();
|
||||
void setUpUndoStack ();
|
||||
void setUpSelectionPropertiesEditor();
|
||||
void setUpAutonumberingWidget();
|
||||
void setUpActions ();
|
||||
void setUpToolBar ();
|
||||
void setUpMenu ();
|
||||
@ -110,6 +112,7 @@ class QETDiagramEditor : public QETMainWindow {
|
||||
void slot_updateComplexActions();
|
||||
void slot_updatePasteAction();
|
||||
void slot_updateWindowsMenu();
|
||||
void slot_updateAutoNumDock();
|
||||
void editSelectionProperties();
|
||||
void slot_resetConductors();
|
||||
void slot_autoConductor(bool ac);
|
||||
@ -151,7 +154,7 @@ class QETDiagramEditor : public QETMainWindow {
|
||||
private slots:
|
||||
void selectionChanged();
|
||||
void activeUndoStackCleanChanged (bool clean);
|
||||
|
||||
|
||||
// attributes
|
||||
public:
|
||||
// Actions reachable through menus within QElectroTech
|
||||
@ -226,5 +229,8 @@ class QETDiagramEditor : public QETMainWindow {
|
||||
QToolBar *diagram_bar;
|
||||
QToolBar *m_add_item_toolBar;
|
||||
QUndoGroup undo_group;
|
||||
// AutoNumbering Selection Dock
|
||||
AutoNumberingDockWidget *m_autonumbering_dock;
|
||||
int activeSubWindowIndex;
|
||||
};
|
||||
#endif
|
||||
|
@ -362,6 +362,7 @@ void QETProject::setDefaultTitleBlockProperties(const TitleBlockProperties &titl
|
||||
QScopedPointer<IntegrationMoveTitleBlockTemplatesHandler> m(new IntegrationMoveTitleBlockTemplatesHandler);
|
||||
integrateTitleBlockTemplate(collection -> location(titleblock.template_name), m.data());
|
||||
}
|
||||
emit defaultTitleBlockPropertiesChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -472,11 +473,11 @@ void QETProject::addElementAutoNumFormula(QString key, QString formula) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::addElementAutoNumCurrentFormula
|
||||
* @brief QETProject::setElementAutoNumCurrentFormula
|
||||
* Add the formula to the current formula
|
||||
* @param formula
|
||||
*/
|
||||
void QETProject::addElementAutoNumCurrentFormula(QString formula) {
|
||||
void QETProject::setElementAutoNumCurrentFormula(QString formula) {
|
||||
m_current_element_formula = formula;
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ class QETProject : public QObject
|
||||
void addConductorAutoNum (QString key, NumerotationContext context);
|
||||
void addElementAutoNum (QString key, NumerotationContext context);
|
||||
void addElementAutoNumFormula (QString key, QString formula);
|
||||
void addElementAutoNumCurrentFormula (QString formula);
|
||||
void setElementAutoNumCurrentFormula (QString formula);
|
||||
void addFolioAutoNum (QString key, NumerotationContext context);
|
||||
void removeConductorAutoNum (QString key);
|
||||
void removeElementAutoNum (QString key);
|
||||
@ -171,6 +171,15 @@ class QETProject : public QObject
|
||||
void reportPropertiesChanged(QString);
|
||||
void XRefPropertiesChanged ();
|
||||
void addAutoNumDiagram();
|
||||
void elementAutoNumAdded();
|
||||
void elementAutoNumRemoved();
|
||||
void conductorAutoNumAdded();
|
||||
void conductorAutoNumRemoved();
|
||||
void folioAutoNumAdded();
|
||||
void folioAutoNumRemoved();
|
||||
void folioAutoNumChanged(QString);
|
||||
void defaultTitleBlockPropertiesChanged();
|
||||
void conductorAutoNumChanged();
|
||||
|
||||
private slots:
|
||||
void updateDiagramsFolioData();
|
||||
|
@ -43,6 +43,8 @@ class TitleBlockProperties {
|
||||
void toSettings(QSettings &, const QString & = QString()) const;
|
||||
void fromSettings(QSettings &, const QString & = QString());
|
||||
|
||||
void setAutoPageNum(QString autonum) {auto_page_num = autonum;}
|
||||
|
||||
static TitleBlockProperties defaultProperties();
|
||||
|
||||
QDate finalDate() const ;
|
||||
@ -53,13 +55,13 @@ class TitleBlockProperties {
|
||||
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;
|
||||
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
|
||||
Qt::Edge display_at; ///< Edge to display the titleblock
|
||||
QET::QetCollection collection; ///<Specify the location of the title block
|
||||
|
||||
|
||||
private:
|
||||
QString exportDate() const;
|
||||
void setDateFromString(const QString &);
|
||||
|
244
sources/ui/autonumberingdockwidget.cpp
Normal file
244
sources/ui/autonumberingdockwidget.cpp
Normal file
@ -0,0 +1,244 @@
|
||||
/*
|
||||
Copyright 2006-2016 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 "autonumberingdockwidget.h"
|
||||
#include "qetapp.h"
|
||||
#include "ui_autonumberingdockwidget.h"
|
||||
#include "diagramview.h"
|
||||
#include "diagram.h"
|
||||
#include "titleblockproperties.h"
|
||||
#include "numerotationcontext.h"
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::AutoNumberingDockWidget
|
||||
* Constructor
|
||||
* @param parent : parent widget
|
||||
*/
|
||||
AutoNumberingDockWidget::AutoNumberingDockWidget(QWidget *parent, QETProject *project) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::AutoNumberingDockWidget),
|
||||
project_(project)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::~AutoNumberingDockWidget
|
||||
* Destructor
|
||||
*/
|
||||
AutoNumberingDockWidget::~AutoNumberingDockWidget()
|
||||
{
|
||||
this->disconnect();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::clear
|
||||
* Remove all combo box values
|
||||
*/
|
||||
void AutoNumberingDockWidget::clear()
|
||||
{
|
||||
ui->m_conductor_cb->clear();
|
||||
ui->m_element_cb->clear();
|
||||
ui->m_folio_cb->clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::setProject
|
||||
* @param project: project to be setted
|
||||
* @param projectview: projectview to be setted
|
||||
* assign Project and ProjectView, connect all signals and setContext
|
||||
*/
|
||||
void AutoNumberingDockWidget::setProject(QETProject *project, ProjectView *projectview) {
|
||||
|
||||
project_ = project;
|
||||
projectview_ = projectview;
|
||||
|
||||
//Conductor Signals
|
||||
connect(project_, SIGNAL(conductorAutoNumChanged()),this,SLOT(conductorAutoNumChanged()));
|
||||
connect (project_,SIGNAL(conductorAutoNumRemoved()), this,SLOT(conductorAutoNumChanged()));
|
||||
connect (project_,SIGNAL(conductorAutoNumAdded()), this,SLOT(conductorAutoNumChanged()));
|
||||
connect(projectview_,SIGNAL(diagramActivated(DiagramView*)),this,SLOT(setConductorActive(DiagramView*)));
|
||||
|
||||
//Element Signals
|
||||
connect (project_,SIGNAL(elementAutoNumRemoved()), this,SLOT(elementAutoNumChanged()));
|
||||
connect (project_,SIGNAL(elementAutoNumAdded()), this,SLOT(elementAutoNumChanged()));
|
||||
|
||||
//Folio Signals
|
||||
connect (project_,SIGNAL(folioAutoNumRemoved()), this,SLOT(folioAutoNumChanged()));
|
||||
connect (project_,SIGNAL(folioAutoNumAdded()), this,SLOT(folioAutoNumChanged()));
|
||||
connect (this,
|
||||
SIGNAL(folioAutoNumChanged(QString)),
|
||||
&projectview_->currentDiagram()->diagram()->border_and_titleblock,
|
||||
SLOT (slot_setAutoPageNum(QString)));
|
||||
connect(project_, SIGNAL(defaultTitleBlockPropertiesChanged()),this,SLOT(setActive()));
|
||||
|
||||
//Conductor, Element and Folio Signals
|
||||
connect(projectview_,SIGNAL(projectClosed(ProjectView*)),this,SLOT(clear()));
|
||||
|
||||
//Set Combobox Context
|
||||
setContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::setContext
|
||||
* Add all itens to comboboxes
|
||||
*/
|
||||
void AutoNumberingDockWidget::setContext() {
|
||||
|
||||
this->clear();
|
||||
|
||||
//Conductor Combobox
|
||||
QList <QString> keys_conductor = project_->conductorAutoNum().keys();
|
||||
if (!keys_conductor.isEmpty()) {
|
||||
foreach (QString str, keys_conductor) { ui->m_conductor_cb-> addItem(str); }
|
||||
}
|
||||
|
||||
//Element Combobox
|
||||
QList <QString> keys_element = project_->elementAutoNum().keys();
|
||||
if (!keys_element.isEmpty()) {
|
||||
foreach (QString str, keys_element) {ui->m_element_cb -> addItem(str);}
|
||||
}
|
||||
|
||||
//Folio Combobox
|
||||
QList <QString> keys_folio = project_->folioAutoNum().keys();
|
||||
if (!keys_folio.isEmpty()) {
|
||||
foreach (QString str, keys_folio) { ui->m_folio_cb -> addItem(str);}
|
||||
}
|
||||
|
||||
this->setActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::setConductorActive
|
||||
* @param dv: activated diagramview
|
||||
*/
|
||||
void AutoNumberingDockWidget::setConductorActive(DiagramView* dv) {
|
||||
if (dv!=NULL) {
|
||||
QString conductor_autonum = dv->diagram()->conductorsAutonumName();
|
||||
int conductor_index = ui->m_conductor_cb->findText(conductor_autonum);
|
||||
ui->m_conductor_cb->setCurrentIndex(conductor_index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::setActive
|
||||
* Set current used autonumberings
|
||||
*/
|
||||
void AutoNumberingDockWidget::setActive() {
|
||||
|
||||
if (projectview_!=NULL) {
|
||||
//Conductor
|
||||
QString conductor_autonum = projectview_->currentDiagram()->diagram()->conductorsAutonumName();
|
||||
int conductor_index = ui->m_conductor_cb->findText(conductor_autonum);
|
||||
ui->m_conductor_cb->setCurrentIndex(conductor_index);
|
||||
|
||||
//Element
|
||||
QString element_formula = project_->elementAutoNumFormula();
|
||||
QString active_element_autonum = project_->elementAutoNum_2().key(element_formula);
|
||||
int el_index = ui->m_element_cb->findText(active_element_autonum);
|
||||
ui->m_element_cb->setCurrentIndex(el_index);
|
||||
|
||||
//Folio
|
||||
QString page_autonum = project_->defaultTitleBlockProperties().auto_page_num;
|
||||
int folio_index = ui->m_folio_cb->findText(page_autonum);
|
||||
ui->m_folio_cb->setCurrentIndex(folio_index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::conductorAutoNumChanged
|
||||
* Add new or remove conductor auto num from combobox
|
||||
*/
|
||||
void AutoNumberingDockWidget::conductorAutoNumChanged() {
|
||||
|
||||
ui->m_conductor_cb->clear();
|
||||
|
||||
//Conductor Combobox
|
||||
QList <QString> keys_conductor = project_->conductorAutoNum().keys();
|
||||
if (!keys_conductor.isEmpty()) {
|
||||
foreach (QString str, keys_conductor) { ui->m_conductor_cb-> addItem(str); }
|
||||
}
|
||||
setActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::on_m_conductor_cb_activated
|
||||
* @param unused
|
||||
* Set new conductor AutoNum
|
||||
*/
|
||||
void AutoNumberingDockWidget::on_m_conductor_cb_activated(int) {
|
||||
QString current_autonum = ui->m_conductor_cb->currentText();
|
||||
projectview_->currentDiagram()->diagram()->setConductorsAutonumName(current_autonum);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::elementAutoNumChanged
|
||||
* Add new or remove element auto num from combobox
|
||||
*/
|
||||
void AutoNumberingDockWidget::elementAutoNumChanged() {
|
||||
|
||||
ui->m_element_cb->clear();
|
||||
|
||||
//Element Combobox
|
||||
QList <QString> keys_element = project_->elementAutoNum().keys();
|
||||
if (!keys_element.isEmpty()) {
|
||||
foreach (QString str, keys_element) {ui->m_element_cb -> addItem(str);}
|
||||
}
|
||||
setActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::on_m_element_cb_activated
|
||||
* @param unused
|
||||
* Set new element AutoNum
|
||||
*/
|
||||
void AutoNumberingDockWidget::on_m_element_cb_activated(int) {
|
||||
QString current_autonum = ui->m_element_cb->currentText();
|
||||
QString current_formula = project_->elementAutoNumFormula(current_autonum);
|
||||
if (current_formula!=NULL)
|
||||
project_->setElementAutoNumCurrentFormula(current_formula);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::folioAutoNumChanged
|
||||
* Add new or remove folio auto num from combobox
|
||||
*/
|
||||
void AutoNumberingDockWidget::folioAutoNumChanged() {
|
||||
|
||||
ui->m_folio_cb->clear();
|
||||
|
||||
//Folio Combobox
|
||||
QList <QString> keys_folio = project_->folioAutoNum().keys();
|
||||
if (!keys_folio.isEmpty()) {
|
||||
foreach (QString str, keys_folio) { ui->m_folio_cb -> addItem(str);}
|
||||
}
|
||||
setActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::on_m_folio_cb_activated
|
||||
* @param unused
|
||||
* Set new folio AutoNum
|
||||
*/
|
||||
void AutoNumberingDockWidget::on_m_folio_cb_activated(int) {
|
||||
QString current_autonum = ui->m_folio_cb->currentText();
|
||||
TitleBlockProperties ip = project_->defaultTitleBlockProperties();
|
||||
ip.setAutoPageNum(current_autonum);
|
||||
project_->setDefaultTitleBlockProperties(ip);
|
||||
emit(folioAutoNumChanged(current_autonum));
|
||||
}
|
63
sources/ui/autonumberingdockwidget.h
Normal file
63
sources/ui/autonumberingdockwidget.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright 2006-2016 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 AUTONUMBERINGDOCKWIDGET_H
|
||||
#define AUTONUMBERINGDOCKWIDGET_H_H
|
||||
|
||||
#include "qetproject.h"
|
||||
#include "projectview.h"
|
||||
#include <QDockWidget>
|
||||
|
||||
namespace Ui {
|
||||
class AutoNumberingDockWidget;
|
||||
}
|
||||
|
||||
class AutoNumberingDockWidget : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AutoNumberingDockWidget(QWidget *parent = 0, QETProject *project = nullptr);
|
||||
~AutoNumberingDockWidget();
|
||||
|
||||
void setContext();
|
||||
void setProject(QETProject*, ProjectView*);
|
||||
|
||||
public slots:
|
||||
void setActive();
|
||||
void setConductorActive(DiagramView*);
|
||||
|
||||
private slots:
|
||||
void on_m_conductor_cb_activated(int);
|
||||
void on_m_element_cb_activated(int);
|
||||
void on_m_folio_cb_activated(int);
|
||||
void conductorAutoNumChanged();
|
||||
void elementAutoNumChanged();
|
||||
void folioAutoNumChanged();
|
||||
void clear();
|
||||
|
||||
signals:
|
||||
void folioAutoNumChanged(QString);
|
||||
|
||||
private:
|
||||
Ui::AutoNumberingDockWidget *ui;
|
||||
QETProject* project_;
|
||||
ProjectView* projectview_;
|
||||
|
||||
};
|
||||
|
||||
#endif // AUTONUMBERINGDOCKWIDGET_H
|
94
sources/ui/autonumberingdockwidget.ui
Normal file
94
sources/ui/autonumberingdockwidget.ui
Normal file
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AutoNumberingDockWidget</class>
|
||||
<widget class="QDockWidget" name="AutoNumberingDockWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Autonumerotation Séléction</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Element</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_element_cb"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_conductor_cb"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Conductor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Folio</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<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>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="m_folio_cb"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -110,6 +110,7 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare
|
||||
// Conductor autonum name
|
||||
if (m_asw -> text() != diagram -> conductorsAutonumName()) {
|
||||
diagram -> setConductorsAutonumName (m_asw -> text());
|
||||
diagram->project()->conductorAutoNumChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user