[qet] [4618] titleblockpropertieswidget : edit and duplicate titleblock work in every case. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4618
Author: blacksun
Date: 2016-08-10 08:55:16 +0200 (Wed, 10 Aug 2016)
Log Message:
-----------
titleblockpropertieswidget : edit and duplicate titleblock work in every case.
Modified Paths:
--------------
trunk/sources/diagramview.h
trunk/sources/projectconfigpages.h
trunk/sources/projectview.cpp
trunk/sources/projectview.h
trunk/sources/qetapp.cpp
trunk/sources/qetdiagrameditor.cpp
trunk/sources/ui/diagrampropertiesdialog.cpp
trunk/sources/ui/projectpropertiesdialog.cpp
trunk/sources/ui/titleblockpropertieswidget.cpp
trunk/sources/ui/titleblockpropertieswidget.h
Modified: trunk/sources/diagramview.h
===================================================================
--- trunk/sources/diagramview.h 2016-08-10 06:43:51 UTC (rev 4617)
+++ trunk/sources/diagramview.h 2016-08-10 06:55:16 UTC (rev 4618)
@@ -120,8 +120,6 @@
void findElementRequired(const ElementsLocation &);
/// Signal emitted when users wish to edit an element from the diagram
void editElementRequired(const ElementsLocation &);
- /// Signal emitted when users want to edit and/or duplicate an existing title block template
- void editTitleBlockTemplate(const QString &, bool);
/// Signal emmitted when diagram must be show
void showDiagram (Diagram *);
Modified: trunk/sources/projectconfigpages.h
===================================================================
--- trunk/sources/projectconfigpages.h 2016-08-10 06:43:51 UTC (rev 4617)
+++ trunk/sources/projectconfigpages.h 2016-08-10 06:55:16 UTC (rev 4618)
@@ -1,5 +1,3 @@
-
-
/*
Copyright 2006-2016 The QElectroTech Team
This file is part of QElectroTech.
@@ -20,13 +18,11 @@
#ifndef PROJECTCONFIGPAGES_H
#define PROJECTCONFIGPAGES_H
#include "configpage.h"
-#include <QtWidgets>
class QLabel;
class QLineEdit;
class QETProject;
class BorderPropertiesWidget;
-class TitleBlockPropertiesWidget;
class ConductorPropertiesWidget;
class DiagramContextWidget;
class ReportPropertieWidget;
@@ -37,6 +33,8 @@
class FolioAutonumberingW;
class ElementAutonumberingW;
class AutoNumberingManagementW;
+class QTabWidget;
+class QScrollArea;
/**
This class, derived from ConfigPage, aims at providing the basic skeleton
Modified: trunk/sources/projectview.cpp
===================================================================
--- trunk/sources/projectview.cpp 2016-08-10 06:43:51 UTC (rev 4617)
+++ trunk/sources/projectview.cpp 2016-08-10 06:55:16 UTC (rev 4618)
@@ -89,7 +89,7 @@
@return la liste des schemas ouverts dans le projet
*/
QList<DiagramView *> ProjectView::diagrams() const {
- return(diagrams_);
+ return(m_diagram_view_list);
}
/**
@@ -406,27 +406,26 @@
* @param front: true add page at front
* false add page at back
*/
-void ProjectView::addDiagram(DiagramView *diagram) {
- if (!diagram) return;
+void ProjectView::addDiagram(DiagramView *diagram_view) {
+ if (!diagram_view) return;
// check diagram isn't present in the project
- if (diagram_ids_.values().contains(diagram)) return;
+ if (diagram_ids_.values().contains(diagram_view)) return;
// Add new tab for the diagram
- m_tab -> addTab(diagram, QET::Icons::Diagram, diagram -> title());
- diagram -> setFrameStyle(QFrame::Plain | QFrame::NoFrame);
+ m_tab -> addTab(diagram_view, QET::Icons::Diagram, diagram_view -> title());
+ diagram_view -> setFrameStyle(QFrame::Plain | QFrame::NoFrame);
- diagrams_ << diagram;
+ m_diagram_view_list << diagram_view;
rebuildDiagramsMap();
- connect(diagram, SIGNAL(showDiagram(Diagram*)), this, SLOT(showDiagram(Diagram*)));
- connect(diagram, SIGNAL(titleChanged(DiagramView *, const QString &)), this, SLOT(updateTabTitle(DiagramView *, const QString &)));
- 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)));
+ connect(diagram_view, SIGNAL(showDiagram(Diagram*)), this, SLOT(showDiagram(Diagram*)));
+ connect(diagram_view, SIGNAL(titleChanged(DiagramView *, const QString &)), this, SLOT(updateTabTitle(DiagramView *, const QString &)));
+ connect(diagram_view, SIGNAL(findElementRequired(const ElementsLocation &)), this, SIGNAL(findElementRequired(const ElementsLocation &)));
+ connect(diagram_view, SIGNAL(editElementRequired(const ElementsLocation &)), this, SIGNAL(editElementRequired(const ElementsLocation &)));
// signal diagram was added
- emit(diagramAdded(diagram));
+ emit(diagramAdded(diagram_view));
}
/**
@@ -456,7 +455,7 @@
// enleve le DiagramView des onglets
int diagram_tab_id = diagram_ids_.key(diagram_view);
m_tab -> removeTab(diagram_tab_id);
- diagrams_.removeAll(diagram_view);
+ m_diagram_view_list.removeAll(diagram_view);
rebuildDiagramsMap();
// supprime le DiagramView, puis le Diagram
@@ -962,22 +961,6 @@
}
/**
- Require the edition of the \a template_name title blocke template.
- @param template_name Name of the tempalte to be edited
- @param duplicate If true, this methd will ask the user for a template name
- in order to duplicate the \a template_name template
-*/
-void ProjectView::editTitleBlockTemplateRequired(const QString &template_name, bool duplicate) {
- if (!m_project) return;
- emit(
- editTitleBlockTemplate(
- m_project -> embeddedTitleBlockTemplatesCollection() -> location(template_name),
- duplicate
- )
- );
-}
-
-/**
@param diagram Schema a trouver
@return le DiagramView correspondant au schema passe en parametre, ou 0 si
le schema n'est pas trouve
@@ -998,7 +981,7 @@
// vide la map
diagram_ids_.clear();
- foreach(DiagramView *diagram_view, diagrams_) {
+ foreach(DiagramView *diagram_view, m_diagram_view_list) {
int dv_idx = m_tab -> indexOf(diagram_view);
if (dv_idx == -1) continue;
diagram_ids_.insert(dv_idx, diagram_view);
Modified: trunk/sources/projectview.h
===================================================================
--- trunk/sources/projectview.h 2016-08-10 06:43:51 UTC (rev 4617)
+++ trunk/sources/projectview.h 2016-08-10 06:55:16 UTC (rev 4618)
@@ -99,7 +99,6 @@
void updateWindowTitle();
void updateTabTitle(DiagramView *, const QString &);
void tabMoved(int, int);
- void editTitleBlockTemplateRequired(const QString &, bool);
signals:
void diagramAdded(DiagramView *);
@@ -111,7 +110,6 @@
// relayed signals
void findElementRequired(const ElementsLocation &);
void editElementRequired(const ElementsLocation &);
- void editTitleBlockTemplate(const TitleBlockTemplateLocation &, bool);
private:
void initActions();
@@ -145,7 +143,7 @@
QLabel *fallback_label_;
QTabWidget *m_tab;
QMap<int, DiagramView *> diagram_ids_;
- QList<DiagramView *> diagrams_;
+ QList<DiagramView *> m_diagram_view_list;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(ProjectView::ProjectSaveOptions)
#endif
Modified: trunk/sources/qetapp.cpp
===================================================================
--- trunk/sources/qetapp.cpp 2016-08-10 06:43:51 UTC (rev 4617)
+++ trunk/sources/qetapp.cpp 2016-08-10 06:55:16 UTC (rev 4618)
@@ -1194,6 +1194,7 @@
// cree le dialogue
ConfigDialog cd;
cd.setWindowTitle(tr("Configurer QElectroTech", "window title"));
+ cd.setWindowModality(Qt::WindowModal);
cd.addPage(new GeneralConfigurationPage());
cd.addPage(new NewDiagramPage());
cd.addPage(new ExportConfigPage());
Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp 2016-08-10 06:43:51 UTC (rev 4617)
+++ trunk/sources/qetdiagrameditor.cpp 2016-08-10 06:55:16 UTC (rev 4618)
@@ -1501,7 +1501,6 @@
//Manage request for edit or find element and titleblock
connect(project_view, SIGNAL(findElementRequired(const ElementsLocation &)), this, SLOT(findElementInPanel(const ElementsLocation &)));
connect(project_view, SIGNAL(editElementRequired(const ElementsLocation &)), this, SLOT(editElementInEditor(const ElementsLocation &)));
- connect(project_view, SIGNAL(editTitleBlockTemplate(const TitleBlockTemplateLocation &, bool)), QETApp::instance(), SLOT(openTitleBlockTemplate(TitleBlockTemplateLocation, bool)));
// display error messages sent by the project view
connect(project_view, SIGNAL(errorEncountered(QString)), this, SLOT(showError(const QString &)));
Modified: trunk/sources/ui/diagrampropertiesdialog.cpp
===================================================================
--- trunk/sources/ui/diagrampropertiesdialog.cpp 2016-08-10 06:43:51 UTC (rev 4617)
+++ trunk/sources/ui/diagrampropertiesdialog.cpp 2016-08-10 06:55:16 UTC (rev 4618)
@@ -54,15 +54,15 @@
//Title block widget
TitleBlockPropertiesWidget *titleblock_infos;
- if (QETProject *parent_project = diagram -> project()) {
- titleblock_infos = new TitleBlockPropertiesWidget(parent_project -> embeddedTitleBlockTemplatesCollection(), titleblock, false, diagram->project(), this);
- connect(titleblock_infos, SIGNAL(editTitleBlockTemplate(QString, bool)), diagram->views().first(), SIGNAL(editTitleBlockTemplate(QString, bool)));
- }
+
+ if (QETProject *parent_project = diagram -> project())
+ titleblock_infos = new TitleBlockPropertiesWidget(parent_project -> embeddedTitleBlockTemplatesCollection(), titleblock, false, diagram->project(), this);
else
- titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, diagram->project(), this);
+ titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, diagram->project(), this);
+
titleblock_infos -> setReadOnly(diagram_is_read_only);
- connect(titleblock_infos,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(editAutoFolioNum()));
- titleblock_infos->setMinimumSize(590,480); //Minimum Size needed for correct display
+ 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);
Modified: trunk/sources/ui/projectpropertiesdialog.cpp
===================================================================
--- trunk/sources/ui/projectpropertiesdialog.cpp 2016-08-10 06:43:51 UTC (rev 4617)
+++ trunk/sources/ui/projectpropertiesdialog.cpp 2016-08-10 06:55:16 UTC (rev 4618)
@@ -54,6 +54,7 @@
* execute this dialog.
*/
void ProjectPropertiesDialog::exec() {
+ m_properties_dialog->setWindowModality(Qt::WindowModal);
m_properties_dialog -> exec();
}
Modified: trunk/sources/ui/titleblockpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/titleblockpropertieswidget.cpp 2016-08-10 06:43:51 UTC (rev 4617)
+++ trunk/sources/ui/titleblockpropertieswidget.cpp 2016-08-10 06:55:16 UTC (rev 4618)
@@ -20,6 +20,7 @@
#include "templatescollection.h"
#include "qeticons.h"
#include "titleblocktemplate.h"
+#include "qetapp.h"
#include <QMenu>
/**
@@ -216,6 +217,20 @@
return prop;
}
+TitleBlockTemplateLocation TitleBlockPropertiesWidget::currentTitleBlockLocation() const
+{
+ QET::QetCollection qc = m_map_index_to_collection_type.at(ui->m_tbt_cb->currentIndex());
+ TitleBlockTemplatesCollection *collection = nullptr;
+ foreach (TitleBlockTemplatesCollection *c, m_tbt_collection_list)
+ if (c -> collection() == qc)
+ collection = c;
+
+ if (!collection)
+ return TitleBlockTemplateLocation();
+
+ return collection->location(currentTitleBlockTemplateName());
+}
+
/**
* @brief TitleBlockPropertiesWidget::setTitleBlockTemplatesVisible
* if true, title block template combo box and menu button is visible
@@ -313,11 +328,11 @@
}
void TitleBlockPropertiesWidget::editCurrentTitleBlockTemplate() {
- emit(editTitleBlockTemplate(currentTitleBlockTemplateName(), false));
+ QETApp::instance()->openTitleBlockTemplate(currentTitleBlockLocation(), false);
}
void TitleBlockPropertiesWidget::duplicateCurrentTitleBlockTemplate() {
- emit(editTitleBlockTemplate(currentTitleBlockTemplateName(), true));
+ QETApp::instance()->openTitleBlockTemplate(currentTitleBlockLocation(), true);
}
/**
Modified: trunk/sources/ui/titleblockpropertieswidget.h
===================================================================
--- trunk/sources/ui/titleblockpropertieswidget.h 2016-08-10 06:43:51 UTC (rev 4617)
+++ trunk/sources/ui/titleblockpropertieswidget.h 2016-08-10 06:55:16 UTC (rev 4618)
@@ -47,6 +47,7 @@
void setProperties(const TitleBlockProperties &properties);
TitleBlockProperties properties() const;
TitleBlockProperties propertiesAutoNum(QString autoNum) const;
+ TitleBlockTemplateLocation currentTitleBlockLocation () const;
void setPropertiesWithAutoNum(const TitleBlockProperties &properties, QString autoNum);
void setTitleBlockTemplatesVisible(const bool &visible);
@@ -67,7 +68,6 @@
void on_m_edit_autofolionum_pb_clicked();
signals:
- void editTitleBlockTemplate(const QString &, bool);
void set_auto_page_num() const;
void openAutoNumFolioEditor (QString);