diff --git a/qelectrotech.pro.user b/qelectrotech.pro.user new file mode 100644 index 000000000..3f91b7843 --- /dev/null +++ b/qelectrotech.pro.user @@ -0,0 +1,271 @@ + + + + + + EnvironmentId + {6eea4121-5ff9-4cef-b169-5ef0ff03834b} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.5.1 GCC 64bit + Desktop Qt 5.5.1 GCC 64bit + qt.55.gcc_64_kit + 0 + 0 + 0 + + /home/davi/Documents/qelectro/build-qelectrotech-Desktop_Qt_5_5_1_GCC_64bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/davi/Documents/qelectro/build-qelectrotech-Desktop_Qt_5_5_1_GCC_64bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 2 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy locally + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + qelectrotech + + Qt4ProjectManager.Qt4RunConfiguration:/home/davi/Documents/qelectro/qet-0.5_original/qelectrotech.pro + + qelectrotech.pro + false + false + + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index 95d062022..e1f3c2dd4 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -243,7 +243,6 @@ 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; @@ -260,7 +259,6 @@ 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; @@ -687,7 +685,6 @@ 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); } @@ -714,7 +711,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, QString autonum, const DiagramContext &project_properties) { +void BorderTitleBlock::setFolioData(int index, int total, const DiagramContext &project_properties) { if (index < 1 || total < 1 || index > total) return; // memorise les informations @@ -723,14 +720,8 @@ void BorderTitleBlock::setFolioData(int index, int total, QString autonum, const // 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); } diff --git a/sources/bordertitleblock.h b/sources/bordertitleblock.h index 289b067da..bb5778643 100644 --- a/sources/bordertitleblock.h +++ b/sources/bordertitleblock.h @@ -23,7 +23,6 @@ #include #include #include -#include "numerotationcontext.h" class QPainter; class DiagramPosition; class TitleBlockTemplate; @@ -107,8 +106,6 @@ class BorderTitleBlock : public QObject bool rowsAreDisplayed() const { return(display_rows_); } /// @return true si la bordure est affichee, false sinon bool borderIsDisplayed() const { return(display_border_); } - - QString autoPageNum() const { return(btb_auto_page_num_); } // methods to set dimensions void setColumnsCount(int); @@ -135,11 +132,9 @@ 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, QString = NULL, const DiagramContext & = DiagramContext()); + void setFolioData(int, int, 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 &); @@ -208,7 +203,6 @@ 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_; diff --git a/sources/configdialog.h b/sources/configdialog.h index 13d852ac2..499916928 100644 --- a/sources/configdialog.h +++ b/sources/configdialog.h @@ -36,10 +36,6 @@ class ConfigDialog : public QDialog { virtual ~ConfigDialog(); private: ConfigDialog(const ConfigDialog &); - - public: - QList pages; - // methods public slots: @@ -56,8 +52,6 @@ class ConfigDialog : public QDialog { QListWidget *pages_list; QStackedWidget *pages_widget; QDialogButtonBox *buttons; - - - + QList pages; }; #endif diff --git a/sources/configpages.cpp b/sources/configpages.cpp index eda677cd8..81ba0edd2 100644 --- a/sources/configpages.cpp +++ b/sources/configpages.cpp @@ -35,9 +35,8 @@ * else edit the properties by default of QElectroTech * @param parent, parent widget */ -NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectPropertiesDialog *ppd) : +NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent) : ConfigPage (parent), - ppd_ (ppd), m_project (project) { //By default we set the global default properties @@ -48,7 +47,7 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectProp QList c; c << QETApp::commonTitleBlockTemplatesCollection() << QETApp::customTitleBlockTemplatesCollection(); if (m_project) c << m_project->embeddedTitleBlockTemplatesCollection(); - ipw = new TitleBlockPropertiesWidget(c, TitleBlockProperties::defaultProperties(), true, project, parent); + ipw = new TitleBlockPropertiesWidget(c, TitleBlockProperties::defaultProperties(), true); // default conductor properties cpw = new ConductorPropertiesWidget(ConductorProperties::defaultProperties()); // default propertie of report label @@ -65,8 +64,6 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectProp 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(); @@ -90,7 +87,6 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectProp * @brief NewDiagramPage::~NewDiagramPage */ NewDiagramPage::~NewDiagramPage() { - disconnect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab())); } /** @@ -177,48 +173,10 @@ QIcon NewDiagramPage::icon() const { * @return title of this page */ QString NewDiagramPage::title() const { - if (m_project) return(tr("Nouveau folio", "configuration page title")); + if (m_project) return(tr("Nouveau folio", "configuration page title")); return(tr("Nouveau projet", "configuration page title")); } -/** - * @brief NewDiagramPage::changeToAutoFolioTab - * Set the current tab to Autonum - */ -void NewDiagramPage::changeToAutoFolioTab(){ - if (m_project){ - ppd_->setCurrentPage(ProjectPropertiesDialog::Autonum); - ppd_->changeToFolio(); - ppd_->exec(); - } -} - -/** - * @brief NewDiagramPage::setFolioAutonum - * Set temporary TBP to use in auto folio num - */ -void NewDiagramPage::setFolioAutonum(QString autoNum){ - TitleBlockProperties tbptemp = ipw->propertiesAutoNum(autoNum); - ipw->setProperties(tbptemp); - applyConf(); -} - -/** - * @brief NewDiagramPage::saveCurrentTbp - * Save current TBP to retrieve after auto folio num - */ -void NewDiagramPage::saveCurrentTbp(){ - savedTbp = ipw->properties(); -} - -/** - * @brief NewDiagramPage::loadSavedTbp - * Retrieve saved auto folio num - */ -void NewDiagramPage::loadSavedTbp(){ - ipw->setProperties(savedTbp); - applyConf(); -} /** Constructeur diff --git a/sources/configpages.h b/sources/configpages.h index 2e049b738..bad988820 100644 --- a/sources/configpages.h +++ b/sources/configpages.h @@ -19,8 +19,6 @@ #define CONFIG_PAGES_H #include #include "configpage.h" -#include "projectpropertiesdialog.h" //davi -#include "titleblockpropertieswidget.h" //davi class BorderPropertiesWidget; class ConductorPropertiesWidget; class TitleBlockPropertiesWidget; @@ -28,7 +26,6 @@ class ExportPropertiesWidget; class ReportPropertieWidget; class XRefPropertiesWidget; class QETProject; -class TitleBlockProperties; /** This configuration page enables users to define the properties of new @@ -38,16 +35,10 @@ class NewDiagramPage : public ConfigPage { Q_OBJECT // constructors, destructor public: - NewDiagramPage(QETProject *project = 0, QWidget * = 0, ProjectPropertiesDialog *teste = NULL); + NewDiagramPage(QETProject *project = 0, QWidget * = 0); virtual ~NewDiagramPage(); private: NewDiagramPage(const NewDiagramPage &); -public slots: - void changeToAutoFolioTab(); - void setFolioAutonum(QString); - void saveCurrentTbp(); - void loadSavedTbp(); - // methods public: @@ -57,14 +48,12 @@ public slots: // 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 }; diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 0589e6770..c18ae5fa1 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -235,7 +235,6 @@ 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,7 +250,6 @@ void Diagram::keyPressEvent(QKeyEvent *e) } if (transmit_event) { QGraphicsScene::keyPressEvent(e); - } } } diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index a8ca41f20..52b9243a5 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2015 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -30,7 +30,6 @@ #include "templatelocation.h" #include "qetapp.h" #include "qetproject.h" -#include "projectview.h" #include "integrationmoveelementshandler.h" #include "integrationmovetemplateshandler.h" #include "qetdiagrameditor.h" @@ -68,12 +67,12 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : "\"What's this?\" tip" ); setWhatsThis(whatsthis); - + // active l'antialiasing setRenderHint(QPainter::Antialiasing, true); setRenderHint(QPainter::TextAntialiasing, true); setRenderHint(QPainter::SmoothPixmapTransform, true); - + setScene(scene); scene -> undoStack().setClean(); setWindowIcon(QET::Icons::QETLogo); @@ -83,18 +82,18 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : setSelectionMode(); adjustSceneRect(); updateWindowTitle(); - + context_menu = new QMenu(this); paste_here = new QAction(QET::Icons::EditPaste, tr("Coller ici", "context menu action"), this); connect(paste_here, SIGNAL(triggered()), this, SLOT(pasteHere())); - + connect(scene, SIGNAL(showDiagram(Diagram*)), this, SIGNAL(showDiagram(Diagram*))); connect(scene, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged())); connect(scene, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustSceneRect())); connect(&(scene -> border_and_titleblock), SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(updateWindowTitle())); connect(diagram, SIGNAL(editElementRequired(ElementsLocation)), this, SIGNAL(editElementRequired(ElementsLocation))); connect(diagram, SIGNAL(findElementRequired(ElementsLocation)), this, SIGNAL(findElementRequired(ElementsLocation))); - + connect( this, SIGNAL(aboutToSetDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &)), this, SLOT(setDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &)), @@ -147,7 +146,7 @@ void DiagramView::deleteSelection() { */ void DiagramView::rotateSelection() { if (scene -> isReadOnly()) return; - + // recupere les elements et les champs de texte a pivoter QList elements_to_rotate; QList texts_to_rotate; @@ -168,7 +167,7 @@ void DiagramView::rotateSelection() { images_to_rotate << dii; } } - + // effectue les rotations s'il y a quelque chose a pivoter if (elements_to_rotate.isEmpty() && texts_to_rotate.isEmpty() && images_to_rotate.isEmpty()) return; scene -> undoStack().push(new RotateElementsCommand(elements_to_rotate, texts_to_rotate, images_to_rotate)); @@ -176,7 +175,7 @@ void DiagramView::rotateSelection() { void DiagramView::rotateTexts() { if (scene -> isReadOnly()) return; - + // recupere les champs de texte a orienter QList texts_to_rotate; foreach (QGraphicsItem *item, scene -> selectedItems()) { @@ -189,10 +188,10 @@ void DiagramView::rotateTexts() { texts_to_rotate << eti; } } - + // effectue les rotations s'il y a quelque chose a pivoter if (texts_to_rotate.isEmpty()) return; - + // demande un angle a l'utilisateur QDialog ori_text_dialog(diagramEditor()); ori_text_dialog.setSizeGripEnabled(false); @@ -201,27 +200,27 @@ void DiagramView::rotateTexts() { #endif ori_text_dialog.setWindowTitle(tr("Orienter les textes sélectionnés", "window title")); // ori_text_dialog.setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); - - + + QTextOrientationSpinBoxWidget *ori_widget = QETApp::createTextOrientationSpinBoxWidget(); ori_widget -> setParent(&ori_text_dialog); if (texts_to_rotate.count() == 1) { ori_widget -> setOrientation(texts_to_rotate.at(0) -> rotationAngle()); } ori_widget -> spinBox() -> selectAll(); - + // boutons QDialogButtonBox buttons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(&buttons, SIGNAL(accepted()), &ori_text_dialog, SLOT(accept())); connect(&buttons, SIGNAL(rejected()), &ori_text_dialog, SLOT(reject())); - + // ajout dans une disposition verticale QVBoxLayout layout_v(&ori_text_dialog); layout_v.setSizeConstraint(QLayout::SetFixedSize); layout_v.addWidget(ori_widget); layout_v.addStretch(); layout_v.addWidget(&buttons); - + // si le dialogue est accepte if (ori_text_dialog.exec() == QDialog::Accepted) { scene -> undoStack().push(new RotateTextsCommand(texts_to_rotate, ori_widget -> orientation())); @@ -262,7 +261,7 @@ void DiagramView::dragMoveEvent(QDragMoveEvent *e) { } /** - Handle the drops accepted on diagram (elements and title block templates). + Handle the drops accepted on diagram (elements and title block templates). @param e the QDropEvent describing the current drag'n drop */ void DiagramView::dropEvent(QDropEvent *e) { @@ -422,17 +421,17 @@ void DiagramView::copy() { */ void DiagramView::paste(const QPointF &pos, QClipboard::Mode clipboard_mode) { if (!isInteractive() || scene -> isReadOnly()) return; - + QString texte_presse_papier = QApplication::clipboard() -> text(clipboard_mode); if ((texte_presse_papier).isEmpty()) return; - + QDomDocument document_xml; if (!document_xml.setContent(texte_presse_papier)) return; - + // objet pour recuperer le contenu ajoute au schema par le coller DiagramContent content_pasted; scene -> fromXml(document_xml, pos, false, &content_pasted); - + // si quelque chose a effectivement ete ajoute au schema, on cree un objet d'annulation if (content_pasted.count()) { scene -> clearSelection(); @@ -590,22 +589,7 @@ 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); } @@ -767,14 +751,14 @@ void DiagramView::adjustGridToZoom() { QRectF DiagramView::viewedSceneRect() const { // recupere la taille du widget viewport QSize viewport_size = viewport() -> size(); - + // recupere la transformation viewport -> scene QTransform view_to_scene = viewportTransform().inverted(); - + // mappe le coin superieur gauche et le coin inferieur droit de la viewport sur la scene QPointF scene_left_top = view_to_scene.map(QPointF(0.0, 0.0)); QPointF scene_right_bottom = view_to_scene.map(QPointF(viewport_size.width(), viewport_size.height())); - + // en deduit le rectangle visualise par la scene return(QRectF(scene_left_top, scene_right_bottom)); } @@ -789,7 +773,7 @@ bool DiagramView::mustIntegrateTitleBlockTemplate(const TitleBlockTemplateLocati // unlike elements, the integration of title block templates is mandatory, so we simply check whether the parent project of the template is also the parent project of the diagram QETProject *tbt_parent_project = tbt_loc.parentProject(); if (!tbt_parent_project) return(true); - + return(tbt_parent_project != scene -> project()); } @@ -799,7 +783,7 @@ bool DiagramView::mustIntegrateTitleBlockTemplate(const TitleBlockTemplateLocati */ void DiagramView::applyReadOnly() { if (!scene) return; - + bool is_writable = !scene -> isReadOnly(); setInteractive(is_writable); setAcceptDrops(is_writable); @@ -811,11 +795,11 @@ void DiagramView::applyReadOnly() { void DiagramView::editSelectionProperties() { // get selection DiagramContent selection = scene -> selectedContent(); - + // if selection contains nothing return int selected_items_count = selection.count(DiagramContent::All | DiagramContent::SelectedOnly); if (!selected_items_count) return; - + // if selection contains one item and this item can be editable, edit this item with an appropriate dialog if (selected_items_count == 1 && selection.items(DiagramContent::Elements | DiagramContent::AnyConductor | @@ -827,7 +811,7 @@ void DiagramView::editSelectionProperties() { else if (selection.elements.size()) selection.elements.toList().first() -> editProperty(); } - + else { QET::QetMessageBox::information( this, @@ -848,7 +832,7 @@ void DiagramView::editSelectionProperties() { void DiagramView::editSelectedConductorColor() { // retrieve selected content DiagramContent selection = scene -> selectedContent(); - + // we'll focus on the selected conductor (we do not handle multiple conductors edition) QList selected_conductors = selection.conductors(DiagramContent::AnyConductor | DiagramContent::SelectedOnly); if (selected_conductors.count() == 1) { @@ -863,10 +847,10 @@ void DiagramView::editSelectedConductorColor() { void DiagramView::editConductorColor(Conductor *edited_conductor) { if (scene -> isReadOnly() || !edited_conductor) return; - + // store the initial properties of the provided conductor ConductorProperties initial_properties = edited_conductor -> properties(); - + // prepare a color dialog showing the initial conductor color QColorDialog *color_dialog = new QColorDialog(this); color_dialog -> setWindowTitle(tr("Choisir la nouvelle couleur de ce conducteur")); @@ -874,7 +858,7 @@ void DiagramView::editConductorColor(Conductor *edited_conductor) color_dialog -> setWindowFlags(Qt::Sheet); #endif color_dialog -> setCurrentColor(initial_properties.color); - + // asks the user what color he wishes to apply if (color_dialog -> exec() == QDialog::Accepted) { @@ -901,7 +885,7 @@ void DiagramView::resetConductors() { if (scene -> isReadOnly()) return; // recupere les conducteurs selectionnes QSet selected_conductors = scene -> selectedConductors(); - + // repere les conducteurs modifies (= profil non nul) QHash conductors_and_profiles; foreach(Conductor *conductor, selected_conductors) { @@ -915,7 +899,7 @@ void DiagramView::resetConductors() { conductors_and_profiles.insert(conductor, profile); } } - + if (conductors_and_profiles.isEmpty()) return; scene -> undoStack().push(new ResetConductorCommand(conductors_and_profiles)); } @@ -1059,7 +1043,7 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e) { if (!qgi -> isSelected()) scene -> clearSelection(); qgi -> setSelected(true); } - + if (QETDiagramEditor *qde = diagramEditor()) { context_menu -> clear(); if (scene -> selectedItems().isEmpty()) { @@ -1077,7 +1061,7 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e) { context_menu -> addSeparator(); context_menu -> addActions(qde -> m_selection_actions_group.actions()); } - + // affiche le menu contextuel context_menu -> popup(e -> globalPos()); } @@ -1106,10 +1090,10 @@ void DiagramView::mouseDoubleClickEvent(QMouseEvent *e) if (m_event_interface && m_event_interface -> mouseDoubleClickEvent(e)) return; BorderTitleBlock &bi = scene -> border_and_titleblock; - + //Get the click pos on the diagram QPointF click_pos = viewportTransform().inverted().map(e -> pos()); - + if (bi.titleBlockRect().contains(click_pos) || bi.columnsRect().contains(click_pos) || bi.rowsRect().contains(click_pos)) { e->accept(); editDiagramProperties(); @@ -1124,14 +1108,14 @@ void DiagramView::mouseDoubleClickEvent(QMouseEvent *e) void DiagramView::setDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &tbt) { // fetch the current title block properties TitleBlockProperties titleblock_properties_before = scene -> border_and_titleblock.exportTitleBlock(); - + // check the provided template is not already applied QETProject *tbt_parent_project = tbt.parentProject(); if (tbt_parent_project && tbt_parent_project == scene -> project()) { // same parent project and same name = same title block template if (tbt.name() == titleblock_properties_before.template_name) return; } - + // integrate the provided template into the project if needed QString integrated_template_name = tbt.name(); if (mustIntegrateTitleBlockTemplate(tbt)) { @@ -1140,7 +1124,7 @@ void DiagramView::setDroppedTitleBlockTemplate(const TitleBlockTemplateLocation integrated_template_name = scene -> project() -> integrateTitleBlockTemplate(tbt, handler); if (integrated_template_name.isEmpty()) return; } - + // apply the provided title block template if (titleblock_properties_before.template_name == integrated_template_name) return; TitleBlockProperties titleblock_properties_after = titleblock_properties_before; diff --git a/sources/elementspanelwidget.cpp b/sources/elementspanelwidget.cpp index 4c6f592be..8a222e9ab 100644 --- a/sources/elementspanelwidget.cpp +++ b/sources/elementspanelwidget.cpp @@ -67,14 +67,14 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) { prj_activate = new QAction(QET::Icons::ProjectFile, tr("Basculer vers ce projet"), this); prj_close = new QAction(QET::Icons::DocumentClose, tr("Fermer ce projet"), this); prj_edit_prop = new QAction(QET::Icons::DialogInformation, tr("Propriétés du projet"), this); - prj_prop_diagram = new QAction(QET::Icons::DialogInformation, tr("Propriétés du folio"), this); - prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this); - prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer ce folio"), this); - prj_move_diagram_up = new QAction(QET::Icons::GoUp, tr("Remonter ce folio"), this); - prj_move_diagram_down = new QAction(QET::Icons::GoDown, tr("Abaisser ce folio"), this); - prj_move_diagram_upx10 = new QAction(QET::Icons::GoUp, tr("Remonter ce folio x10"), this); - prj_move_diagram_top = new QAction(QET::Icons::GoUp, tr("Remonter ce folio au debut"), this); - prj_move_diagram_downx10 = new QAction(QET::Icons::GoDown, tr("Abaisser ce folio x10"), this); + prj_prop_diagram = new QAction(QET::Icons::DialogInformation, tr("Propriétés du folio"), this); + prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this); + prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer ce folio"), this); + prj_move_diagram_up = new QAction(QET::Icons::GoUp, tr("Remonter ce folio"), this); + prj_move_diagram_down = new QAction(QET::Icons::GoDown, tr("Abaisser ce folio"), this); + prj_move_diagram_upx10 = new QAction(QET::Icons::GoUp, tr("Remonter ce folio x10"), this); + prj_move_diagram_top = new QAction(QET::Icons::GoUp, tr("Remonter ce folio au debut"), this); + prj_move_diagram_downx10 = new QAction(QET::Icons::GoDown, tr("Abaisser ce folio x10"), this); tbt_add = new QAction(QET::Icons::TitleBlock, tr("Nouveau modèle"), this); tbt_edit = new QAction(QET::Icons::TitleBlock, tr("Éditer ce modèle"), this); tbt_remove = new QAction(QET::Icons::TitleBlock, tr("Supprimer ce modèle"), this); @@ -777,19 +777,6 @@ 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 diff --git a/sources/elementspanelwidget.h b/sources/elementspanelwidget.h index 818e607e6..b408be2ad 100644 --- a/sources/elementspanelwidget.h +++ b/sources/elementspanelwidget.h @@ -110,9 +110,6 @@ class ElementsPanelWidget : public QWidget { void updateProgressBar(int, int); void loadingFinished(); void filterEdited(const QString &); - - protected: - virtual void keyPressEvent (QKeyEvent *e); private: void launchElementEditor(const ElementsLocation &); diff --git a/sources/projectconfigpages.cpp b/sources/projectconfigpages.cpp index 1aeac80e6..933603f99 100644 --- a/sources/projectconfigpages.cpp +++ b/sources/projectconfigpages.cpp @@ -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,6 +141,7 @@ void ProjectMainConfigPage::applyProjectConf() { project_ -> setProjectProperties(new_properties); modified_project = true; } + if (modified_project) { project_ -> setModified(true); } @@ -185,8 +186,6 @@ void ProjectMainConfigPage::initLayout() { main_layout0 -> addWidget(project_variables_label_); main_layout0 -> addWidget(project_variables_); setLayout(main_layout0); - this -> setMinimumWidth(630); - } /** @@ -251,44 +250,17 @@ void ProjectAutoNumConfigPage::applyProjectConf() {} * Init some widget of this page */ void ProjectAutoNumConfigPage::initWidgets() { + m_label = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), 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 = new QComboBox(this); 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(), conductor_tab_widget); + m_remove_pb = new QPushButton(QET::Icons::EditDelete, QString(), this); m_remove_pb -> setToolTip(tr("Supprimer la numérotation")); - 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); -*/ + m_saw = new SelectAutonumW(this); } /** @@ -296,40 +268,15 @@ 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(); + 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(); - 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")); + QVBoxLayout *main_layout = new QVBoxLayout(this); + this -> setLayout (main_layout); + main_layout -> addLayout (context_layout); + main_layout -> addWidget (m_saw); } /** @@ -337,20 +284,9 @@ void ProjectAutoNumConfigPage::initLayout() { * Read value stored on project, and update display */ void ProjectAutoNumConfigPage::readValuesFromProject() { - //Conductor Tab QList keys = project_->conductorAutoNum().keys(); - if (!keys.isEmpty()){ + if (keys.isEmpty()) return; foreach (QString str, keys) { m_context_cb -> addItem(str); } - } - - //Folio Tab - QList 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); } /** @@ -365,28 +301,14 @@ 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())); - - //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))); -*/ + connect (m_remove_pb, SIGNAL(clicked()), this, SLOT(removeContext())); } /** * @brief ProjectAutoNumConfigPage::updateContext - * Display the current selected context for conductor + * Display the current selected context * @param str, key of context stored in project */ void ProjectAutoNumConfigPage::updateContext(QString str) { @@ -394,19 +316,9 @@ 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 conductor context in project + * Save the current displayed context in project */ void ProjectAutoNumConfigPage::saveContext() { // If the text is the default text "Name of new numerotation" save the edited context @@ -426,57 +338,9 @@ 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 conductor numerotation context + * Remove from project the current numerotation context */ void ProjectAutoNumConfigPage::removeContext() { //if default text, return @@ -484,37 +348,3 @@ 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(); - } - } -} diff --git a/sources/projectconfigpages.h b/sources/projectconfigpages.h index 451ff423d..66a47fe78 100644 --- a/sources/projectconfigpages.h +++ b/sources/projectconfigpages.h @@ -20,8 +20,6 @@ #ifndef PROJECTCONFIGPAGES_H #define PROJECTCONFIGPAGES_H #include "configpage.h" -#include - class QLabel; class QLineEdit; class QETProject; @@ -34,7 +32,6 @@ class XRefPropertiesWidget; class SelectAutonumW; class QComboBox; class QPushButton; -class FolioAutonumberingW; /** This class, derived from ConfigPage, aims at providing the basic skeleton @@ -131,49 +128,27 @@ 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; + QLabel *m_label; + QComboBox *m_context_cb; + QPushButton *m_remove_pb; + SelectAutonumW *m_saw; }; diff --git a/sources/projectview.cpp b/sources/projectview.cpp index a2d7ac413..65c3ec781 100644 --- a/sources/projectview.cpp +++ b/sources/projectview.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2015 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -32,6 +32,7 @@ #include "qettemplateeditor.h" #include "diagramfoliolist.h" #include "projectpropertiesdialog.h" + #include /** @@ -46,7 +47,7 @@ ProjectView::ProjectView(QETProject *project, QWidget *parent) : initActions(); initWidgets(); initLayout(); - + setProject(project); } @@ -78,9 +79,8 @@ void ProjectView::setProject(QETProject *project) { if (!project_) { project_ = project; connect(project_, SIGNAL(projectTitleChanged(QETProject *, const QString &)), this, SLOT(updateWindowTitle())); - connect(project_, SIGNAL(projectModified (QETProject *, bool)), this, SLOT(updateWindowTitle())); - connect(project_, SIGNAL(readOnlyChanged (QETProject *, bool)), this, SLOT(adjustReadOnlyState())); - connect(project_, SIGNAL(addAutoNumDiagram()), this, SLOT(addNewDiagram())); + connect(project_, SIGNAL(projectModified (QETProject *, bool)), this, SLOT(updateWindowTitle())); + connect(project_, SIGNAL(readOnlyChanged (QETProject *, bool)), this, SLOT(adjustReadOnlyState())); adjustReadOnlyState(); loadDiagrams(); } @@ -112,7 +112,7 @@ QList ProjectView::getDiagrams(ProjectSaveOptions options) { selection.removeOne(current); } } - + return(selection); } @@ -138,83 +138,6 @@ 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= 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 @@ -225,19 +148,19 @@ DiagramView *ProjectView::firstDiagram(){ */ bool ProjectView::tryClosing() { if (!project_) return(true); - + // First step: require external editors closing -- users may either cancel // the whole closing process or save (and therefore add) content into this // project. Of course, they may also discard them. if (!tryClosingElementEditors()) { return(false); } - + // Check how different the current situation is from a brand new, untouched project if (project_ -> filePath().isEmpty() && !project_ -> projectWasModified()) { return(true); } - + // Second step: users are presented with a dialog that enables them to // choose whether they want to: // - cancel the closing process, @@ -250,12 +173,12 @@ bool ProjectView::tryClosing() { } else if (user_input == QMessageBox::Discard) { return(true); // all modifications were discarded } - + // Check how different the current situation is from a brand new, untouched project (yes , again) if (project_ -> filePath().isEmpty() && !project_ -> projectWasModified()) { return(true); } - + if (project_ -> filePath().isEmpty()) { QString filepath = askUserForFilePath(); if (filepath.isEmpty()) return(false); // users may cancel the closing @@ -282,7 +205,7 @@ bool ProjectView::tryClosingElementEditors() { foreach(QETElementEditor *editor, editors) { if (!editor -> close()) return(false); } - + QList template_editors = QETApp::titleBlockTemplateEditors(project_); foreach(QETTitleBlockTemplateEditor *template_editor, template_editors) { if (!template_editor -> close()) return(false); @@ -320,7 +243,7 @@ int ProjectView::tryClosingDiagrams() { if (close_dialog == QMessageBox::Save) { saveDiagrams(project()->diagrams()); } - + return(close_dialog); } @@ -337,20 +260,20 @@ QString ProjectView::askUserForFilePath(bool assign) { this, tr("Enregistrer sous", "dialog title"), project_ -> currentDir(), - tr("Projet QElectroTech (*.qet)", "filetypes allowed when saving a project file") + tr("Projet QElectroTech (*.qet)", "filetypes allowed when saving a project file") ); - + // if no filepath is provided, return an empty string if (filepath.isEmpty()) return(filepath); - + // if the name does not end with the .qet extension, append it if (!filepath.endsWith(".qet", Qt::CaseInsensitive)) filepath += ".qet"; - + if (assign) { // assign the provided filepath to the currently edited project project_ -> setFilePath(filepath); } - + return(filepath); } @@ -369,7 +292,7 @@ QETResult ProjectView::noProjectResult() const { */ void ProjectView::addNewDiagram() { if (project_ -> isReadOnly()) return; - + Diagram *new_diagram = project_ -> addNewDiagram(); DiagramView *new_diagram_view = new DiagramView(new_diagram); addDiagram(new_diagram_view); @@ -412,7 +335,7 @@ void ProjectView::addDiagram(DiagramView *diagram) { // check diagram isn't present in the project if (diagram_ids_.values().contains(diagram)) return; - + // Add new tab for the diagram m_tab -> addTab(diagram, QET::Icons::Diagram, diagram -> title()); diagram -> setFrameStyle(QFrame::Plain | QFrame::NoFrame); @@ -425,7 +348,7 @@ void ProjectView::addDiagram(DiagramView *diagram) { connect(diagram, SIGNAL(findElementRequired(const ElementsLocation &)), this, SIGNAL(findElementRequired(const ElementsLocation &))); connect(diagram, SIGNAL(editElementRequired(const ElementsLocation &)), this, SIGNAL(editElementRequired(const ElementsLocation &))); connect(diagram, SIGNAL(editTitleBlockTemplate(const QString &, bool)), this, SLOT(editTitleBlockTemplateRequired(const QString &, bool))); - + // signal diagram was added emit(diagramAdded(diagram)); } @@ -437,36 +360,36 @@ void ProjectView::addDiagram(DiagramView *diagram) { void ProjectView::removeDiagram(DiagramView *diagram_view) { if (!diagram_view) return; if (project_ -> isReadOnly()) return; - + // verifie que le schema est bien present dans le projet if (!diagram_ids_.values().contains(diagram_view)) return; - + //Ask confirmation to user. int answer = QET::QetMessageBox::question( this, - tr("Supprimer le folio ?", "message box title"), - tr("Êtes-vous sûr de vouloir supprimer ce folio du projet ? Ce changement est irréversible.", "message box content"), + tr("Supprimer le folio ?", "message box title"), + tr("Êtes-vous sûr de vouloir supprimer ce folio du projet ? Ce changement est irréversible.", "message box content"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No ); if (answer != QMessageBox::Yes) { return; } - + // enleve le DiagramView des onglets int diagram_tab_id = diagram_ids_.key(diagram_view); m_tab -> removeTab(diagram_tab_id); diagrams_.removeAll(diagram_view); rebuildDiagramsMap(); - + // supprime le DiagramView, puis le Diagram project_ -> removeDiagram(diagram_view -> diagram()); delete diagram_view; - + // signale le retrait du schema emit(diagramRemoved(diagram_view)); - + // rend definitif le retrait du schema project_ -> write(); } @@ -477,7 +400,7 @@ void ProjectView::removeDiagram(DiagramView *diagram_view) { */ void ProjectView::removeDiagram(Diagram *diagram) { if (!diagram) return; - + if (DiagramView *diagram_view = findDiagram(diagram)) { removeDiagram(diagram_view); } @@ -541,7 +464,7 @@ void ProjectView::editDiagramProperties(Diagram *diagram) { */ void ProjectView::moveDiagramUp(DiagramView *diagram_view) { if (!diagram_view) return; - + int diagram_view_position = diagram_ids_.key(diagram_view); if (!diagram_view_position) { // le schema est le premier du projet @@ -562,7 +485,7 @@ void ProjectView::moveDiagramUp(Diagram *diagram) { */ void ProjectView::moveDiagramDown(DiagramView *diagram_view) { if (!diagram_view) return; - + int diagram_view_position = diagram_ids_.key(diagram_view); if (diagram_view_position + 1 == diagram_ids_.count()) { // le schema est le dernier du projet @@ -649,7 +572,7 @@ void ProjectView::moveDiagramDownx10(Diagram *diagram) { */ void ProjectView::printProject() { if (!project_) return; - + // transforme le titre du projet en nom utilisable pour le document QString doc_name; if (!(project_ -> title().isEmpty())) { @@ -661,13 +584,13 @@ void ProjectView::printProject() { if (doc_name.isEmpty()) { doc_name = tr("projet", "string used to generate a filename"); } - + // recupere le dossier contenant le fichier courant QString dir_path = project_ -> currentDir(); - + // determine un chemin pour le pdf / ps QString file_name = QDir::toNativeSeparators(QDir::cleanPath(dir_path + "/" + doc_name)); - + DiagramPrintDialog print_dialog(project_, this); print_dialog.setDocName(doc_name); print_dialog.setFileName(file_name); @@ -679,7 +602,7 @@ void ProjectView::printProject() { */ void ProjectView::exportProject() { if (!project_) return; - + ExportDialog ed(project_, parentWidget()); #ifdef Q_OS_MAC ed.setWindowFlags(Qt::Sheet); @@ -706,7 +629,7 @@ QETResult ProjectView::save() { */ QETResult ProjectView::saveAs(ProjectSaveOptions options) { if (!project_) return(noProjectResult()); - + QString filepath = askUserForFilePath(); if (filepath.isEmpty()) return(QETResult()); return(doSave(options)); @@ -722,16 +645,16 @@ QETResult ProjectView::saveAs(ProjectSaveOptions options) { */ QETResult ProjectView::doSave(ProjectSaveOptions options) { if (!project_) return(noProjectResult()); - + if (project_ -> filePath().isEmpty()) { // The project has not been saved to a file yet, // so save() actually means saveAs(). return(saveAs(options)); } - + // look for diagrams matching the required save options saveDiagrams(getDiagrams(options)); - + // write to file QETResult result = project_ -> write(); updateWindowTitle(); @@ -765,7 +688,7 @@ void ProjectView::saveDiagrams(const QList &diagrams) { */ int ProjectView::cleanProject() { if (!project_) return(0); - + // s'assure que le schema n'est pas en lecture seule if (project_ -> isReadOnly()) { QET::QetMessageBox::critical( @@ -775,22 +698,22 @@ int ProjectView::cleanProject() { ); return(0); } - + // construit un petit dialogue pour parametrer le nettoyage - QCheckBox *clean_tbt = new QCheckBox(tr("Supprimer les modèles de cartouche inutilisés dans le projet")); + QCheckBox *clean_tbt = new QCheckBox(tr("Supprimer les modèles de cartouche inutilisés dans le projet")); QCheckBox *clean_elements = new QCheckBox(tr("Supprimer les éléments inutilisés dans le projet")); QCheckBox *clean_categories = new QCheckBox(tr("Supprimer les catégories vides")); QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - - clean_tbt -> setChecked(true); + + clean_tbt -> setChecked(true); clean_elements -> setChecked(true); clean_categories -> setChecked(true); - + QDialog clean_dialog(parentWidget()); #ifdef Q_OS_MAC clean_dialog.setWindowFlags(Qt::Sheet); #endif - + clean_dialog.setWindowTitle(tr("Nettoyer le projet", "window title")); QVBoxLayout *clean_dialog_layout = new QVBoxLayout(); clean_dialog_layout -> addWidget(clean_tbt); @@ -798,10 +721,10 @@ int ProjectView::cleanProject() { clean_dialog_layout -> addWidget(clean_categories); clean_dialog_layout -> addWidget(buttons); clean_dialog.setLayout(clean_dialog_layout); - + connect(buttons, SIGNAL(accepted()), &clean_dialog, SLOT(accept())); connect(buttons, SIGNAL(rejected()), &clean_dialog, SLOT(reject())); - + int clean_count = 0; if (clean_dialog.exec() == QDialog::Accepted) { @@ -828,7 +751,7 @@ int ProjectView::cleanProject() { Initialize actions for this widget. */ void ProjectView::initActions() { - add_new_diagram_ = new QAction(QET::Icons::AddFolio, tr("Ajouter un folio"), this); + add_new_diagram_ = new QAction(QET::Icons::AddFolio, tr("Ajouter un folio"), this); connect(add_new_diagram_, SIGNAL(triggered()), this, SLOT(addNewDiagram())); } @@ -838,30 +761,30 @@ void ProjectView::initActions() { void ProjectView::initWidgets() { setObjectName("ProjectView"); setWindowIcon(QET::Icons::ProjectFileGP); - + // initialize the "fallback" widget fallback_widget_ = new QWidget(); fallback_label_ = new QLabel( tr( - "Ce projet ne contient aucun folio", + "Ce projet ne contient aucun folio", "label displayed when a project contains no diagram" ) ); fallback_label_ -> setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); - + // initialize tabs m_tab = new QTabWidget(this); m_tab -> setMovable(true); - + QToolButton *add_new_diagram_button = new QToolButton; add_new_diagram_button -> setDefaultAction(add_new_diagram_); add_new_diagram_button -> setAutoRaise(true); m_tab -> setCornerWidget(add_new_diagram_button, Qt::TopRightCorner); - + connect(m_tab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); connect(m_tab, SIGNAL(tabBarDoubleClicked(int)), this, SLOT(tabDoubleClicked(int))); connect(m_tab->tabBar(), SIGNAL(tabMoved(int, int)), this, SLOT(tabMoved(int, int))); - + fallback_widget_ -> setVisible(false); m_tab -> setVisible(false); } @@ -872,7 +795,7 @@ void ProjectView::initWidgets() { void ProjectView::initLayout() { QVBoxLayout *fallback_widget_layout_ = new QVBoxLayout(fallback_widget_); fallback_widget_layout_ -> addWidget(fallback_label_); - + layout_ = new QVBoxLayout(this); #ifdef Q_OS_MAC layout_ -> setContentsMargins(0, 8, 0, 0); @@ -893,9 +816,9 @@ void ProjectView::initLayout() { */ void ProjectView::loadDiagrams() { if (!project_) return; - + setDisplayFallbackWidget(project_ -> diagrams().isEmpty()); - + foreach(Diagram *diagram, project_ -> diagrams()) { DiagramView *sv = new DiagramView(diagram); addDiagram(sv); @@ -928,12 +851,12 @@ void ProjectView::updateWindowTitle() { */ void ProjectView::adjustReadOnlyState() { bool editable = !(project_ -> isReadOnly()); - + // prevent users from moving existing diagrams m_tab -> setMovable(editable); // prevent users from adding new diagrams add_new_diagram_ -> setEnabled(editable); - + // on met a jour le titre du widget, qui reflete l'etat de lecture seule updateWindowTitle(); } @@ -956,13 +879,13 @@ void ProjectView::updateTabTitle(DiagramView *diagram, const QString &diagram_ti */ void ProjectView::tabMoved(int from, int to) { if (!project_) return; - + // signale au QETProject le changement d'ordre des schemas project_ -> diagramOrderChanged(from, to); - + // reconstruit la liste associant les index des onglets aux schemas rebuildDiagramsMap(); - + // emet un signal pour informer le reste du monde que l'ordre des schemas a change emit(diagramOrderChanged(this, from, to)); } @@ -1003,7 +926,7 @@ DiagramView *ProjectView::findDiagram(Diagram *diagram) { void ProjectView::rebuildDiagramsMap() { // vide la map diagram_ids_.clear(); - + foreach(DiagramView *diagram_view, diagrams_) { int dv_idx = m_tab -> indexOf(diagram_view); if (dv_idx == -1) continue; @@ -1035,7 +958,7 @@ void ProjectView::tabDoubleClicked(int tab_id) { // repere le schema concerne DiagramView *diagram_view = diagram_ids_[tab_id]; if (!diagram_view) return; - + diagram_view -> editDiagramProperties(); } diff --git a/sources/projectview.h b/sources/projectview.h index 380873deb..3407ec492 100644 --- a/sources/projectview.h +++ b/sources/projectview.h @@ -1,17 +1,17 @@ /* Copyright 2006-2015 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -31,7 +31,7 @@ class QTabWidget; */ class ProjectView : public QWidget { Q_OBJECT - + public: enum ProjectSaveOption { CurrentDiagram = 2, @@ -39,15 +39,15 @@ class ProjectView : public QWidget { AllDiagrams = 6 }; Q_DECLARE_FLAGS(ProjectSaveOptions, ProjectSaveOption) - - + + // constructors, destructor public: ProjectView(QETProject *, QWidget * = 0); virtual ~ProjectView(); private: ProjectView(const ProjectView &); - + // methods public: QETProject *project(); @@ -56,11 +56,7 @@ class ProjectView : public QWidget { QList getDiagrams(ProjectSaveOptions options); DiagramView *currentDiagram() const; void closeEvent(QCloseEvent *); - void changeTabUp(); - void changeTabDown(); - void changeFirstTab(); - void changeLastTab(); - + public slots: void addNewDiagram(); void addNewDiagramFolioList(); @@ -94,7 +90,7 @@ class ProjectView : public QWidget { void updateTabTitle(DiagramView *, const QString &); void tabMoved(int, int); void editTitleBlockTemplateRequired(const QString &, bool); - + signals: void diagramAdded(DiagramView *); void diagramRemoved(DiagramView *); @@ -106,30 +102,26 @@ class ProjectView : public QWidget { void findElementRequired(const ElementsLocation &); void editElementRequired(const ElementsLocation &); void editTitleBlockTemplate(const TitleBlockTemplateLocation &, bool); - + private: void initActions(); void initWidgets(); void initLayout(); void loadDiagrams(); DiagramView *findDiagram(Diagram *); - DiagramView *nextDiagram(); - DiagramView *previousDiagram(); - DiagramView *firstDiagram(); - DiagramView *lastDiagram(); void rebuildDiagramsMap(); bool tryClosing(); bool tryClosingElementEditors(); int tryClosingDiagrams(); QString askUserForFilePath(bool = true); QETResult noProjectResult() const; - + private slots: void tabChanged(int); void tabDoubleClicked(int); void setDisplayFallbackWidget(bool); void adjustReadOnlyState(); - + // attributes private: QAction *add_new_diagram_; diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index f53cd0149..435455e56 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -1524,34 +1524,6 @@ 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(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" */ diff --git a/sources/qetdiagrameditor.h b/sources/qetdiagrameditor.h index 2ad43e519..778c0bcdf 100644 --- a/sources/qetdiagrameditor.h +++ b/sources/qetdiagrameditor.h @@ -65,9 +65,7 @@ class QETDiagramEditor : public QETMainWindow { bool openAndAddProject (const QString &, bool = true, bool = true); QList editedFiles () const; ProjectView *viewForFile (const QString &) const; - ProjectView *acessCurrentProject (); - DiagramView *acessCurrentDiagramView (); - + protected: virtual bool event(QEvent *); diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index 0cc634dfc..a80b2f813 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -34,8 +34,6 @@ #include "integrationmovetemplateshandler.h" #include "xmlelementcollection.h" #include "importelementdialog.h" -#include "numerotationcontextcommands.h" - #include @@ -56,8 +54,7 @@ QETProject::QETProject(int diagrams, QObject *parent) : titleblocks_ (this ), folioSheetsQuantity (0 ), m_auto_conductor (true ), - m_elements_collection (nullptr), - m_auto_folio (true ) + m_elements_collection (nullptr) { // 0 a n schema(s) vide(s) int diagrams_count = qMax(0, diagrams); @@ -94,8 +91,7 @@ QETProject::QETProject(const QString &path, QObject *parent) : titleblocks_ (this ), folioSheetsQuantity (0 ), m_auto_conductor (true ), - m_elements_collection (nullptr), - m_auto_folio (true ) + m_elements_collection (nullptr) { //Open the file QFile project_file(path); @@ -446,17 +442,9 @@ QHash QETProject::conductorAutoNum() const { return m_conductor_autonum; } -/** - * @brief QETProject::folioAutoNum - * @return All value of conductor autonum stored in project - */ -QHash QETProject::folioAutoNum() const { - return m_folio_autonum; -} - /** * @brief QETProject::addConductorAutoNum - * Add a new conductor numerotation context. If key already exist, + * Add a new numerotation context. If key already exist, * replace old context by the new context * @param key * @param context @@ -465,38 +453,18 @@ 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 Conductor Numerotation Context stored with key + * Remove the 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 conductor numerotation context stored with @key. + * Return the numerotation context stored with @key. * If key is not found, return an empty numerotation context * @param key */ @@ -505,17 +473,6 @@ 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. @@ -526,16 +483,6 @@ 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 @@ -548,46 +495,6 @@ 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 */ @@ -1250,7 +1157,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, folio_autonums; + QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt, conds_autonums; for (QDomNode child = newdiagrams_elmt.firstChild() ; !child.isNull() ; child = child.nextSibling()) { @@ -1269,8 +1176,6 @@ 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 @@ -1296,15 +1201,6 @@ 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); - } - } } /** @@ -1365,15 +1261,6 @@ 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); } /** @@ -1529,17 +1416,7 @@ void QETProject::updateDiagramsFolioData() { project_wide_properties.addValue("projecttitle", title()); for (int i = 0 ; i < total_folio ; ++ i) { - 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] -> border_and_titleblock.setFolioData(i + 1, total_folio, project_wide_properties); diagrams_[i] -> update(); } } diff --git a/sources/qetproject.h b/sources/qetproject.h index e18cf720d..5633cfc83 100644 --- a/sources/qetproject.h +++ b/sources/qetproject.h @@ -115,21 +115,12 @@ class QETProject : public QObject void setDefaultXRefProperties(QHash hash); QHash conductorAutoNum() const; - QHash 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(); @@ -171,7 +162,6 @@ class QETProject : public QObject void readOnlyChanged(QETProject *, bool); void reportPropertiesChanged(QString); void XRefPropertiesChanged (); - void addAutoNumDiagram(); private slots: void updateDiagramsFolioData(); @@ -236,12 +226,10 @@ class QETProject : public QObject QUndoStack *undo_stack_; /// Conductor auto numerotation QHash m_conductor_autonum; - QHash 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 diff --git a/sources/titleblockproperties.cpp b/sources/titleblockproperties.cpp index d5eab8240..4e66ee27c 100644 --- a/sources/titleblockproperties.cpp +++ b/sources/titleblockproperties.cpp @@ -48,7 +48,6 @@ 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 &&\ @@ -74,7 +73,6 @@ 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()) @@ -100,7 +98,6 @@ 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); @@ -129,7 +126,6 @@ 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); @@ -147,7 +143,6 @@ 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(); diff --git a/sources/titleblockproperties.h b/sources/titleblockproperties.h index 963c785c4..7189e5bba 100644 --- a/sources/titleblockproperties.h +++ b/sources/titleblockproperties.h @@ -53,7 +53,6 @@ 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 diff --git a/sources/ui/diagrampropertiesdialog.cpp b/sources/ui/diagrampropertiesdialog.cpp index eaa2e7029..cf4bbddae 100644 --- a/sources/ui/diagrampropertiesdialog.cpp +++ b/sources/ui/diagrampropertiesdialog.cpp @@ -55,14 +55,12 @@ 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, diagram->project(), this); + titleblock_infos = new TitleBlockPropertiesWidget(parent_project -> embeddedTitleBlockTemplatesCollection(), titleblock, false, this); connect(titleblock_infos, SIGNAL(editTitleBlockTemplate(QString, bool)), diagram->views().first(), SIGNAL(editTitleBlockTemplate(QString, bool))); } else - titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, diagram->project(), this); + titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, 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); @@ -126,7 +124,7 @@ void DiagramPropertiesDialog::diagramPropertiesDialog(Diagram *diagram, QWidget /** * @brief DiagramPropertiesDialog::editAutonum - * Open conductor autonum editor + * Open the autonum editor */ void DiagramPropertiesDialog::editAutonum() { ProjectPropertiesDialog ppd (m_diagram->project(), this); @@ -134,14 +132,3 @@ 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(); -} diff --git a/sources/ui/diagrampropertiesdialog.h b/sources/ui/diagrampropertiesdialog.h index 672e0e968..ebf293dcc 100644 --- a/sources/ui/diagrampropertiesdialog.h +++ b/sources/ui/diagrampropertiesdialog.h @@ -37,7 +37,6 @@ class DiagramPropertiesDialog : public QDialog { public slots: void editAutonum (); - void editAutoFolioNum (); private: Diagram *m_diagram; diff --git a/sources/ui/folioautonumbering.cpp b/sources/ui/folioautonumbering.cpp deleted file mode 100644 index 5253142f4..000000000 --- a/sources/ui/folioautonumbering.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - 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 . -*/ -#include "folioautonumbering.h" -#include "ui_folioautonumbering.h" -#include -#include -#include -#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 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;idiagrams().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); - } -} diff --git a/sources/ui/folioautonumbering.h b/sources/ui/folioautonumbering.h deleted file mode 100644 index 345baceb5..000000000 --- a/sources/ui/folioautonumbering.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - 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 . -*/ -#ifndef FOLIOAUTONUMBERING_H -#define FOLIOAUTONUMBERING_H - -#include -#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 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 num_part_list_; - NumerotationContext m_context; - void updateFolioList(); -}; - -#endif // FOLIOAUTONUMBERING_H diff --git a/sources/ui/folioautonumbering.ui b/sources/ui/folioautonumbering.ui deleted file mode 100644 index 2d0601426..000000000 --- a/sources/ui/folioautonumbering.ui +++ /dev/null @@ -1,295 +0,0 @@ - - - FolioAutonumberingW - - - - 0 - 0 - 467 - 550 - - - - - 0 - 0 - - - - - 460 - 0 - - - - Form - - - - QLayout::SetDefaultConstraint - - - - - - 0 - 50 - - - - - 450 - 253 - - - - - 0 - 50 - - - - false - - - Qt::LeftToRight - - - Qt::ScrollBarAsNeeded - - - Qt::ScrollBarAlwaysOff - - - QAbstractScrollArea::AdjustToContents - - - true - - - Qt::AlignHCenter|Qt::AlignTop - - - - - 0 - 0 - 448 - 497 - - - - - 0 - 0 - - - - - 430 - 250 - - - - - QLayout::SetFixedSize - - - - - - 0 - 0 - - - - Numbering Options - - - - - - - 0 - 0 - - - - QComboBox::AdjustToContents - - - - - - - - 0 - 0 - - - - New Tabs - - - - - - - - 0 - 0 - - - - QComboBox::AdjustToContents - - - - - - - - 0 - 0 - - - - 999 - - - 10 - - - - - - - - 0 - 0 - - - - To - - - - - - - - 0 - 0 - - - - From - - - - - - - - - - - 0 - 0 - - - - Select: - - - - - - - 0 - 0 - - - - Create New Tabs - - - - - - - - 0 - 0 - - - - Autonumber Selected Tabs - - - - - - - - - - - 0 - 0 - - - - Folio Auto Numbering: - - - - - - - - 0 - 0 - - - - QComboBox::AdjustToContents - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - 0 - 0 - - - - QDialogButtonBox::Apply|QDialogButtonBox::Help|QDialogButtonBox::Reset - - - - - - - - diff --git a/sources/ui/projectpropertiesdialog.cpp b/sources/ui/projectpropertiesdialog.cpp index e2fa659ae..c0fb845a0 100644 --- a/sources/ui/projectpropertiesdialog.cpp +++ b/sources/ui/projectpropertiesdialog.cpp @@ -28,18 +28,11 @@ * @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(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); - + m_properties_dialog -> addPage(new NewDiagramPage (project)); + m_properties_dialog -> addPage(new ProjectAutoNumConfigPage (project)); } /** @@ -65,12 +58,3 @@ void ProjectPropertiesDialog::exec() { void ProjectPropertiesDialog::setCurrentPage(ProjectPropertiesDialog::Page p) { m_properties_dialog -> setCurrentPage(static_cast (p)); } - -/** - * @brief ProjectPropertiesDialog::changeToFolio - * Change the current displayed tab to folio tab. - */ -void ProjectPropertiesDialog::changeToFolio() { - ProjectAutoNumConfigPage *autoNumPage = static_cast (m_properties_dialog->pages.at(2)); - autoNumPage->changeToTab(1); -} diff --git a/sources/ui/projectpropertiesdialog.h b/sources/ui/projectpropertiesdialog.h index 14c2c1c90..8bbbdcf17 100644 --- a/sources/ui/projectpropertiesdialog.h +++ b/sources/ui/projectpropertiesdialog.h @@ -17,7 +17,6 @@ */ #ifndef PROJECTPROPERTIESDIALOG_H #define PROJECTPROPERTIESDIALOG_H -#include class QETProject; class QWidget; @@ -27,7 +26,8 @@ class ConfigDialog; * @brief The ProjectPropertiesDialog class * this class builds a dialog to edit whole properties of a project */ -class ProjectPropertiesDialog : public QObject { +class ProjectPropertiesDialog +{ public: enum Page { Main = 0, @@ -39,7 +39,6 @@ class ProjectPropertiesDialog : public QObject { ~ProjectPropertiesDialog(); void exec(); void setCurrentPage(ProjectPropertiesDialog::Page); - void changeToFolio(); private: ConfigDialog *m_properties_dialog; diff --git a/sources/ui/selectautonumw.ui b/sources/ui/selectautonumw.ui index a2630d8ec..871772497 100644 --- a/sources/ui/selectautonumw.ui +++ b/sources/ui/selectautonumw.ui @@ -6,289 +6,183 @@ 0 0 - 466 - 506 + 432 + 273 - - - 0 - 0 - - Form - - - - 0 - 0 - + + + Définition - - - 430 - 455 - - - - - 0 - 0 - - - - false - - - Qt::LeftToRight - - - Qt::ScrollBarAsNeeded - - - Qt::ScrollBarAlwaysOff - - - QAbstractScrollArea::AdjustToContents - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 460 - 453 - - - - - 0 - 0 - - - - - 460 - 450 - - - - - QLayout::SetFixedSize - - - - - - 0 - 0 - - - - Définition - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - QLayout::SetFixedSize + + + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + <html><head/><body><p>Supprimer une variable de numérotation</p></body></html> + + + + + + + :/ico/22x22/list-remove.png:/ico/22x22/list-remove.png + + + false + + + + + + + <html><head/><body><p>Ajouter une variable de numérotation</p></body></html> + + + + + + + :/ico/22x22/list-add.png:/ico/22x22/list-add.png + + + false + + + + + + + Précédent + + + + + + + :/ico/16x16/arrow-left.png:/ico/16x16/arrow-left.png + + + + + + + Suivant + + + + + + + :/ico/16x16/arrow-right.png:/ico/16x16/arrow-right.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + + + 0 - - - 0 + + + Type - - QLayout::SetDefaultConstraint + + Qt::AlignCenter - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p>Supprimer une variable de numérotation</p></body></html> - - - - - - - :/ico/22x22/list-remove.png:/ico/22x22/list-remove.png - - - false - - - - - - - <html><head/><body><p>Ajouter une variable de numérotation</p></body></html> - - - - - - - :/ico/22x22/list-add.png:/ico/22x22/list-add.png - - - false - - - - - - - Précédent - - - - - - - :/ico/16x16/arrow-left.png:/ico/16x16/arrow-left.png - - - - - - - Suivant - - - - - - - :/ico/16x16/arrow-right.png:/ico/16x16/arrow-right.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + - - - 0 + + + Valeur - - QLayout::SetDefaultConstraint + + Qt::AlignCenter - - - - 0 - - - QLayout::SetDefaultConstraint - - - - - Type - - - Qt::AlignCenter - - - - - - - Valeur - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - Incrémentation - - - Qt::AlignCenter - - - - - - + - - - Qt::Vertical + + + + 0 + 0 + - - QSizePolicy::MinimumExpanding + + Incrémentation - - - 20 - 30 - + + Qt::AlignCenter - + - - - - + + + + - - - - 0 - 0 - + + + Qt::Vertical + + + 20 + 40 + + + + + + QDialogButtonBox::Apply|QDialogButtonBox::Help|QDialogButtonBox::Reset diff --git a/sources/ui/titleblockpropertieswidget.cpp b/sources/ui/titleblockpropertieswidget.cpp index 54b3befe1..86e1fbd9e 100644 --- a/sources/ui/titleblockpropertieswidget.cpp +++ b/sources/ui/titleblockpropertieswidget.cpp @@ -29,13 +29,13 @@ * @param current_date if true, display the radio button "current date" * @param parent parent widget */ -TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock, bool current_date, QETProject *project, QWidget *parent) : +TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) : QWidget(parent), ui(new Ui::TitleBlockPropertiesWidget) { ui->setupUi(this); - initDialog(current_date, project); - setProperties(titleblock); + initDialog(current_date); + 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, QETProject *project, QWidget *parent) : +TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) : QWidget(parent), ui(new Ui::TitleBlockPropertiesWidget) { ui->setupUi(this); - initDialog(current_date,project); + initDialog(current_date); 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 tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QETProject *project, QWidget *parent) : +TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(QList tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) : QWidget(parent), ui(new Ui::TitleBlockPropertiesWidget) { ui->setupUi(this); - initDialog(current_date,project); + initDialog(current_date); foreach (TitleBlockTemplatesCollection *c, tbt_collection) addCollection(c); updateTemplateList(); @@ -96,7 +96,6 @@ 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); @@ -173,46 +172,6 @@ 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; } @@ -261,7 +220,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, QETProject *project) { +void TitleBlockPropertiesWidget::initDialog(const bool ¤t_date) { m_dcw = new DiagramContextWidget(); ui -> m_tab2_vlayout -> addWidget(m_dcw); @@ -280,19 +239,6 @@ void TitleBlockPropertiesWidget::initDialog(const bool ¤t_date, QETProjec 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(); - } - } /** @@ -396,15 +342,3 @@ 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 - } -} diff --git a/sources/ui/titleblockpropertieswidget.h b/sources/ui/titleblockpropertieswidget.h index d6020c185..3c4491cea 100644 --- a/sources/ui/titleblockpropertieswidget.h +++ b/sources/ui/titleblockpropertieswidget.h @@ -18,15 +18,11 @@ #ifndef TITLEBLOCKPROPERTIESWIDGET_H #define TITLEBLOCKPROPERTIESWIDGET_H -#include "qetproject.h" #include #include "titleblockproperties.h" #include "diagramcontextwidget.h" #include "qet.h" -#include "numerotationcontext.h" -class NumerotationContext; -class QETProject; class QMenu; class TitleBlockTemplatesCollection; @@ -39,15 +35,13 @@ class TitleBlockPropertiesWidget : public QWidget Q_OBJECT public: - 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 tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QETProject *project = NULL, QWidget *parent = 0); + 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 tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, 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); @@ -55,7 +49,7 @@ class TitleBlockPropertiesWidget : public QWidget private: void addCollection (TitleBlockTemplatesCollection *tbt_collection); QString currentTitleBlockTemplateName () const; - void initDialog(const bool ¤t_date, QETProject *project); + void initDialog(const bool ¤t_date); int getIndexFor (const QString &tbt_name, const QET::QetCollection collection) const; private slots: @@ -64,12 +58,9 @@ 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; @@ -78,7 +69,6 @@ class TitleBlockPropertiesWidget : public QWidget QMenu *m_tbt_menu; QList m_tbt_collection_list; QList m_map_index_to_collection_type; - QList keys_2; }; #endif // TITLEBLOCKPROPERTIESWIDGET_H diff --git a/sources/ui/titleblockpropertieswidget.ui b/sources/ui/titleblockpropertieswidget.ui index 2a3f53d0b..084d7ff19 100644 --- a/sources/ui/titleblockpropertieswidget.ui +++ b/sources/ui/titleblockpropertieswidget.ui @@ -6,8 +6,8 @@ 0 0 - 572 - 590 + 530 + 452 @@ -33,316 +33,256 @@ 9 - - - true + + + Informations des cartouches - - - - 0 - 0 - 552 - 570 - - - - - - - Informations des cartouches - - - false - - - false - - + + false + + + false + + + + + + QLayout::SetDefaultConstraint + + + + + Modèle : + + + + + + + + + + + + + + :/ico/16x16/label.png:/ico/16x16/label.png + + + false + + + + + + + + + + 0 + 0 + + + + QTabWidget::South + + + QTabWidget::Rounded + + + 0 + + + Qt::ElideNone + + + true + + + false + + + + Principales + + - - - QLayout::SetDefaultConstraint - - - - - Modèle : + + + + + Disponible en tant que %folio pour les modèles de cartouches - - - - - + + - + Auteur : - - - :/ico/16x16/label.png:/ico/16x16/label.png + + + + + + Afficher : - + + + + + + QFrame::NoFrame + + + 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 + + false + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + + Pas de date + + + + + + + Date courante + + + + + + + Appliquer la date actuelle + + + + + + + :/ico/22x22/start.png:/ico/22x22/start.png + + + + + + + Disponible en tant que %date pour les modèles de cartouches + + + true + + + true + + + + + + + Date fixe : + + + + + + + + + Date : + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + Fichier : + + + + + + + Disponible en tant que %title pour les modèles de cartouches + + + + + + + Titre : + + + + + + + Disponible en tant que %author pour les modèles de cartouches + + + + + + + Folio : + + + + + + + Disponible en tant que %filename pour les modèles de cartouches + + + + + + + <html><head/><body><p>Affiche le cartouche en bas (horizontalement) ou à droite (verticalement) du folio.</p></body></html> + + + + en bas + + + + + à droite (expérimental) + + + + + + + Personnalisées + + - - - - 0 - 0 - - - - QTabWidget::South - - - QTabWidget::Rounded - - - 0 - - - Qt::ElideNone - - - true - - - false - - - - Principales - - - - - - - - Fichier : - - - - - - - QFrame::NoFrame - - - Les variables suivantes sont utilisables dans le champ Folio : -- %id : numéro du folio courant dans le projet -- %total : nombre total de folios dans le projet -- %autonum : Folio Auto Numeration - - - false - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Date : - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Folio : - - - - - - - Titre : - - - - - - - Disponible en tant que %folio pour les modèles de cartouches - - - - - - - Disponible en tant que %title pour les modèles de cartouches - - - - - - - <html><head/><body><p>Affiche le cartouche en bas (horizontalement) ou à droite (verticalement) du folio.</p></body></html> - - - - en bas - - - - - à droite (expérimental) - - - - - - - - Disponible en tant que %filename pour les modèles de cartouches - - - - - - - Auteur : - - - - - - - - - Pas de date - - - - - - - Date courante - - - - - - - Appliquer la date actuelle - - - - - - - :/ico/22x22/start.png:/ico/22x22/start.png - - - - - - - Disponible en tant que %date pour les modèles de cartouches - - - true - - - true - - - - - - - Date fixe : - - - - - - - - - Disponible en tant que %author pour les modèles de cartouches - - - - - - - Afficher : - - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - 16 - 16 - - - - - - - - :/ico/16x16/configure.png:/ico/16x16/configure.png - - - - - - - - - Page Num: - - - - - - - - - - Personnalisées - - - - - - - - Vous pouvez définir ici vos propres associations noms/valeurs pour que le cartouche en tienne compte. Exemple : + + + + + Vous pouvez définir ici vos propres associations noms/valeurs pour que le cartouche en tienne compte. Exemple : associer le nom "volta" et la valeur "1745" remplacera %{volta} par 1745 dans le cartouche. @@ -360,10 +300,6 @@ associer le nom "volta" et la valeur "1745" remplacera %{vol - - - -