mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
1) Use arrow keys to navigate through the diagram editor. 2) Use PgUp, PgDn, Home and End keys to navigate through open folios. 3)Use Delete Key inside elements panel widget to delete diagrams. 4) Added a scroll area in auto numbering page.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4476 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
5f93966984
commit
fa4714b95d
@ -243,6 +243,7 @@ TitleBlockProperties BorderTitleBlock::exportTitleBlock() {
|
||||
ip.folio = folio();
|
||||
ip.template_name = titleBlockTemplateName();
|
||||
ip.display_at = m_edge;
|
||||
ip.auto_page_num = autoPageNum();
|
||||
ip.context = additional_fields_;
|
||||
ip.collection = QET::QetCollection::Embedded;
|
||||
|
||||
@ -259,6 +260,7 @@ void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip) {
|
||||
setTitle(ip.title);
|
||||
setFileName(ip.filename);
|
||||
setFolio(ip.folio);
|
||||
setAutoPageNum(ip.auto_page_num);
|
||||
if (m_edge != ip.display_at)
|
||||
{
|
||||
m_edge = ip.display_at;
|
||||
@ -685,6 +687,7 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock(const DiagramContext &i
|
||||
context.addValue("folio", btb_final_folio_);
|
||||
context.addValue("folio-id", folio_index_);
|
||||
context.addValue("folio-total", folio_total_);
|
||||
context.addValue("auto_page_num", btb_auto_page_num_);
|
||||
|
||||
titleblock_template_renderer_ -> setContext(context);
|
||||
}
|
||||
@ -711,7 +714,7 @@ QString BorderTitleBlock::incrementLetters(const QString &string) {
|
||||
@param total nombre total de schemas dans le projet
|
||||
@param project_properties Project-wide properties, to be merged with diagram-wide ones.
|
||||
*/
|
||||
void BorderTitleBlock::setFolioData(int index, int total, const DiagramContext &project_properties) {
|
||||
void BorderTitleBlock::setFolioData(int index, int total, QString autonum, const DiagramContext &project_properties) {
|
||||
if (index < 1 || total < 1 || index > total) return;
|
||||
|
||||
// memorise les informations
|
||||
@ -720,8 +723,14 @@ void BorderTitleBlock::setFolioData(int index, int total, const DiagramContext &
|
||||
|
||||
// regenere le contenu du champ folio
|
||||
btb_final_folio_ = btb_folio_;
|
||||
|
||||
if (btb_final_folio_.contains("%autonum")){
|
||||
btb_final_folio_.replace("%autonum", autonum);
|
||||
btb_folio_ = btb_final_folio_;
|
||||
}
|
||||
btb_final_folio_.replace("%id", QString::number(folio_index_));
|
||||
btb_final_folio_.replace("%total", QString::number(folio_total_));
|
||||
|
||||
|
||||
updateDiagramContextForTitleBlock(project_properties);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QObject>
|
||||
#include <QRectF>
|
||||
#include <QDate>
|
||||
#include "numerotationcontext.h"
|
||||
class QPainter;
|
||||
class DiagramPosition;
|
||||
class TitleBlockTemplate;
|
||||
@ -107,6 +108,8 @@ class BorderTitleBlock : public QObject
|
||||
/// @return true si la bordure est affichee, false sinon
|
||||
bool borderIsDisplayed() const { return(display_border_); }
|
||||
|
||||
QString autoPageNum() const { return(btb_auto_page_num_); }
|
||||
|
||||
// methods to set dimensions
|
||||
void setColumnsCount(int);
|
||||
void setRowsCount(int);
|
||||
@ -132,9 +135,11 @@ class BorderTitleBlock : public QObject
|
||||
}
|
||||
/// @param author the new value of the "Folio" field
|
||||
void setFolio(const QString &folio) { btb_folio_ = folio; }
|
||||
void setFolioData(int, int, const DiagramContext & = DiagramContext());
|
||||
void setFolioData(int, int, QString = NULL, const DiagramContext & = DiagramContext());
|
||||
/// @param author the new value of the "File" field
|
||||
void setFileName(const QString &filename) { btb_filename_ = filename; }
|
||||
/// @param author the new value of the "Auto Page Num" field
|
||||
void setAutoPageNum(const QString &auto_page_num) { btb_auto_page_num_ = auto_page_num;}
|
||||
|
||||
void titleBlockToXml(QDomElement &);
|
||||
void titleBlockFromXml(const QDomElement &);
|
||||
@ -203,6 +208,7 @@ class BorderTitleBlock : public QObject
|
||||
QString btb_title_;
|
||||
QString btb_folio_;
|
||||
QString btb_final_folio_;
|
||||
QString btb_auto_page_num_;
|
||||
int folio_index_;
|
||||
int folio_total_;
|
||||
QString btb_filename_;
|
||||
|
@ -37,6 +37,10 @@ class ConfigDialog : public QDialog {
|
||||
private:
|
||||
ConfigDialog(const ConfigDialog &);
|
||||
|
||||
public:
|
||||
QList<ConfigPage *> pages;
|
||||
|
||||
|
||||
// methods
|
||||
public slots:
|
||||
void applyConf();
|
||||
@ -52,6 +56,8 @@ class ConfigDialog : public QDialog {
|
||||
QListWidget *pages_list;
|
||||
QStackedWidget *pages_widget;
|
||||
QDialogButtonBox *buttons;
|
||||
QList<ConfigPage *> pages;
|
||||
|
||||
|
||||
|
||||
};
|
||||
#endif
|
||||
|
@ -35,8 +35,9 @@
|
||||
* else edit the properties by default of QElectroTech
|
||||
* @param parent, parent widget
|
||||
*/
|
||||
NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent) :
|
||||
NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectPropertiesDialog *ppd) :
|
||||
ConfigPage (parent),
|
||||
ppd_ (ppd),
|
||||
m_project (project)
|
||||
{
|
||||
//By default we set the global default properties
|
||||
@ -47,7 +48,7 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent) :
|
||||
QList <TitleBlockTemplatesCollection *> c;
|
||||
c << QETApp::commonTitleBlockTemplatesCollection() << QETApp::customTitleBlockTemplatesCollection();
|
||||
if (m_project) c << m_project->embeddedTitleBlockTemplatesCollection();
|
||||
ipw = new TitleBlockPropertiesWidget(c, TitleBlockProperties::defaultProperties(), true);
|
||||
ipw = new TitleBlockPropertiesWidget(c, TitleBlockProperties::defaultProperties(), true, project, parent);
|
||||
// default conductor properties
|
||||
cpw = new ConductorPropertiesWidget(ConductorProperties::defaultProperties());
|
||||
// default propertie of report label
|
||||
@ -64,6 +65,8 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent) :
|
||||
xrefpw -> setProperties (m_project -> defaultXRefProperties());
|
||||
}
|
||||
|
||||
connect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab()));
|
||||
|
||||
// main tab widget
|
||||
QTabWidget *tab_widget = new QTabWidget(this);
|
||||
QWidget *diagram_widget = new QWidget();
|
||||
@ -87,6 +90,7 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent) :
|
||||
* @brief NewDiagramPage::~NewDiagramPage
|
||||
*/
|
||||
NewDiagramPage::~NewDiagramPage() {
|
||||
disconnect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -177,6 +181,44 @@ QString NewDiagramPage::title() const {
|
||||
return(tr("Nouveau projet", "configuration page title"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::changeToAutoFolioTab
|
||||
* Set the current tab to Autonum
|
||||
*/
|
||||
void NewDiagramPage::changeToAutoFolioTab(){
|
||||
if (m_project){
|
||||
ppd_->setCurrentPage(ProjectPropertiesDialog::Autonum);
|
||||
ppd_->changeToFolio();
|
||||
ppd_->exec();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::setFolioAutonum
|
||||
* Set temporary TBP to use in auto folio num
|
||||
*/
|
||||
void NewDiagramPage::setFolioAutonum(QString autoNum){
|
||||
TitleBlockProperties tbptemp = ipw->propertiesAutoNum(autoNum);
|
||||
ipw->setProperties(tbptemp);
|
||||
applyConf();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::saveCurrentTbp
|
||||
* Save current TBP to retrieve after auto folio num
|
||||
*/
|
||||
void NewDiagramPage::saveCurrentTbp(){
|
||||
savedTbp = ipw->properties();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::loadSavedTbp
|
||||
* Retrieve saved auto folio num
|
||||
*/
|
||||
void NewDiagramPage::loadSavedTbp(){
|
||||
ipw->setProperties(savedTbp);
|
||||
applyConf();
|
||||
}
|
||||
|
||||
/**
|
||||
Constructeur
|
||||
|
@ -19,6 +19,8 @@
|
||||
#define CONFIG_PAGES_H
|
||||
#include <QtWidgets>
|
||||
#include "configpage.h"
|
||||
#include "projectpropertiesdialog.h" //davi
|
||||
#include "titleblockpropertieswidget.h" //davi
|
||||
class BorderPropertiesWidget;
|
||||
class ConductorPropertiesWidget;
|
||||
class TitleBlockPropertiesWidget;
|
||||
@ -26,6 +28,7 @@ class ExportPropertiesWidget;
|
||||
class ReportPropertieWidget;
|
||||
class XRefPropertiesWidget;
|
||||
class QETProject;
|
||||
class TitleBlockProperties;
|
||||
|
||||
/**
|
||||
This configuration page enables users to define the properties of new
|
||||
@ -35,10 +38,16 @@ class NewDiagramPage : public ConfigPage {
|
||||
Q_OBJECT
|
||||
// constructors, destructor
|
||||
public:
|
||||
NewDiagramPage(QETProject *project = 0, QWidget * = 0);
|
||||
NewDiagramPage(QETProject *project = 0, QWidget * = 0, ProjectPropertiesDialog *teste = NULL);
|
||||
virtual ~NewDiagramPage();
|
||||
private:
|
||||
NewDiagramPage(const NewDiagramPage &);
|
||||
public slots:
|
||||
void changeToAutoFolioTab();
|
||||
void setFolioAutonum(QString);
|
||||
void saveCurrentTbp();
|
||||
void loadSavedTbp();
|
||||
|
||||
|
||||
// methods
|
||||
public:
|
||||
@ -48,12 +57,14 @@ class NewDiagramPage : public ConfigPage {
|
||||
|
||||
// attributes
|
||||
private:
|
||||
ProjectPropertiesDialog *ppd_;
|
||||
QETProject *m_project; ///< Project to edit propertie
|
||||
BorderPropertiesWidget *bpw; ///< Widget to edit default diagram dimensions
|
||||
TitleBlockPropertiesWidget *ipw; ///< Widget to edit default title block properties
|
||||
ConductorPropertiesWidget *cpw; ///< Widget to edit default conductor properties
|
||||
ReportPropertieWidget *rpw; ///< Widget to edit default report label
|
||||
XRefPropertiesWidget *xrefpw; ///< Widget to edit default xref properties
|
||||
TitleBlockProperties savedTbp; ///< Used to save current TBP and retrieve later
|
||||
|
||||
};
|
||||
|
||||
|
@ -235,6 +235,7 @@ void Diagram::keyPressEvent(QKeyEvent *e)
|
||||
bool transmit_event = true;
|
||||
if (!isReadOnly()) {
|
||||
QPointF movement;
|
||||
if (!this->selectedContent().elements.isEmpty()) {
|
||||
switch(e -> key()) {
|
||||
case Qt::Key_Left: movement = QPointF(-xGrid, 0.0); break;
|
||||
case Qt::Key_Right: movement = QPointF(+xGrid, 0.0); break;
|
||||
@ -251,6 +252,7 @@ void Diagram::keyPressEvent(QKeyEvent *e)
|
||||
if (transmit_event) {
|
||||
QGraphicsScene::keyPressEvent(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "templatelocation.h"
|
||||
#include "qetapp.h"
|
||||
#include "qetproject.h"
|
||||
#include "projectview.h"
|
||||
#include "integrationmoveelementshandler.h"
|
||||
#include "integrationmovetemplateshandler.h"
|
||||
#include "qetdiagrameditor.h"
|
||||
@ -589,7 +590,22 @@ void DiagramView::focusInEvent(QFocusEvent *e) {
|
||||
*/
|
||||
void DiagramView::keyPressEvent(QKeyEvent *e) {
|
||||
if (m_event_interface && m_event_interface->keyPressEvent(e)) return;
|
||||
|
||||
ProjectView *current_project = this->diagramEditor()->acessCurrentProject();
|
||||
switch(e -> key())
|
||||
{
|
||||
case Qt::Key_PageUp:
|
||||
current_project->changeTabUp();
|
||||
return;
|
||||
case Qt::Key_PageDown:
|
||||
current_project->changeTabDown();
|
||||
return;
|
||||
case Qt::Key_Home:
|
||||
current_project->changeFirstTab();
|
||||
return;
|
||||
case Qt::Key_End:
|
||||
current_project->changeLastTab();
|
||||
return;
|
||||
}
|
||||
switchToVisualisationModeIfNeeded(e);
|
||||
QGraphicsView::keyPressEvent(e);
|
||||
}
|
||||
|
@ -777,6 +777,19 @@ void ElementsPanelWidget::deleteElement() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Treat key press event inside elements panel widget
|
||||
*/
|
||||
void ElementsPanelWidget::keyPressEvent (QKeyEvent *e) {
|
||||
switch(e -> key()) {
|
||||
case Qt::Key_Delete: //delete diagram through elements panel widget
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
emit(requestForDiagramDeletion(selected_diagram));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
Lance l'editeur d'element pour l'element filename
|
||||
@param location Emplacement de l'element a editer
|
||||
|
@ -111,6 +111,9 @@ class ElementsPanelWidget : public QWidget {
|
||||
void loadingFinished();
|
||||
void filterEdited(const QString &);
|
||||
|
||||
protected:
|
||||
virtual void keyPressEvent (QKeyEvent *e);
|
||||
|
||||
private:
|
||||
void launchElementEditor(const ElementsLocation &);
|
||||
void launchCategoryEditor(const ElementsLocation &);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "ui/xrefpropertieswidget.h"
|
||||
#include "selectautonumw.h"
|
||||
#include "numerotationcontext.h"
|
||||
|
||||
#include "folioautonumbering.h"
|
||||
/**
|
||||
Constructor
|
||||
@param project Project this page is editing.
|
||||
@ -141,7 +141,6 @@ void ProjectMainConfigPage::applyProjectConf() {
|
||||
project_ -> setProjectProperties(new_properties);
|
||||
modified_project = true;
|
||||
}
|
||||
|
||||
if (modified_project) {
|
||||
project_ -> setModified(true);
|
||||
}
|
||||
@ -186,6 +185,8 @@ void ProjectMainConfigPage::initLayout() {
|
||||
main_layout0 -> addWidget(project_variables_label_);
|
||||
main_layout0 -> addWidget(project_variables_);
|
||||
setLayout(main_layout0);
|
||||
this -> setMinimumWidth(630);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -250,17 +251,44 @@ void ProjectAutoNumConfigPage::applyProjectConf() {}
|
||||
* Init some widget of this page
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::initWidgets() {
|
||||
m_label = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), this);
|
||||
|
||||
m_context_cb = new QComboBox(this);
|
||||
tab_widget = new QTabWidget(this);
|
||||
tab_widget->setMinimumWidth(440);
|
||||
|
||||
//Conductor Tab
|
||||
conductor_tab_widget = new QWidget(this);
|
||||
|
||||
m_label = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), conductor_tab_widget);
|
||||
|
||||
m_context_cb = new QComboBox(conductor_tab_widget);
|
||||
m_context_cb->setEditable(true);
|
||||
m_context_cb->lineEdit()->setClearButtonEnabled(true);
|
||||
m_context_cb->addItem(tr("Nom de la nouvelle numérotation"));
|
||||
|
||||
m_remove_pb = new QPushButton(QET::Icons::EditDelete, QString(), this);
|
||||
m_remove_pb = new QPushButton(QET::Icons::EditDelete, QString(), conductor_tab_widget);
|
||||
m_remove_pb -> setToolTip(tr("Supprimer la numérotation"));
|
||||
|
||||
m_saw = new SelectAutonumW(this);
|
||||
m_saw = new SelectAutonumW(conductor_tab_widget);
|
||||
|
||||
//Folio Tab
|
||||
folio_tab_widget = new QWidget(this);
|
||||
|
||||
m_label_2 = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), folio_tab_widget);
|
||||
|
||||
m_context_cb_2 = new QComboBox(folio_tab_widget);
|
||||
m_context_cb_2->setEditable(true);
|
||||
m_context_cb_2->lineEdit()->setClearButtonEnabled(true);
|
||||
m_context_cb_2->addItem(tr("Nom de la nouvelle numérotation"));
|
||||
|
||||
m_remove_pb_2 = new QPushButton(QET::Icons::EditDelete, QString(), folio_tab_widget);
|
||||
m_remove_pb_2 -> setToolTip(tr("Supprimer la numérotation"));
|
||||
|
||||
m_saw_2 = new SelectAutonumW(folio_tab_widget);
|
||||
|
||||
/* //AutoNumbering Tab - Needs Further Testing
|
||||
autoNumbering_tab_widget = new QWidget(this);
|
||||
m_faw = new FolioAutonumberingW(project(),autoNumbering_tab_widget);
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -268,15 +296,40 @@ void ProjectAutoNumConfigPage::initWidgets() {
|
||||
* Init the layout of this page
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::initLayout() {
|
||||
//Conductor tab
|
||||
tab_widget->addTab(conductor_tab_widget, tr("Conductor"));
|
||||
|
||||
QHBoxLayout *context_layout = new QHBoxLayout();
|
||||
context_layout -> addWidget (m_label);
|
||||
context_layout -> addWidget (m_context_cb);
|
||||
context_layout -> addWidget (m_remove_pb);
|
||||
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||
this -> setLayout (main_layout);
|
||||
main_layout -> addLayout (context_layout);
|
||||
main_layout -> addWidget (m_saw);
|
||||
QVBoxLayout *main_layout = new QVBoxLayout();
|
||||
QVBoxLayout *aux_layout = new QVBoxLayout();
|
||||
aux_layout->addLayout(context_layout);
|
||||
aux_layout->addWidget(m_saw);
|
||||
|
||||
main_layout->addLayout(aux_layout);
|
||||
conductor_tab_widget -> setLayout (main_layout);
|
||||
|
||||
// Folio Tab
|
||||
tab_widget->addTab(folio_tab_widget, tr("Folio"));
|
||||
|
||||
QHBoxLayout *context_layout_2 = new QHBoxLayout();
|
||||
context_layout_2 -> addWidget (m_label_2);
|
||||
context_layout_2 -> addWidget (m_context_cb_2);
|
||||
context_layout_2 -> addWidget (m_remove_pb_2);
|
||||
|
||||
QVBoxLayout *main_layout_2 = new QVBoxLayout();
|
||||
QVBoxLayout *aux_layout_2 = new QVBoxLayout();
|
||||
aux_layout_2->addLayout(context_layout_2);
|
||||
aux_layout_2->addWidget(m_saw_2);
|
||||
|
||||
main_layout_2->addLayout(aux_layout_2);
|
||||
folio_tab_widget -> setLayout (main_layout_2);
|
||||
|
||||
//Auto Numbering Tab - Needs Further Testing
|
||||
// tab_widget->addTab(autoNumbering_tab_widget,tr ("Folio Auto Numbering"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -284,9 +337,20 @@ void ProjectAutoNumConfigPage::initLayout() {
|
||||
* Read value stored on project, and update display
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::readValuesFromProject() {
|
||||
//Conductor Tab
|
||||
QList <QString> keys = project_->conductorAutoNum().keys();
|
||||
if (keys.isEmpty()) return;
|
||||
if (!keys.isEmpty()){
|
||||
foreach (QString str, keys) { m_context_cb -> addItem(str); }
|
||||
}
|
||||
|
||||
//Folio Tab
|
||||
QList <QString> keys_2 = project_->folioAutoNum().keys();
|
||||
if (!keys_2.isEmpty()){
|
||||
foreach (QString str, keys_2) { m_context_cb_2 -> addItem(str);}
|
||||
}
|
||||
|
||||
//Folio AutoNumbering Tab - Needs Further Testing
|
||||
// m_faw->setContext(keys_2);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -301,14 +365,28 @@ void ProjectAutoNumConfigPage::adjustReadOnly() {
|
||||
* setup some connections
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::buildConnections() {
|
||||
|
||||
connect(tab_widget,SIGNAL(currentChanged(int)),this,SLOT(tabChanged(int)));
|
||||
|
||||
//Conductor Tab
|
||||
connect (m_context_cb, SIGNAL (currentIndexChanged(QString)), this, SLOT (updateContext(QString)));
|
||||
connect (m_saw, SIGNAL (applyPressed()), this, SLOT (saveContext()));
|
||||
connect (m_remove_pb, SIGNAL(clicked()), this, SLOT(removeContext()));
|
||||
connect (m_remove_pb, SIGNAL (clicked()), this, SLOT(removeContext()));
|
||||
|
||||
//Folio Tab
|
||||
connect (m_context_cb_2, SIGNAL (currentIndexChanged(QString)), this, SLOT (updateContext_2(QString)));
|
||||
connect (m_saw_2, SIGNAL (applyPressed()), this, SLOT (saveContext_2()));
|
||||
connect (m_remove_pb_2, SIGNAL (clicked()), this, SLOT (removeContext_2()));
|
||||
|
||||
/* //Auto Folio Numbering - Needs Further Testing
|
||||
connect (m_faw, SIGNAL (applyPressed()), this, SLOT (applyAutoNum()));
|
||||
connect (m_faw, SIGNAL (m_autonumber_tabs_rb_clicked()), this, SLOT (tabChanged(int)));
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ProjectAutoNumConfigPage::updateContext
|
||||
* Display the current selected context
|
||||
* Display the current selected context for conductor
|
||||
* @param str, key of context stored in project
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::updateContext(QString str) {
|
||||
@ -316,9 +394,19 @@ void ProjectAutoNumConfigPage::updateContext(QString str) {
|
||||
else m_saw ->setContext(project_->conductorAutoNum(str));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ProjectAutoNumConfigPage::updateContext_2
|
||||
* Display the current selected context for folio
|
||||
* @param str, key of context stored in project
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::updateContext_2(QString str) {
|
||||
if (str == tr("Nom de la nouvelle numérotation")) m_saw_2 -> setContext(NumerotationContext());
|
||||
else m_saw_2 ->setContext(project_->folioAutoNum(str));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ProjectAutoNumConfigPage::saveContext
|
||||
* Save the current displayed context in project
|
||||
* Save the current displayed conductor context in project
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::saveContext() {
|
||||
// If the text is the default text "Name of new numerotation" save the edited context
|
||||
@ -338,9 +426,57 @@ void ProjectAutoNumConfigPage::saveContext() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ProjectAutoNumConfigPage::saveContext_2
|
||||
* Save the current displayed folio context in project
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::saveContext_2() {
|
||||
// If the text is the default text "Name of new numerotation" save the edited context
|
||||
// With the the name "No name"
|
||||
if (m_context_cb_2 -> currentText() == tr("Nom de la nouvelle numérotation")) {
|
||||
project_->addFolioAutoNum (tr("Sans nom"), m_saw_2 -> toNumContext());
|
||||
m_context_cb_2 -> addItem(tr("Sans nom"));
|
||||
}
|
||||
// If the text isn't yet to the autonum of the project, add this new item to the combo box.
|
||||
else if ( !project_ -> folioAutoNum().keys().contains( m_context_cb_2->currentText())) {
|
||||
project()->addFolioAutoNum(m_context_cb_2->currentText(), m_saw_2->toNumContext());
|
||||
m_context_cb_2 -> addItem(m_context_cb_2->currentText());
|
||||
}
|
||||
// Else, the text already exist in the autonum of the project, just update the context
|
||||
else {
|
||||
project_->addFolioAutoNum (m_context_cb_2 -> currentText(), m_saw_2 -> toNumContext());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ProjectAutoNumConfigPage::applyAutoNum
|
||||
* Apply auto folio numbering, New Folios or Selected Folios
|
||||
*/
|
||||
/*
|
||||
void ProjectAutoNumConfigPage::applyAutoNum() {
|
||||
|
||||
if (m_faw->newFolios){
|
||||
int foliosRemaining = m_faw->newFoliosNumber();
|
||||
emit (saveCurrentTbp());
|
||||
emit (setAutoNum(m_faw->autoNumSelected()));
|
||||
while (foliosRemaining > 0){
|
||||
project()->autoFolioNumberingNewFolios();
|
||||
foliosRemaining = foliosRemaining-1;
|
||||
}
|
||||
emit (loadSavedTbp());
|
||||
}
|
||||
else{
|
||||
QString autoNum = m_faw->autoNumSelected();
|
||||
int fromFolio = m_faw->fromFolio();
|
||||
int toFolio = m_faw->toFolio();
|
||||
project_->autoFolioNumberingSelectedFolios(fromFolio,toFolio,autoNum);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief ProjectAutoNumConfigPage::removeContext
|
||||
* Remove from project the current numerotation context
|
||||
* Remove from project the current conductor numerotation context
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::removeContext() {
|
||||
//if default text, return
|
||||
@ -348,3 +484,37 @@ void ProjectAutoNumConfigPage::removeContext() {
|
||||
project_ -> removeConductorAutonum (m_context_cb -> currentText() );
|
||||
m_context_cb -> removeItem (m_context_cb -> currentIndex() );
|
||||
}
|
||||
/**
|
||||
* @brief ProjectAutoNumConfigPage::removeContext_2
|
||||
* Remove from project the current folio numerotation context
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::removeContext_2() {
|
||||
//if default text, return
|
||||
if ( m_context_cb_2 -> currentText() == tr("Nom de la nouvelle numérotation") ) return;
|
||||
project_ -> removeFolioAutoNum (m_context_cb_2 -> currentText() );
|
||||
m_context_cb_2 -> removeItem (m_context_cb_2 -> currentIndex() );
|
||||
}
|
||||
/**
|
||||
* @brief ProjectAutoNumConfigPage::changeToTab
|
||||
* @param tab index
|
||||
* Change to Selected Tab
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::changeToTab(int i){
|
||||
tab_widget->setCurrentIndex(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ProjectAutoNumConfigPage::tabChanged
|
||||
* @param tab index
|
||||
* Used to resize window to correct size
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::tabChanged(int i){
|
||||
if (i>0){
|
||||
if (tab_widget->currentIndex()==2){
|
||||
tab_widget->resize(470,tab_widget->height());
|
||||
}
|
||||
else {
|
||||
tab_widget->adjustSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,8 @@
|
||||
#ifndef PROJECTCONFIGPAGES_H
|
||||
#define PROJECTCONFIGPAGES_H
|
||||
#include "configpage.h"
|
||||
#include <QtWidgets>
|
||||
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QETProject;
|
||||
@ -32,6 +34,7 @@ class XRefPropertiesWidget;
|
||||
class SelectAutonumW;
|
||||
class QComboBox;
|
||||
class QPushButton;
|
||||
class FolioAutonumberingW;
|
||||
|
||||
/**
|
||||
This class, derived from ConfigPage, aims at providing the basic skeleton
|
||||
@ -128,27 +131,49 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage {
|
||||
virtual QString title() const;
|
||||
virtual QIcon icon() const;
|
||||
virtual void applyProjectConf();
|
||||
|
||||
virtual void changeToTab(int);
|
||||
protected:
|
||||
virtual void initWidgets();
|
||||
virtual void initLayout();
|
||||
virtual void readValuesFromProject();
|
||||
virtual void adjustReadOnly();
|
||||
|
||||
private:
|
||||
void buildConnections();
|
||||
|
||||
private slots:
|
||||
void updateContext(QString);
|
||||
void saveContext();
|
||||
void removeContext();
|
||||
void updateContext_2(QString);
|
||||
void saveContext_2();
|
||||
void removeContext_2();
|
||||
|
||||
// void applyAutoNum(); - Needs Further Testing
|
||||
|
||||
void tabChanged(int);
|
||||
|
||||
signals:
|
||||
void setAutoNum(QString);
|
||||
void setAutoNum(int,int);
|
||||
void saveCurrentTbp();
|
||||
void loadSavedTbp();
|
||||
|
||||
//Attributes
|
||||
private:
|
||||
QTabWidget *tab_widget;
|
||||
QWidget *element_widget;
|
||||
QWidget *conductor_tab_widget;
|
||||
QWidget *folio_tab_widget;
|
||||
QWidget *autoNumbering_tab_widget;
|
||||
QScrollArea *scrollArea;
|
||||
QLabel *m_label;
|
||||
QLabel *m_label_2;
|
||||
QComboBox *m_context_cb;
|
||||
QComboBox *m_context_cb_2;
|
||||
QPushButton *m_remove_pb;
|
||||
QPushButton *m_remove_pb_2;
|
||||
SelectAutonumW *m_saw;
|
||||
SelectAutonumW *m_saw_2;
|
||||
FolioAutonumberingW *m_faw;
|
||||
|
||||
};
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "qettemplateeditor.h"
|
||||
#include "diagramfoliolist.h"
|
||||
#include "projectpropertiesdialog.h"
|
||||
|
||||
#include <QTabWidget>
|
||||
|
||||
/**
|
||||
@ -81,6 +80,7 @@ void ProjectView::setProject(QETProject *project) {
|
||||
connect(project_, SIGNAL(projectTitleChanged(QETProject *, const QString &)), this, SLOT(updateWindowTitle()));
|
||||
connect(project_, SIGNAL(projectModified (QETProject *, bool)), this, SLOT(updateWindowTitle()));
|
||||
connect(project_, SIGNAL(readOnlyChanged (QETProject *, bool)), this, SLOT(adjustReadOnlyState()));
|
||||
connect(project_, SIGNAL(addAutoNumDiagram()), this, SLOT(addNewDiagram()));
|
||||
adjustReadOnlyState();
|
||||
loadDiagrams();
|
||||
}
|
||||
@ -138,6 +138,83 @@ void ProjectView::closeEvent(QCloseEvent *qce) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief change current diagramview to next folio
|
||||
*/
|
||||
void ProjectView::changeTabDown(){
|
||||
DiagramView *nextDiagramView = this->nextDiagram();
|
||||
if (nextDiagramView!=NULL){
|
||||
rebuildDiagramsMap();
|
||||
m_tab -> setCurrentWidget(nextDiagramView);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@return next folio of current diagramview
|
||||
*/
|
||||
DiagramView *ProjectView::nextDiagram() {
|
||||
int current_tab_index = m_tab -> currentIndex();
|
||||
int next_tab_index = current_tab_index + 1; //get next tab index
|
||||
if (next_tab_index<diagram_ids_.count()) //if next tab index >= greatest tab the last tab is activated so no need to change tab.
|
||||
return(diagram_ids_[next_tab_index]);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief change current diagramview to previous tab
|
||||
*/
|
||||
void ProjectView::changeTabUp(){
|
||||
DiagramView *previousDiagramView = this->previousDiagram();
|
||||
if (previousDiagramView!=NULL){
|
||||
rebuildDiagramsMap();
|
||||
m_tab -> setCurrentWidget(previousDiagramView);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@return previous folio of current diagramview
|
||||
*/
|
||||
DiagramView *ProjectView::previousDiagram() {
|
||||
int current_tab_index = m_tab -> currentIndex();
|
||||
int previous_tab_index = current_tab_index - 1; //get previous tab index
|
||||
if (previous_tab_index>=0) //if previous tab index = 0 then the first tab is activated so no need to change tab.
|
||||
return(diagram_ids_[previous_tab_index]);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief change current diagramview to last tab
|
||||
*/
|
||||
void ProjectView::changeLastTab(){
|
||||
DiagramView *lastDiagramView = this->lastDiagram();
|
||||
m_tab->setCurrentWidget(lastDiagramView);
|
||||
}
|
||||
|
||||
/**
|
||||
@return last folio of current project
|
||||
*/
|
||||
DiagramView *ProjectView::lastDiagram(){
|
||||
return(diagram_ids_.last());
|
||||
}
|
||||
|
||||
/**
|
||||
@brief change current diagramview to first tab
|
||||
*/
|
||||
void ProjectView::changeFirstTab(){
|
||||
DiagramView *firstDiagramView = this->firstDiagram();
|
||||
m_tab->setCurrentWidget(firstDiagramView);
|
||||
}
|
||||
|
||||
/**
|
||||
@return first folio of current project
|
||||
*/
|
||||
DiagramView *ProjectView::firstDiagram(){
|
||||
return(diagram_ids_.first());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Cette methode essaye de fermer successivement les editeurs d'element puis
|
||||
les schemas du projet. L'utilisateur peut refuser de fermer un schema ou un
|
||||
|
@ -56,6 +56,10 @@ class ProjectView : public QWidget {
|
||||
QList<Diagram *> getDiagrams(ProjectSaveOptions options);
|
||||
DiagramView *currentDiagram() const;
|
||||
void closeEvent(QCloseEvent *);
|
||||
void changeTabUp();
|
||||
void changeTabDown();
|
||||
void changeFirstTab();
|
||||
void changeLastTab();
|
||||
|
||||
public slots:
|
||||
void addNewDiagram();
|
||||
@ -109,6 +113,10 @@ class ProjectView : public QWidget {
|
||||
void initLayout();
|
||||
void loadDiagrams();
|
||||
DiagramView *findDiagram(Diagram *);
|
||||
DiagramView *nextDiagram();
|
||||
DiagramView *previousDiagram();
|
||||
DiagramView *firstDiagram();
|
||||
DiagramView *lastDiagram();
|
||||
void rebuildDiagramsMap();
|
||||
bool tryClosing();
|
||||
bool tryClosingElementEditors();
|
||||
|
@ -1524,6 +1524,34 @@ ProjectView *QETDiagramEditor::viewForFile(const QString &filepath) const {
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETDiagramEditor::acessCurrentProject
|
||||
* Retrieve current Project open in diagram editor
|
||||
*/
|
||||
ProjectView *QETDiagramEditor::acessCurrentProject (){
|
||||
QMdiSubWindow *current_window = workspace.activeSubWindow();
|
||||
if (!current_window) return(0);
|
||||
|
||||
QWidget *current_widget = current_window -> widget();
|
||||
if (!current_widget) return(0);
|
||||
|
||||
if (ProjectView *project_view = qobject_cast<ProjectView *>(current_widget)) {
|
||||
return(project_view);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETDiagramEditor::acessCurrentDiagramView
|
||||
* Retrieve current DiagramView used in diagram editor
|
||||
*/
|
||||
DiagramView *QETDiagramEditor::acessCurrentDiagramView () {
|
||||
if (ProjectView *project_view = currentProject()) {
|
||||
return(project_view -> currentDiagram());
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
met a jour le menu "Fenetres"
|
||||
*/
|
||||
|
@ -65,6 +65,8 @@ class QETDiagramEditor : public QETMainWindow {
|
||||
bool openAndAddProject (const QString &, bool = true, bool = true);
|
||||
QList<QString> editedFiles () const;
|
||||
ProjectView *viewForFile (const QString &) const;
|
||||
ProjectView *acessCurrentProject ();
|
||||
DiagramView *acessCurrentDiagramView ();
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent *);
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "integrationmovetemplateshandler.h"
|
||||
#include "xmlelementcollection.h"
|
||||
#include "importelementdialog.h"
|
||||
#include "numerotationcontextcommands.h"
|
||||
|
||||
|
||||
#include <QStandardPaths>
|
||||
|
||||
@ -54,7 +56,8 @@ QETProject::QETProject(int diagrams, QObject *parent) :
|
||||
titleblocks_ (this ),
|
||||
folioSheetsQuantity (0 ),
|
||||
m_auto_conductor (true ),
|
||||
m_elements_collection (nullptr)
|
||||
m_elements_collection (nullptr),
|
||||
m_auto_folio (true )
|
||||
{
|
||||
// 0 a n schema(s) vide(s)
|
||||
int diagrams_count = qMax(0, diagrams);
|
||||
@ -91,7 +94,8 @@ QETProject::QETProject(const QString &path, QObject *parent) :
|
||||
titleblocks_ (this ),
|
||||
folioSheetsQuantity (0 ),
|
||||
m_auto_conductor (true ),
|
||||
m_elements_collection (nullptr)
|
||||
m_elements_collection (nullptr),
|
||||
m_auto_folio (true )
|
||||
{
|
||||
//Open the file
|
||||
QFile project_file(path);
|
||||
@ -442,9 +446,17 @@ QHash <QString, NumerotationContext> QETProject::conductorAutoNum() const {
|
||||
return m_conductor_autonum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::folioAutoNum
|
||||
* @return All value of conductor autonum stored in project
|
||||
*/
|
||||
QHash <QString, NumerotationContext> QETProject::folioAutoNum() const {
|
||||
return m_folio_autonum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::addConductorAutoNum
|
||||
* Add a new numerotation context. If key already exist,
|
||||
* Add a new conductor numerotation context. If key already exist,
|
||||
* replace old context by the new context
|
||||
* @param key
|
||||
* @param context
|
||||
@ -453,18 +465,38 @@ void QETProject::addConductorAutoNum(QString key, NumerotationContext context) {
|
||||
m_conductor_autonum.insert(key, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::addFolioAutoNum
|
||||
* Add a new folio numerotation context. If key already exist,
|
||||
* replace old context by the new context
|
||||
* @param key
|
||||
* @param context
|
||||
*/
|
||||
void QETProject::addFolioAutoNum(QString key, NumerotationContext context) {
|
||||
m_folio_autonum.insert(key, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::removeConductorAutonum
|
||||
* Remove the Numerotation Context stored with key
|
||||
* Remove Conductor Numerotation Context stored with key
|
||||
* @param key
|
||||
*/
|
||||
void QETProject::removeConductorAutonum(QString key) {
|
||||
m_conductor_autonum.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::removeFolioAutonum
|
||||
* Remove Folio Numerotation Context stored with key
|
||||
* @param key
|
||||
*/
|
||||
void QETProject::removeFolioAutoNum(QString key) {
|
||||
m_folio_autonum.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::conductorAutoNum
|
||||
* Return the numerotation context stored with @key.
|
||||
* Return conductor numerotation context stored with @key.
|
||||
* If key is not found, return an empty numerotation context
|
||||
* @param key
|
||||
*/
|
||||
@ -473,6 +505,17 @@ NumerotationContext QETProject::conductorAutoNum (const QString &key) const {
|
||||
else return NumerotationContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::folioAutoNum
|
||||
* Return folio numerotation context stored with @key.
|
||||
* If key is not found, return an empty numerotation context
|
||||
* @param key
|
||||
*/
|
||||
NumerotationContext QETProject::folioAutoNum (const QString &key) const {
|
||||
if (m_folio_autonum.contains(key)) return m_folio_autonum[key];
|
||||
else return NumerotationContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::autoConductor
|
||||
* @return true if use of auto conductor is authorized.
|
||||
@ -483,6 +526,16 @@ bool QETProject::autoConductor() const
|
||||
return m_auto_conductor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::autoFolio
|
||||
* @return true if use of auto folio is authorized.
|
||||
* See also Q_PROPERTY autoFolio
|
||||
*/
|
||||
bool QETProject::autoFolio() const
|
||||
{
|
||||
return m_auto_folio;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::setAutoConductor
|
||||
* @param ac
|
||||
@ -495,6 +548,46 @@ void QETProject::setAutoConductor(bool ac)
|
||||
m_auto_conductor = ac;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::setAutoFolio
|
||||
* @param ac
|
||||
* Enable the use of auto folio if true
|
||||
* See also Q_PROPERTY autoConductor
|
||||
*/
|
||||
void QETProject::setAutoFolio(bool af)
|
||||
{
|
||||
if (af != m_auto_folio)
|
||||
m_auto_folio = af;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::autoFolioNumberingNewFolios
|
||||
* emit Signal to add new Diagram with autonum
|
||||
* properties
|
||||
*/
|
||||
void QETProject::autoFolioNumberingNewFolios(){
|
||||
emit addAutoNumDiagram();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::autoFolioNumberingNewFolios
|
||||
* @param autonum used, index from selected tabs "from" and "to"
|
||||
* rename folios with selected autonum
|
||||
*/
|
||||
void QETProject::autoFolioNumberingSelectedFolios(int from, int to, QString autonum){
|
||||
int total_folio = diagrams_.count();
|
||||
DiagramContext project_wide_properties = project_properties_;
|
||||
for (int i=from; i<=to; i++) {
|
||||
QString title = diagrams_[i] -> title();
|
||||
NumerotationContext nC = folioAutoNum(autonum);
|
||||
NumerotationContextCommands nCC = NumerotationContextCommands(nC);
|
||||
diagrams_[i] -> border_and_titleblock.setFolio("%autonum");
|
||||
diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, nCC.toRepresentedString(), project_wide_properties);
|
||||
diagrams_[i] -> project() -> addFolioAutoNum(autonum,nCC.next());
|
||||
diagrams_[i] -> update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@return un document XML representant le projet
|
||||
*/
|
||||
@ -1157,7 +1250,7 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
||||
m_default_xref_properties = XRefProperties:: defaultProperties();
|
||||
|
||||
//Read values indicate in project
|
||||
QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt, conds_autonums;
|
||||
QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt, conds_autonums, folio_autonums;
|
||||
|
||||
for (QDomNode child = newdiagrams_elmt.firstChild() ; !child.isNull() ; child = child.nextSibling())
|
||||
{
|
||||
@ -1176,6 +1269,8 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
||||
xref_elmt = child_elmt;
|
||||
else if (child_elmt.tagName() == "conductors_autonums")
|
||||
conds_autonums = child_elmt;
|
||||
else if (child_elmt.tagName()== "folio_autonums")
|
||||
folio_autonums = child_elmt;
|
||||
}
|
||||
|
||||
// size, titleblock, conductor, report, conductor autonum
|
||||
@ -1201,6 +1296,15 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
||||
m_conductor_autonum.insert(elmt.attribute("title"), nc);
|
||||
}
|
||||
}
|
||||
if (!folio_autonums.isNull())
|
||||
{
|
||||
foreach (QDomElement elmt, QET::findInDomElement(folio_autonums, "folio_autonum"))
|
||||
{
|
||||
NumerotationContext nc;
|
||||
nc.fromXml(elmt);
|
||||
m_folio_autonum.insert(elmt.attribute("title"), nc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1261,6 +1365,15 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
|
||||
conds_autonums.appendChild(cond_autonum);
|
||||
}
|
||||
xml_element.appendChild(conds_autonums);
|
||||
|
||||
//Export Folio Autonums
|
||||
QDomElement folio_autonums = xml_document.createElement("folio_autonums");
|
||||
foreach (QString key, folioAutoNum().keys()) {
|
||||
QDomElement folio_autonum = folioAutoNum(key).toXml(xml_document, "folio_autonum");
|
||||
folio_autonum.setAttribute("title", key);
|
||||
folio_autonums.appendChild(folio_autonum);
|
||||
}
|
||||
xml_element.appendChild(folio_autonums);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1416,7 +1529,17 @@ void QETProject::updateDiagramsFolioData() {
|
||||
project_wide_properties.addValue("projecttitle", title());
|
||||
|
||||
for (int i = 0 ; i < total_folio ; ++ i) {
|
||||
diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, project_wide_properties);
|
||||
QString title = diagrams_[i] -> title();
|
||||
QString autopagenum = diagrams_[i]->border_and_titleblock.autoPageNum();
|
||||
NumerotationContext nC = folioAutoNum(autopagenum);
|
||||
NumerotationContextCommands nCC = NumerotationContextCommands(nC);
|
||||
if((diagrams_[i]->border_and_titleblock.folio().contains("%autonum"))&&(!autopagenum.isNull())){
|
||||
diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, nCC.toRepresentedString(), project_wide_properties);
|
||||
diagrams_[i]->project()->addFolioAutoNum(autopagenum,nCC.next());
|
||||
}
|
||||
else{
|
||||
diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, NULL, project_wide_properties);
|
||||
}
|
||||
diagrams_[i] -> update();
|
||||
}
|
||||
}
|
||||
|
@ -115,12 +115,21 @@ class QETProject : public QObject
|
||||
void setDefaultXRefProperties(QHash <QString, XRefProperties> hash);
|
||||
|
||||
QHash <QString, NumerotationContext> conductorAutoNum() const;
|
||||
QHash <QString, NumerotationContext> folioAutoNum() const;
|
||||
void addConductorAutoNum (QString key, NumerotationContext context);
|
||||
void addFolioAutoNum (QString key, NumerotationContext context);
|
||||
void removeConductorAutonum (QString key);
|
||||
void removeFolioAutoNum (QString key);
|
||||
NumerotationContext conductorAutoNum(const QString &key) const;
|
||||
NumerotationContext folioAutoNum(const QString &key) const;
|
||||
|
||||
bool autoConductor () const;
|
||||
bool autoFolio () const;
|
||||
void setAutoConductor (bool ac);
|
||||
void setAutoFolio (bool af);
|
||||
void autoFolioNumberingNewFolios ();
|
||||
void autoFolioNumberingSelectedFolios(int, int, QString);
|
||||
|
||||
QDomDocument toXml();
|
||||
bool close();
|
||||
QETResult write();
|
||||
@ -162,6 +171,7 @@ class QETProject : public QObject
|
||||
void readOnlyChanged(QETProject *, bool);
|
||||
void reportPropertiesChanged(QString);
|
||||
void XRefPropertiesChanged ();
|
||||
void addAutoNumDiagram();
|
||||
|
||||
private slots:
|
||||
void updateDiagramsFolioData();
|
||||
@ -226,10 +236,12 @@ class QETProject : public QObject
|
||||
QUndoStack *undo_stack_;
|
||||
/// Conductor auto numerotation
|
||||
QHash <QString, NumerotationContext> m_conductor_autonum;
|
||||
QHash <QString, NumerotationContext> m_folio_autonum;
|
||||
/// Folio List Sheets quantity for this project.
|
||||
int folioSheetsQuantity;
|
||||
bool m_auto_conductor;
|
||||
XmlElementCollection *m_elements_collection;
|
||||
bool m_auto_folio;
|
||||
};
|
||||
Q_DECLARE_METATYPE(QETProject *)
|
||||
#endif
|
||||
|
@ -48,6 +48,7 @@ bool TitleBlockProperties::operator==(const TitleBlockProperties &ip) {
|
||||
ip.date == date &&\
|
||||
ip.filename == filename &&\
|
||||
ip.folio == folio &&\
|
||||
ip.auto_page_num == auto_page_num &&\
|
||||
ip.template_name == template_name &&\
|
||||
ip.context == context &&\
|
||||
ip.display_at == display_at &&\
|
||||
@ -73,6 +74,7 @@ void TitleBlockProperties::toXml(QDomElement &e) const {
|
||||
e.setAttribute("title", title);
|
||||
e.setAttribute("filename", filename);
|
||||
e.setAttribute("folio", folio);
|
||||
e.setAttribute("auto_page_num", auto_page_num);
|
||||
e.setAttribute("date", exportDate());
|
||||
e.setAttribute("displayAt", (display_at == Qt::BottomEdge? "bottom" : "right"));
|
||||
if (!template_name.isEmpty())
|
||||
@ -98,6 +100,7 @@ void TitleBlockProperties::fromXml(const QDomElement &e) {
|
||||
if (e.hasAttribute("title")) title = e.attribute("title");
|
||||
if (e.hasAttribute("filename")) filename = e.attribute("filename");
|
||||
if (e.hasAttribute("folio")) folio = e.attribute("folio");
|
||||
if (e.hasAttribute("auto_page_num")) auto_page_num = e.attribute("auto_page_num");
|
||||
if (e.hasAttribute("date")) setDateFromString(e.attribute("date"));
|
||||
if (e.hasAttribute("displayAt")) display_at = (e.attribute("displayAt") == "bottom" ? Qt::BottomEdge : Qt::RightEdge);
|
||||
|
||||
@ -126,6 +129,7 @@ void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix
|
||||
settings.setValue(prefix + "author", author);
|
||||
settings.setValue(prefix + "filename", filename);
|
||||
settings.setValue(prefix + "folio", folio);
|
||||
settings.setValue(prefix + "auto_page_num", auto_page_num);
|
||||
settings.setValue(prefix + "date", exportDate());
|
||||
settings.setValue(prefix + "displayAt", (display_at == Qt::BottomEdge? "bottom" : "right"));
|
||||
settings.setValue(prefix + "titleblocktemplate", template_name.isEmpty()? QString() : template_name);
|
||||
@ -143,6 +147,7 @@ void TitleBlockProperties::fromSettings(QSettings &settings, const QString &pref
|
||||
author = settings.value(prefix + "author").toString();
|
||||
filename = settings.value(prefix + "filename").toString();
|
||||
folio = settings.value(prefix + "folio", "%id/%total").toString();
|
||||
auto_page_num = settings.value(prefix + "auto_page_num").toString();
|
||||
setDateFromString(settings.value(prefix + "date").toString());
|
||||
display_at = (settings.value(prefix + "displayAt", QVariant("bottom")).toString() == "bottom" ? Qt::BottomEdge : Qt::RightEdge);
|
||||
template_name = settings.value(prefix + "titleblocktemplate").toString();
|
||||
|
@ -53,6 +53,7 @@ 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;
|
||||
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
|
||||
|
@ -55,12 +55,14 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare
|
||||
//Title block widget
|
||||
TitleBlockPropertiesWidget *titleblock_infos;
|
||||
if (QETProject *parent_project = diagram -> project()) {
|
||||
titleblock_infos = new TitleBlockPropertiesWidget(parent_project -> embeddedTitleBlockTemplatesCollection(), titleblock, false, this);
|
||||
titleblock_infos = new TitleBlockPropertiesWidget(parent_project -> embeddedTitleBlockTemplatesCollection(), titleblock, false, diagram->project(), this);
|
||||
connect(titleblock_infos, SIGNAL(editTitleBlockTemplate(QString, bool)), diagram->views().first(), SIGNAL(editTitleBlockTemplate(QString, bool)));
|
||||
}
|
||||
else
|
||||
titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, this);
|
||||
titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, diagram->project(), this);
|
||||
titleblock_infos -> setReadOnly(diagram_is_read_only);
|
||||
connect(titleblock_infos,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(editAutoFolioNum()));
|
||||
titleblock_infos->setMinimumSize(590,480); //Minimum Size needed for correct display
|
||||
|
||||
//Conductor widget
|
||||
ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(conductors, this);
|
||||
@ -124,7 +126,7 @@ void DiagramPropertiesDialog::diagramPropertiesDialog(Diagram *diagram, QWidget
|
||||
|
||||
/**
|
||||
* @brief DiagramPropertiesDialog::editAutonum
|
||||
* Open the autonum editor
|
||||
* Open conductor autonum editor
|
||||
*/
|
||||
void DiagramPropertiesDialog::editAutonum() {
|
||||
ProjectPropertiesDialog ppd (m_diagram->project(), this);
|
||||
@ -132,3 +134,14 @@ void DiagramPropertiesDialog::editAutonum() {
|
||||
ppd.exec();
|
||||
m_asw -> setItems (m_diagram -> project() -> conductorAutoNum().keys());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramPropertiesDialog::editAutonum
|
||||
* Open folio autonum editor
|
||||
*/
|
||||
void DiagramPropertiesDialog::editAutoFolioNum () {
|
||||
ProjectPropertiesDialog ppd (m_diagram->project(), this);
|
||||
ppd.setCurrentPage(ProjectPropertiesDialog::Autonum);
|
||||
ppd.changeToFolio();
|
||||
ppd.exec();
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ class DiagramPropertiesDialog : public QDialog {
|
||||
|
||||
public slots:
|
||||
void editAutonum ();
|
||||
void editAutoFolioNum ();
|
||||
|
||||
private:
|
||||
Diagram *m_diagram;
|
||||
|
218
sources/ui/folioautonumbering.cpp
Normal file
218
sources/ui/folioautonumbering.cpp
Normal file
@ -0,0 +1,218 @@
|
||||
/*
|
||||
Copyright 2006-2015 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "folioautonumbering.h"
|
||||
#include "ui_folioautonumbering.h"
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QtWidgets>
|
||||
#include "qdebug.h"
|
||||
#include "qetproject.h"
|
||||
#include "diagram.h"
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
FolioAutonumberingW::FolioAutonumberingW(QETProject *project, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
project_(project),
|
||||
ui(new Ui::FolioAutonumberingW)
|
||||
|
||||
{
|
||||
ui->setupUi(this);
|
||||
applyEnable(false);
|
||||
ui->m_from_cb->setEnabled(false);
|
||||
ui->m_new_tabs_sb->setEnabled(false);
|
||||
ui->m_to_cb->setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
FolioAutonumberingW::~FolioAutonumberingW()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::setContext
|
||||
* construct autonums in the comboBox selected in the @autonum_chooser QcomboBox
|
||||
*/
|
||||
void FolioAutonumberingW::setContext(QList <QString> autonums) {
|
||||
foreach (QString str, autonums) { ui->m_autonums_cb->addItem(str);}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::autoNumSelected
|
||||
* returns the current autonum selected
|
||||
*/
|
||||
QString FolioAutonumberingW::autoNumSelected(){
|
||||
return ui->m_autonums_cb->currentText();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::fromFolio
|
||||
* returns the current "From Folio" index
|
||||
*/
|
||||
int FolioAutonumberingW::fromFolio(){
|
||||
return ui->m_from_cb->currentIndex()-1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::toFolio
|
||||
* returns the current "To Folio" index
|
||||
*/
|
||||
int FolioAutonumberingW::toFolio(){
|
||||
return ui->m_to_cb->currentIndex()+this->fromFolio()+1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::newFoliosNumber
|
||||
* returns the number of folios to create
|
||||
*/
|
||||
int FolioAutonumberingW::newFoliosNumber(){
|
||||
return ui->m_new_tabs_sb->value();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::updateFolioList
|
||||
* update Folio List in From and To ComboBox
|
||||
*/
|
||||
void FolioAutonumberingW::updateFolioList(){
|
||||
ui -> m_from_cb->clear();
|
||||
ui -> m_to_cb->clear();
|
||||
if (newFolios){
|
||||
this -> on_m_create_new_tabs_rb_clicked();
|
||||
} else {
|
||||
this -> on_m_autonumber_tabs_rb_clicked();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::on_m_create_new_tabs_rb_clicked
|
||||
* Enable New Tabs SpinBox
|
||||
*/
|
||||
void FolioAutonumberingW::on_m_create_new_tabs_rb_clicked() {
|
||||
ui->m_from_cb->setEnabled(false);
|
||||
ui->m_to_cb->setEnabled(false);
|
||||
ui->m_new_tabs_sb->setEnabled(true);
|
||||
applyEnable();
|
||||
newFolios = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked
|
||||
* Enable From ComboBox, fill From ComboBox
|
||||
*/
|
||||
void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked() {
|
||||
ui->m_new_tabs_sb->setEnabled(false);
|
||||
ui->m_from_cb->setEnabled(true);
|
||||
ui->m_to_cb->setEnabled(true);
|
||||
if (ui->m_from_cb->count()<=0){
|
||||
ui->m_from_cb->clear();
|
||||
ui->m_from_cb->addItem("");
|
||||
foreach (Diagram *diagram, project_->diagrams()){
|
||||
ui->m_from_cb->addItem(diagram->title());
|
||||
}
|
||||
}
|
||||
applyEnable();
|
||||
newFolios = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::on_m_new_tabs_sb_valueChanged
|
||||
* Enable Apply if any new folio is to be created
|
||||
*/
|
||||
void FolioAutonumberingW::on_m_new_tabs_sb_valueChanged(){
|
||||
if (ui->m_new_tabs_sb->value()>0) applyEnable(true);
|
||||
else applyEnable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::on_m_from_cb_currentIndexChanged
|
||||
* Enable To ComboBox
|
||||
*/
|
||||
void FolioAutonumberingW::on_m_from_cb_currentIndexChanged(){
|
||||
int index = ui->m_from_cb->currentIndex();
|
||||
ui->m_to_cb->clear();
|
||||
if (index > 0){
|
||||
ui->m_to_cb->setEnabled(true);
|
||||
for (int i=index;i<project_->diagrams().size();i++)
|
||||
ui->m_to_cb->addItem(project_->diagrams().at(i)->title());
|
||||
applyEnable(true);
|
||||
}
|
||||
else{
|
||||
applyEnable();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::on_buttonBox_clicked
|
||||
* Action on @buttonBox clicked
|
||||
*/
|
||||
void FolioAutonumberingW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
//transform button to int
|
||||
int answer = ui -> buttonBox -> buttonRole(button);
|
||||
|
||||
switch (answer) {
|
||||
//help dialog - not implemented yet -
|
||||
case QDialogButtonBox::HelpRole:
|
||||
break;
|
||||
/*QMessageBox::information (this, tr("Folio Autonumbering", "title window"),
|
||||
tr("C'est ici que vous pouvez définir la manière dont sera numéroté les nouveaux conducteurs.\n"
|
||||
"-Une numérotation est composée d'une variable minimum.\n"
|
||||
"-Vous pouvez ajouter ou supprimer une variable de numérotation par le biais des boutons - et +.\n"
|
||||
"-Une variable de numérotation comprant: un type, une valeur et une incrémentation.\n"
|
||||
|
||||
"\n-les types \"Chiffre 1\", \"Chiffre 01\" et \"Chiffre 001\", représente un type numérique définie dans le champs \"Valeur\", "
|
||||
"qui s'incrémente à chaque nouveau conducteur de la valeur du champ \"Incrémentation\".\n"
|
||||
"-\"Chiffre 01\" et \"Chiffre 001\", sont respectivement représenté sur le schéma par deux et trois digits minimum.\n"
|
||||
"Si le chiffre définie dans le champs Valeur posséde moins de digits que le type choisit,"
|
||||
"celui-ci sera précédé par un ou deux 0 afin de respecter son type.\n"
|
||||
|
||||
"\n-Le type \"Texte\", représente un texte fixe.\nLe champs \"Incrémentation\" n'est pas utilisé.\n"
|
||||
|
||||
"\n-Le type \"N° folio\" représente le n° du folio en cours.\nLes autres champs ne sont pas utilisés.",
|
||||
"help dialog about the autonumerotation")); */
|
||||
case QDialogButtonBox::ApplyRole:
|
||||
applyEnable(true);
|
||||
emit applyPressed();
|
||||
updateFolioList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::applyEnable
|
||||
* enable/disable the apply button
|
||||
*/
|
||||
void FolioAutonumberingW::applyEnable(bool b) {
|
||||
if (b){
|
||||
bool valid = true;
|
||||
if (ui->m_create_new_tabs_rb->isChecked()){
|
||||
if (ui->m_new_tabs_sb->value()==0) valid = false;
|
||||
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(valid);
|
||||
}
|
||||
else{
|
||||
if (ui->m_to_cb->currentText()=="") valid = false;
|
||||
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(valid);
|
||||
}
|
||||
}
|
||||
else{
|
||||
ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(b);
|
||||
}
|
||||
}
|
72
sources/ui/folioautonumbering.h
Normal file
72
sources/ui/folioautonumbering.h
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
Copyright 2006-2015 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef FOLIOAUTONUMBERING_H
|
||||
#define FOLIOAUTONUMBERING_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "numerotationcontext.h"
|
||||
|
||||
class NumPartEditorW;
|
||||
class QAbstractButton;
|
||||
class QETProject;
|
||||
|
||||
namespace Ui {
|
||||
class FolioAutonumberingW;
|
||||
}
|
||||
|
||||
class FolioAutonumberingW : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
//METHODS
|
||||
public:
|
||||
explicit FolioAutonumberingW(QETProject *project, QWidget *parent = 0);
|
||||
~FolioAutonumberingW();
|
||||
|
||||
void setContext (QList <QString> autonums);
|
||||
NumerotationContext toNumContext() const;
|
||||
QString autoNumSelected();
|
||||
int newFoliosNumber();
|
||||
bool newFolios;
|
||||
int fromFolio();
|
||||
int toFolio();
|
||||
|
||||
// SIGNALS
|
||||
signals:
|
||||
void applyPressed();
|
||||
void m_autonumber_tabs_rb_clicked();
|
||||
|
||||
//SLOTS
|
||||
private slots:
|
||||
void on_m_create_new_tabs_rb_clicked();
|
||||
void on_m_autonumber_tabs_rb_clicked();
|
||||
void on_m_new_tabs_sb_valueChanged();
|
||||
void on_buttonBox_clicked(QAbstractButton *);
|
||||
void on_m_from_cb_currentIndexChanged();
|
||||
void applyEnable (bool = true);
|
||||
|
||||
//ATTRIBUTES
|
||||
private:
|
||||
QETProject *project_;
|
||||
Ui::FolioAutonumberingW *ui;
|
||||
QList <NumPartEditorW *> num_part_list_;
|
||||
NumerotationContext m_context;
|
||||
void updateFolioList();
|
||||
};
|
||||
|
||||
#endif // FOLIOAUTONUMBERING_H
|
295
sources/ui/folioautonumbering.ui
Normal file
295
sources/ui/folioautonumbering.ui
Normal file
@ -0,0 +1,295 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FolioAutonumberingW</class>
|
||||
<widget class="QWidget" name="FolioAutonumberingW">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>467</width>
|
||||
<height>550</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>460</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>50</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>450</width>
|
||||
<height>253</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>448</width>
|
||||
<height>497</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>430</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QGroupBox" name="Options">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Numbering Options</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="m_to_cb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New Tabs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_from_cb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="m_new_tabs_sb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999</number>
|
||||
</property>
|
||||
<property name="displayIntegerBase">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>To</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>From</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QGroupBox" name="Select">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Select:</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_create_new_tabs_rb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create New Tabs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_autonumber_tabs_rb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Autonumber Selected Tabs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Folio Auto Numbering:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="m_autonums_cb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Help|QDialogButtonBox::Reset</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -28,11 +28,18 @@
|
||||
* @param parent : parent widget of this dialog
|
||||
*/
|
||||
ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *parent) {
|
||||
NewDiagramPage *newDiagramPage = new NewDiagramPage(project,parent,this);
|
||||
ProjectAutoNumConfigPage *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project);
|
||||
m_properties_dialog = new ConfigDialog (parent);
|
||||
m_properties_dialog -> setWindowTitle(QObject::tr("Propriétés du projet", "window title"));
|
||||
m_properties_dialog -> addPage(new ProjectMainConfigPage (project));
|
||||
m_properties_dialog -> addPage(new NewDiagramPage (project));
|
||||
m_properties_dialog -> addPage(new ProjectAutoNumConfigPage (project));
|
||||
m_properties_dialog -> addPage(newDiagramPage);
|
||||
m_properties_dialog -> addPage(projectAutoNumConfigPage);
|
||||
connect(projectAutoNumConfigPage,SIGNAL(setAutoNum(QString)),newDiagramPage,SLOT(setFolioAutonum(QString)));
|
||||
connect(projectAutoNumConfigPage,SIGNAL(saveCurrentTbp()),newDiagramPage,SLOT(saveCurrentTbp()));
|
||||
connect(projectAutoNumConfigPage,SIGNAL(loadSavedTbp()),newDiagramPage,SLOT(loadSavedTbp()));
|
||||
m_properties_dialog->setMinimumHeight(690);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -58,3 +65,12 @@ void ProjectPropertiesDialog::exec() {
|
||||
void ProjectPropertiesDialog::setCurrentPage(ProjectPropertiesDialog::Page p) {
|
||||
m_properties_dialog -> setCurrentPage(static_cast <int> (p));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ProjectPropertiesDialog::changeToFolio
|
||||
* Change the current displayed tab to folio tab.
|
||||
*/
|
||||
void ProjectPropertiesDialog::changeToFolio() {
|
||||
ProjectAutoNumConfigPage *autoNumPage = static_cast <ProjectAutoNumConfigPage*>(m_properties_dialog->pages.at(2));
|
||||
autoNumPage->changeToTab(1);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
#ifndef PROJECTPROPERTIESDIALOG_H
|
||||
#define PROJECTPROPERTIESDIALOG_H
|
||||
#include <QtCore>
|
||||
|
||||
class QETProject;
|
||||
class QWidget;
|
||||
@ -26,8 +27,7 @@ class ConfigDialog;
|
||||
* @brief The ProjectPropertiesDialog class
|
||||
* this class builds a dialog to edit whole properties of a project
|
||||
*/
|
||||
class ProjectPropertiesDialog
|
||||
{
|
||||
class ProjectPropertiesDialog : public QObject {
|
||||
public:
|
||||
enum Page {
|
||||
Main = 0,
|
||||
@ -39,6 +39,7 @@ class ProjectPropertiesDialog
|
||||
~ProjectPropertiesDialog();
|
||||
void exec();
|
||||
void setCurrentPage(ProjectPropertiesDialog::Page);
|
||||
void changeToFolio();
|
||||
|
||||
private:
|
||||
ConfigDialog *m_properties_dialog;
|
||||
|
@ -6,25 +6,112 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>432</width>
|
||||
<height>273</height>
|
||||
<width>466</width>
|
||||
<height>506</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>430</width>
|
||||
<height>455</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>460</width>
|
||||
<height>453</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>460</width>
|
||||
<height>450</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="definition_groupe">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Définition</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
@ -116,15 +203,21 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="editor_layout">
|
||||
<layout class="QVBoxLayout" name="editor_layout" stretch="0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="label_layout">
|
||||
<layout class="QHBoxLayout" name="label_layout" stretch="0,0,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="type_label">
|
||||
<property name="text">
|
||||
@ -165,24 +258,37 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Help|QDialogButtonBox::Reset</set>
|
||||
</property>
|
||||
|
@ -29,12 +29,12 @@
|
||||
* @param current_date if true, display the radio button "current date"
|
||||
* @param parent parent widget
|
||||
*/
|
||||
TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) :
|
||||
TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock, bool current_date, QETProject *project, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::TitleBlockPropertiesWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
initDialog(current_date);
|
||||
initDialog(current_date, project);
|
||||
setProperties(titleblock);
|
||||
}
|
||||
|
||||
@ -46,12 +46,12 @@ TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockPropertie
|
||||
* @param current_date if true, display the radio button "current date"
|
||||
* @param parent parent widget
|
||||
*/
|
||||
TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) :
|
||||
TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QETProject *project, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::TitleBlockPropertiesWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
initDialog(current_date);
|
||||
initDialog(current_date,project);
|
||||
addCollection(tbt_collection);
|
||||
updateTemplateList();
|
||||
setProperties(titleblock);
|
||||
@ -65,12 +65,12 @@ TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(TitleBlockTemplatesCollec
|
||||
* @param current_date if true, display the radio button "current date"
|
||||
* @param parent parent widget
|
||||
*/
|
||||
TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(QList<TitleBlockTemplatesCollection *> tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) :
|
||||
TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(QList<TitleBlockTemplatesCollection *> tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QETProject *project, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::TitleBlockPropertiesWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
initDialog(current_date);
|
||||
initDialog(current_date,project);
|
||||
foreach (TitleBlockTemplatesCollection *c, tbt_collection)
|
||||
addCollection(c);
|
||||
updateTemplateList();
|
||||
@ -96,6 +96,7 @@ void TitleBlockPropertiesWidget::setProperties(const TitleBlockProperties &prope
|
||||
ui -> m_file_le -> setText (properties.filename);
|
||||
ui -> m_folio_le -> setText (properties.folio);
|
||||
ui -> m_display_at_cb -> setCurrentIndex(properties.display_at == Qt::BottomEdge ? 0 : 1);
|
||||
ui->auto_page_cb->setCurrentText(properties.auto_page_num);
|
||||
|
||||
//About date
|
||||
ui -> m_date_now_pb -> setDisabled(true);
|
||||
@ -172,6 +173,46 @@ TitleBlockProperties TitleBlockPropertiesWidget::properties() const {
|
||||
|
||||
prop.context = m_dcw -> context();
|
||||
|
||||
prop.auto_page_num = ui->auto_page_cb->currentText();
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TitleBlockPropertiesWidget::properties
|
||||
* @return return properties to enable folio autonum
|
||||
*/
|
||||
TitleBlockProperties TitleBlockPropertiesWidget::propertiesAutoNum(QString autoNum) const {
|
||||
TitleBlockProperties prop;
|
||||
prop.title = ui -> m_title_le -> text();
|
||||
prop.author = ui -> m_author_le -> text();
|
||||
prop.filename = ui -> m_file_le -> text();
|
||||
prop.folio = "%autonum";
|
||||
prop.display_at = ui -> m_display_at_cb -> currentIndex() == 0 ? Qt::BottomEdge : Qt::RightEdge;
|
||||
|
||||
if (ui->m_no_date_rb->isChecked()) {
|
||||
prop.useDate = TitleBlockProperties::UseDateValue;
|
||||
prop.date = QDate();
|
||||
}
|
||||
else if (ui -> m_fixed_date_rb -> isChecked()) {
|
||||
prop.useDate = TitleBlockProperties::UseDateValue;
|
||||
prop.date = ui->m_date_edit->date();
|
||||
}
|
||||
else if (ui->m_current_date_rb->isVisible() && ui->m_current_date_rb->isChecked()) {
|
||||
prop.useDate = TitleBlockProperties::CurrentDate;
|
||||
prop.date = QDate::currentDate();
|
||||
}
|
||||
|
||||
if (!currentTitleBlockTemplateName().isEmpty())
|
||||
{
|
||||
prop.template_name = currentTitleBlockTemplateName();
|
||||
prop.collection = m_map_index_to_collection_type.at(ui->m_tbt_cb->currentIndex());
|
||||
}
|
||||
|
||||
prop.context = m_dcw -> context();
|
||||
|
||||
prop.auto_page_num = autoNum;
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
@ -220,7 +261,7 @@ void TitleBlockPropertiesWidget::addCollection(TitleBlockTemplatesCollection *tb
|
||||
* Init this dialog
|
||||
* @param current_date true for display current date radio button
|
||||
*/
|
||||
void TitleBlockPropertiesWidget::initDialog(const bool ¤t_date) {
|
||||
void TitleBlockPropertiesWidget::initDialog(const bool ¤t_date, QETProject *project) {
|
||||
m_dcw = new DiagramContextWidget();
|
||||
ui -> m_tab2_vlayout -> addWidget(m_dcw);
|
||||
|
||||
@ -239,6 +280,19 @@ void TitleBlockPropertiesWidget::initDialog(const bool ¤t_date) {
|
||||
ui -> m_tbt_pb -> setMenu(m_tbt_menu);
|
||||
|
||||
connect(ui->m_tbt_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentTitleBlockTemplate(int)));
|
||||
|
||||
if (project!= NULL){
|
||||
keys_2 = project -> folioAutoNum().keys();
|
||||
foreach (QString str, keys_2) { ui -> auto_page_cb -> addItem(str); }
|
||||
if (ui->auto_page_cb->currentText()==NULL)
|
||||
ui->auto_page_cb->addItem("Create an Auto Folio Numbering");
|
||||
}
|
||||
else{
|
||||
ui->auto_page_cb->hide();
|
||||
ui->m_edit_autofolionum_pb->hide();
|
||||
ui->label_9->hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -342,3 +396,15 @@ void TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate(int index)
|
||||
void TitleBlockPropertiesWidget::on_m_date_now_pb_clicked() {
|
||||
ui -> m_date_edit -> setDate(QDate::currentDate());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TitleBlockPropertiesWidget::on_m_edit_autofolionum_pb_clicked
|
||||
* Open Auto Folio Num dialog
|
||||
*/
|
||||
void TitleBlockPropertiesWidget::on_m_edit_autofolionum_pb_clicked() {
|
||||
emit openAutoNumFolioEditor(ui->auto_page_cb->currentText());
|
||||
if (ui->auto_page_cb->currentText()!="Create an Auto Folio Numbering")
|
||||
{
|
||||
//still to implement: load current auto folio num settings
|
||||
}
|
||||
}
|
||||
|
@ -18,11 +18,15 @@
|
||||
#ifndef TITLEBLOCKPROPERTIESWIDGET_H
|
||||
#define TITLEBLOCKPROPERTIESWIDGET_H
|
||||
|
||||
#include "qetproject.h"
|
||||
#include <QWidget>
|
||||
#include "titleblockproperties.h"
|
||||
#include "diagramcontextwidget.h"
|
||||
#include "qet.h"
|
||||
#include "numerotationcontext.h"
|
||||
|
||||
class NumerotationContext;
|
||||
class QETProject;
|
||||
class QMenu;
|
||||
class TitleBlockTemplatesCollection;
|
||||
|
||||
@ -35,13 +39,15 @@ class TitleBlockPropertiesWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0);
|
||||
explicit TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0);
|
||||
explicit TitleBlockPropertiesWidget(QList <TitleBlockTemplatesCollection *> tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0);
|
||||
explicit TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QETProject *project = NULL, QWidget *parent = 0);
|
||||
explicit TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QETProject *project = NULL, QWidget *parent = 0);
|
||||
explicit TitleBlockPropertiesWidget(QList <TitleBlockTemplatesCollection *> tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QETProject *project = NULL, QWidget *parent = 0);
|
||||
~TitleBlockPropertiesWidget();
|
||||
|
||||
void setProperties(const TitleBlockProperties &properties);
|
||||
TitleBlockProperties properties() const;
|
||||
TitleBlockProperties propertiesAutoNum(QString autoNum) const;
|
||||
void setPropertiesWithAutoNum(const TitleBlockProperties &properties, QString autoNum);
|
||||
|
||||
void setTitleBlockTemplatesVisible(const bool &visible);
|
||||
void setReadOnly (const bool &ro);
|
||||
@ -49,7 +55,7 @@ class TitleBlockPropertiesWidget : public QWidget
|
||||
private:
|
||||
void addCollection (TitleBlockTemplatesCollection *tbt_collection);
|
||||
QString currentTitleBlockTemplateName () const;
|
||||
void initDialog(const bool ¤t_date);
|
||||
void initDialog(const bool ¤t_date, QETProject *project);
|
||||
int getIndexFor (const QString &tbt_name, const QET::QetCollection collection) const;
|
||||
|
||||
private slots:
|
||||
@ -58,9 +64,12 @@ class TitleBlockPropertiesWidget : public QWidget
|
||||
void updateTemplateList();
|
||||
void changeCurrentTitleBlockTemplate(int);
|
||||
void on_m_date_now_pb_clicked();
|
||||
void on_m_edit_autofolionum_pb_clicked();
|
||||
|
||||
signals:
|
||||
void editTitleBlockTemplate(const QString &, bool);
|
||||
void set_auto_page_num() const;
|
||||
void openAutoNumFolioEditor (QString);
|
||||
|
||||
private:
|
||||
Ui::TitleBlockPropertiesWidget *ui;
|
||||
@ -69,6 +78,7 @@ class TitleBlockPropertiesWidget : public QWidget
|
||||
QMenu *m_tbt_menu;
|
||||
QList <TitleBlockTemplatesCollection *> m_tbt_collection_list;
|
||||
QList <QET::QetCollection> m_map_index_to_collection_type;
|
||||
QList <QString> keys_2;
|
||||
};
|
||||
|
||||
#endif // TITLEBLOCKPROPERTIESWIDGET_H
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>530</width>
|
||||
<height>452</height>
|
||||
<width>572</width>
|
||||
<height>590</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -32,6 +32,21 @@
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>552</width>
|
||||
<height>570</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="m_tbt_gb">
|
||||
<property name="title">
|
||||
@ -108,24 +123,10 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="5" column="2">
|
||||
<widget class="QLineEdit" name="m_folio_le">
|
||||
<property name="toolTip">
|
||||
<string>Disponible en tant que %folio pour les modèles de cartouches</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Auteur :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Afficher :</string>
|
||||
<string>Fichier :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -137,7 +138,8 @@
|
||||
<property name="text">
|
||||
<string>Les variables suivantes sont utilisables dans le champ Folio :
|
||||
- %id : numéro du folio courant dans le projet
|
||||
- %total : nombre total de folios dans le projet</string>
|
||||
- %total : nombre total de folios dans le projet
|
||||
- %autonum : Folio Auto Numeration</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
@ -147,6 +149,75 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Date :</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Folio :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Titre :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLineEdit" name="m_folio_le">
|
||||
<property name="toolTip">
|
||||
<string>Disponible en tant que %folio pour les modèles de cartouches</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="m_title_le">
|
||||
<property name="toolTip">
|
||||
<string>Disponible en tant que %title pour les modèles de cartouches</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QComboBox" name="m_display_at_cb">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Affiche le cartouche en bas (horizontalement) ou à droite (verticalement) du folio.</p></body></html></string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>en bas</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>à droite (expérimental)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLineEdit" name="m_file_le">
|
||||
<property name="toolTip">
|
||||
<string>Disponible en tant que %filename pour les modèles de cartouches</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Auteur :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,0">
|
||||
<item row="0" column="0">
|
||||
@ -199,37 +270,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Date :</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Fichier :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="m_title_le">
|
||||
<property name="toolTip">
|
||||
<string>Disponible en tant que %title pour les modèles de cartouches</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Titre :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="m_author_le">
|
||||
<property name="toolTip">
|
||||
@ -237,35 +277,55 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Folio :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLineEdit" name="m_file_le">
|
||||
<property name="toolTip">
|
||||
<string>Disponible en tant que %filename pour les modèles de cartouches</string>
|
||||
<string>Afficher :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QComboBox" name="m_display_at_cb">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Affiche le cartouche en bas (horizontalement) ou à droite (verticalement) du folio.</p></body></html></string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>en bas</string>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="auto_page_cb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>à droite (expérimental)</string>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="m_edit_autofolionum_pb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/configure.png</normaloff>:/ico/16x16/configure.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Page Num:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -300,6 +360,10 @@ associer le nom "volta" et la valeur "1745" remplacera %{vol
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../qelectrotech.qrc"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user