mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-14 20:33:05 +02:00
Minor code improvent in creation of diagram folio list
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3313 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
f3aeb872c3
commit
0b5c110b8f
@ -295,7 +295,8 @@ QETResult ProjectView::noProjectResult() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Ajoute un nouveau schema au ProjectView
|
* @brief ProjectView::addNewDiagram
|
||||||
|
* Add new diagram to project view
|
||||||
*/
|
*/
|
||||||
void ProjectView::addNewDiagram() {
|
void ProjectView::addNewDiagram() {
|
||||||
if (project_ -> isReadOnly()) return;
|
if (project_ -> isReadOnly()) return;
|
||||||
@ -309,14 +310,21 @@ void ProjectView::addNewDiagram() {
|
|||||||
showDiagram(new_diagram_view);
|
showDiagram(new_diagram_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ProjectView::addNewDiagramFolioList
|
||||||
|
* Add new diagram folio list to project
|
||||||
|
*/
|
||||||
void ProjectView::addNewDiagramFolioList() {
|
void ProjectView::addNewDiagramFolioList() {
|
||||||
if (project_ -> isReadOnly()) return;
|
if (project_ -> isReadOnly()) return;
|
||||||
|
|
||||||
Diagram *new_diagram = project_ -> addNewDiagramFolioList();
|
QList <Diagram *> list = project_ -> addNewDiagramFolioList();
|
||||||
DiagramView *new_diagram_view = new DiagramView(new_diagram);
|
int size = list.size();
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
DiagramView *new_diagram_view = new DiagramView(list.takeLast());
|
||||||
addDiagram(new_diagram_view, true);
|
addDiagram(new_diagram_view, true);
|
||||||
showDiagram(new_diagram_view);
|
showDiagram(new_diagram_view);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Ajoute un schema au ProjectView
|
Ajoute un schema au ProjectView
|
||||||
@ -352,8 +360,7 @@ void ProjectView::addDiagram(DiagramView *diagram, bool front) {
|
|||||||
emit(diagramAdded(diagram));
|
emit(diagramAdded(diagram));
|
||||||
// move tab to front if wanted
|
// move tab to front if wanted
|
||||||
if (front) {
|
if (front) {
|
||||||
tabs_->moveTab(tabs_->count()-1, project_ -> getFolioSheetsQuantity()-1);
|
tabs_->moveTab(tabs_->count()-1, 0);
|
||||||
//diagram -> diagram() -> project() -> setFolioSheetsQuantity(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1698,16 +1698,14 @@ void QETDiagramEditor::addDiagramToProject() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETDiagramEditor::addDiagramFolioListToProject
|
||||||
|
* Add new folio list to project
|
||||||
|
*/
|
||||||
void QETDiagramEditor::addDiagramFolioListToProject() {
|
void QETDiagramEditor::addDiagramFolioListToProject() {
|
||||||
ProjectView *current_project = currentProject();
|
if (ProjectView *current_project = currentProject())
|
||||||
if (current_project && current_project -> project() -> getFolioSheetsQuantity() == 0) {
|
|
||||||
|
|
||||||
// The number of folio sheets depend on the number of diagrams in the project.
|
|
||||||
int diagram_qty = current_project -> diagrams().size();
|
|
||||||
for (int i = 0; i <= diagram_qty/58; i++)
|
|
||||||
current_project -> addNewDiagramFolioList();
|
current_project -> addNewDiagramFolioList();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Ajoute un nouveau schema a un projet
|
Ajoute un nouveau schema a un projet
|
||||||
|
@ -914,9 +914,17 @@ Diagram *QETProject::addNewDiagram() {
|
|||||||
* Add new diagram folio list
|
* Add new diagram folio list
|
||||||
* @return the created diagram
|
* @return the created diagram
|
||||||
*/
|
*/
|
||||||
Diagram *QETProject::addNewDiagramFolioList() {
|
QList <Diagram *> QETProject::addNewDiagramFolioList() {
|
||||||
// do nothing if project is read only
|
// do nothing if project is read only or folio sheet is alredy created
|
||||||
if (isReadOnly()) return(0);
|
QList <Diagram *> diagram_list;
|
||||||
|
|
||||||
|
if (!isReadOnly() && getFolioSheetsQuantity() == 0) {
|
||||||
|
|
||||||
|
//reset the number of folio sheet
|
||||||
|
setFolioSheetsQuantity(0);
|
||||||
|
|
||||||
|
int diagCount = diagrams().size();
|
||||||
|
for (int i = 0; i <= diagCount/58; i++) {
|
||||||
|
|
||||||
//create new diagram
|
//create new diagram
|
||||||
Diagram *diagram_folio_list = new DiagramFolioList(this);
|
Diagram *diagram_folio_list = new DiagramFolioList(this);
|
||||||
@ -931,12 +939,14 @@ Diagram *QETProject::addNewDiagramFolioList() {
|
|||||||
diagram_folio_list -> border_and_titleblock.displayRows(false);
|
diagram_folio_list -> border_and_titleblock.displayRows(false);
|
||||||
diagram_folio_list -> border_and_titleblock.displayColumns(false);
|
diagram_folio_list -> border_and_titleblock.displayColumns(false);
|
||||||
|
|
||||||
|
|
||||||
addDiagram(diagram_folio_list);
|
addDiagram(diagram_folio_list);
|
||||||
setFolioSheetsQuantity( getFolioSheetsQuantity()+1 );
|
setFolioSheetsQuantity( getFolioSheetsQuantity()+1 );
|
||||||
|
|
||||||
emit(diagramAdded(this, diagram_folio_list));
|
emit(diagramAdded(this, diagram_folio_list));
|
||||||
return(diagram_folio_list);
|
diagram_list << diagram_folio_list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(diagram_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1027,7 +1037,6 @@ void QETProject::readProjectXml() {
|
|||||||
// la racine du document XML est sensee etre un element "project"
|
// la racine du document XML est sensee etre un element "project"
|
||||||
if (root_elmt.tagName() == "project") {
|
if (root_elmt.tagName() == "project") {
|
||||||
|
|
||||||
|
|
||||||
// mode d'ouverture normal
|
// mode d'ouverture normal
|
||||||
if (root_elmt.hasAttribute("version")) {
|
if (root_elmt.hasAttribute("version")) {
|
||||||
bool conv_ok;
|
bool conv_ok;
|
||||||
@ -1067,11 +1076,6 @@ void QETProject::readProjectXml() {
|
|||||||
// charge les proprietes par defaut pour les nouveaux schemas
|
// charge les proprietes par defaut pour les nouveaux schemas
|
||||||
readDefaultPropertiesXml();
|
readDefaultPropertiesXml();
|
||||||
|
|
||||||
// if there is an attribute for folioSheetQuantity, then set it accordingly.
|
|
||||||
// If not, then the value remains at the initial value of zero.
|
|
||||||
if (root_elmt.hasAttribute("folioSheetQuantity"))
|
|
||||||
addNewDiagramFolioList();
|
|
||||||
|
|
||||||
// load the embedded titleblock templates
|
// load the embedded titleblock templates
|
||||||
readEmbeddedTemplatesXml();
|
readEmbeddedTemplatesXml();
|
||||||
|
|
||||||
@ -1081,6 +1085,12 @@ void QETProject::readProjectXml() {
|
|||||||
// charge les schemas
|
// charge les schemas
|
||||||
readDiagramsXml();
|
readDiagramsXml();
|
||||||
|
|
||||||
|
// if there is an attribute for folioSheetQuantity, then set it accordingly.
|
||||||
|
// If not, then the value remains at the initial value of zero.
|
||||||
|
if (root_elmt.attribute("folioSheetQuantity","0").toInt()) {
|
||||||
|
addNewDiagramFolioList();
|
||||||
|
}
|
||||||
|
|
||||||
state_ = Ok;
|
state_ = Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class QETProject : public QObject {
|
|||||||
public slots:
|
public slots:
|
||||||
void componentWritten();
|
void componentWritten();
|
||||||
Diagram *addNewDiagram();
|
Diagram *addNewDiagram();
|
||||||
Diagram *addNewDiagramFolioList();
|
QList <Diagram *> addNewDiagramFolioList();
|
||||||
void removeDiagram(Diagram *);
|
void removeDiagram(Diagram *);
|
||||||
void diagramOrderChanged(int, int);
|
void diagramOrderChanged(int, int);
|
||||||
void setModified(bool);
|
void setModified(bool);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user