Folio List: DXF folio corrected, Delete folio sheet bug corrected,

Folio New Sheets are inserted in the beginning but after the previous folio sheets


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2846 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
abhishekm71
2014-02-10 11:48:05 +00:00
parent d04c03afa4
commit c96036b7fa
4 changed files with 38 additions and 32 deletions

View File

@@ -419,8 +419,8 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
y0 += rowHeight; y0 += rowHeight;
QRectF row_rect(x0, y0, list_rectangles[0] -> width(), rowHeight); QRectF row_rect(x0, y0, list_rectangles[0] -> width(), rowHeight);
fillRow(file_path, row_rect, diagram_list[i] -> border_and_titleblock.author(), fillRow(file_path, row_rect, diagram_list[i] -> border_and_titleblock.author(),
diagram_list[i] -> border_and_titleblock.title(), diagram_list[i] -> title(),
diagram_list[i] -> border_and_titleblock.folio(), QString::number(diagram_list[i] ->folioIndex()+1),
diagram_list[i] -> border_and_titleblock.date().toString("dd/MM/yyyy")); diagram_list[i] -> border_and_titleblock.date().toString("dd/MM/yyyy"));
} }
@@ -436,8 +436,8 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
y0 += rowHeight; y0 += rowHeight;
QRectF row_rect(x0, y0, list_rectangles[1] -> width(), rowHeight); QRectF row_rect(x0, y0, list_rectangles[1] -> width(), rowHeight);
fillRow(file_path, row_rect, diagram_list[i] -> border_and_titleblock.author(), fillRow(file_path, row_rect, diagram_list[i] -> border_and_titleblock.author(),
diagram_list[i] -> border_and_titleblock.title(), diagram_list[i] -> title(),
diagram_list[i] -> border_and_titleblock.folio(), QString::number(diagram_list[i] ->folioIndex()+1),
diagram_list[i] -> border_and_titleblock.date().toString("dd/MM/yyyy")); diagram_list[i] -> border_and_titleblock.date().toString("dd/MM/yyyy"));
} }

View File

@@ -339,7 +339,13 @@ void ProjectView::addDiagram(DiagramView *diagram, bool front) {
// Add new tab for the diagram // Add new tab for the diagram
tabs_ -> addTab(diagram, QET::Icons::Diagram, diagram -> title()); tabs_ -> addTab(diagram, QET::Icons::Diagram, diagram -> title());
diagram -> setFrameStyle(QFrame::Plain | QFrame::NoFrame); diagram -> setFrameStyle(QFrame::Plain | QFrame::NoFrame);
diagrams_ << diagram;
// Add diagram type is a folio list then add it just after the last folio list in project, else add it at the back.
//if (DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diagram))
//diagrams_.insert(DiagramFolioList::folioList_quantity, diagram);
//else
diagrams_ << diagram;
rebuildDiagramsMap(); rebuildDiagramsMap();
connect(diagram, SIGNAL(showDiagram(Diagram*)), this, SLOT(showDiagram(Diagram*))); 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(titleChanged(DiagramView *, const QString &)), this, SLOT(updateTabTitle(DiagramView *, const QString &)));
@@ -350,8 +356,12 @@ void ProjectView::addDiagram(DiagramView *diagram, bool front) {
// signal diagram was added // signal diagram was added
emit(diagramAdded(diagram)); emit(diagramAdded(diagram));
// move tab to front if wanted // move tab to front if wanted
if (front) if (front) { //DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diagram ->diagram())) {
tabs_->moveTab(tabs_->count()-1, 0); //int tabCount = tabs_ -> count();
//for (int i = 0; i < (tabCount-1) - (DiagramFolioList::folioList_quantity-1); i++)
//moveDiagramUp(diagram);
tabs_->moveTab(tabs_->count()-1, DiagramFolioList::folioList_quantity-1);
}
} }
/** /**
@@ -421,6 +431,7 @@ void ProjectView::removeDiagram(Diagram *diagram) {
void ProjectView::showDiagram(DiagramView *diagram) { void ProjectView::showDiagram(DiagramView *diagram) {
if (!diagram) return; if (!diagram) return;
tabs_ -> setCurrentWidget(diagram); tabs_ -> setCurrentWidget(diagram);
;
} }
/** /**

View File

@@ -652,7 +652,7 @@ bool QETDiagramEditor::newProject() {
new_project -> setDefaultReportProperties(defaultReportProperties()); new_project -> setDefaultReportProperties(defaultReportProperties());
// add summary and new diagram // add summary and new diagram
new_project -> addNewDiagramFolioList(); //new_project -> addNewDiagramFolioList();
new_project -> addNewDiagram(); new_project -> addNewDiagram();
return(addProject(new_project)); return(addProject(new_project));
@@ -1804,7 +1804,24 @@ void QETDiagramEditor::removeDiagramFromProject() {
if (ProjectView *current_project = currentProject()) { if (ProjectView *current_project = currentProject()) {
if (DiagramView *current_diagram = current_project -> currentDiagram()) { if (DiagramView *current_diagram = current_project -> currentDiagram()) {
can_update_actions = false; can_update_actions = false;
bool isFolioList = false;
if (DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(current_diagram -> diagram()))
isFolioList = true;
current_project -> removeDiagram(current_diagram); current_project -> removeDiagram(current_diagram);
if (isFolioList) {
foreach (DiagramView *diag, current_project -> diagrams()) {
if (DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diag -> diagram())) {
current_project -> removeDiagram(diag);
}
}
} else if (current_project -> diagrams().size() % 58 == 0) {
foreach (DiagramView *diag, current_project -> diagrams()) {
DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diag -> diagram());
if (ptr && ptr -> getId() == DiagramFolioList::folioList_quantity-1) {
current_project -> removeDiagram(diag);
}
}
}
} }
} }
} }

View File

@@ -865,34 +865,12 @@ Diagram *QETProject::addNewDiagramFolioList() {
*/ */
void QETProject::removeDiagram(Diagram *diagram) { void QETProject::removeDiagram(Diagram *diagram) {
// ne fait rien si le projet est en lecture seule // ne fait rien si le projet est en lecture seule
if (isReadOnly()) return; if (isReadOnly()) return;
if (!diagram || !diagrams_.contains(diagram)) return; if (!diagram || !diagrams_.contains(diagram)) return;
DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diagram); if (diagrams_.removeAll(diagram)) {
if (ptr) {
foreach (Diagram *diag, diagrams_) {
ptr = dynamic_cast<DiagramFolioList *>(diag);
if (ptr) {
diagrams_.removeAll(ptr);
emit(diagramRemoved(this, ptr));
delete ptr;
}
}
} else if (diagrams_.removeAll(diagram)) {
emit(diagramRemoved(this, diagram)); emit(diagramRemoved(this, diagram));
delete diagram; delete diagram;
if (diagrams_.size() % 58 == 0) {
foreach (Diagram *diag, diagrams_) {
ptr = dynamic_cast<DiagramFolioList *>(diag);
if (ptr && ptr -> getId() == DiagramFolioList::folioList_quantity-1) {
diagrams_.removeAll(ptr);
emit(diagramRemoved(this, ptr));
delete ptr;
break;
}
}
}
} }
updateDiagramsFolioData(); updateDiagramsFolioData();