[qet] [2818] Folio List: New Diagram Folio list can be added if not already present. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 2818
Author: abhishekm71
Date: 2014-02-07 08:54:54 +0100 (Fri, 07 Feb 2014)
Log Message:
-----------
Folio List: New Diagram Folio list can be added if not already present.
Modified Paths:
--------------
trunk/sources/diagramfoliolist.cpp
trunk/sources/projectview.cpp
trunk/sources/projectview.h
trunk/sources/qetdiagrameditor.cpp
trunk/sources/qetdiagrameditor.h
trunk/sources/qetproject.cpp
trunk/sources/qetproject.h
Modified: trunk/sources/diagramfoliolist.cpp
===================================================================
--- trunk/sources/diagramfoliolist.cpp 2014-02-07 07:04:27 UTC (rev 2817)
+++ trunk/sources/diagramfoliolist.cpp 2014-02-07 07:54:54 UTC (rev 2818)
@@ -31,7 +31,12 @@
rowHeight = (rowHeight > height*0.05) ? height*0.05 : rowHeight;
QRectF row_RectF(x0 + width*.1, y0 + height*.05, width*0.8, rowHeight);
- fillRow(p, row_RectF, "Auteur", "Titre", "Folio", "Date");
+ QString authorTranslatable = tr("Auteur");
+ QString titleTranslatable = tr("Titre");
+ QString folioTranslatable = tr("Folio");
+ QString dateTranslatable = tr("Date");
+
+ fillRow(p, row_RectF, authorTranslatable, titleTranslatable, folioTranslatable, dateTranslatable);
foreach (Diagram *diagram, diagram_list) {
y0 += rowHeight;
QRectF row_rect(x0 + width*.1, y0 + height*.05, width*0.8, rowHeight);
Modified: trunk/sources/projectview.cpp
===================================================================
--- trunk/sources/projectview.cpp 2014-02-07 07:04:27 UTC (rev 2817)
+++ trunk/sources/projectview.cpp 2014-02-07 07:54:54 UTC (rev 2818)
@@ -306,6 +306,15 @@
showDiagram(new_diagram_view);
}
+void ProjectView::addNewDiagramFolioList() {
+ if (project_ -> isReadOnly() || project_ -> isFolioListAdded()) return;
+
+ Diagram *new_diagram = project_ -> addNewDiagramFolioList();
+ DiagramView *new_diagram_view = new DiagramView(new_diagram);
+ addDiagram(new_diagram_view);
+ showDiagram(new_diagram_view);
+}
+
/**
Ajoute un schema au ProjectView
@param diagram Schema a ajouter
Modified: trunk/sources/projectview.h
===================================================================
--- trunk/sources/projectview.h 2014-02-07 07:04:27 UTC (rev 2817)
+++ trunk/sources/projectview.h 2014-02-07 07:54:54 UTC (rev 2818)
@@ -60,6 +60,7 @@
public slots:
void addNewDiagram();
+ void addNewDiagramFolioList();
void addDiagram(DiagramView *);
void removeDiagram(DiagramView *);
void removeDiagram(Diagram *);
Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp 2014-02-07 07:04:27 UTC (rev 2817)
+++ trunk/sources/qetdiagrameditor.cpp 2014-02-07 07:54:54 UTC (rev 2818)
@@ -222,6 +222,7 @@
prj_edit_prop = new QAction(QET::Icons::DialogInformation, tr("Propri\351t\351s du projet"), this);
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un sch\351ma"), this);
+ //prj_add_diagram_foliolist = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un sch\351ma"), this);
prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer le sch\351ma"), this);
prj_clean = new QAction(QET::Icons::EditClear, tr("Nettoyer le projet"), this);
prj_diagramNum = new QAction(QET::Icons::ConductorSettings, tr("Annoter les sch\351mas"), this);
@@ -374,7 +375,7 @@
connect(prj_del_diagram, SIGNAL(triggered()), this, SLOT(removeDiagramFromProject()) );
connect(prj_clean, SIGNAL(triggered()), this, SLOT(cleanCurrentProject()) );
connect(prj_diagramNum, SIGNAL(triggered()), this, SLOT(diagramNumProject()) );
- //connect(prj_diagramList, SIGNAL(triggered()), this, SLOT(addNewDiagramFolioList()) );
+ connect(prj_diagramList, SIGNAL(triggered()), this, SLOT(addDiagramFolioListToProject()));
connect(prj_nomenclature, SIGNAL(triggered()), this, SLOT(nomenclatureProject()) );
connect(zoom_in, SIGNAL(triggered()), this, SLOT(slot_zoomIn()) );
connect(zoom_out, SIGNAL(triggered()), this, SLOT(slot_zoomOut()) );
@@ -1135,6 +1136,7 @@
save_cur_diagram -> setEnabled(editable_diagram);
prj_edit_prop -> setEnabled(opened_project);
prj_add_diagram -> setEnabled(editable_project);
+ //prj_add_diagram_foliolist -> setEnabled(editable_project);
prj_del_diagram -> setEnabled(editable_project);
prj_clean -> setEnabled(editable_project);
prj_diagramNum -> setEnabled(editable_project);
@@ -1679,6 +1681,12 @@
}
}
+void QETDiagramEditor::addDiagramFolioListToProject() {
+ if (ProjectView *current_project = currentProject()) {
+ current_project -> addNewDiagramFolioList();
+ }
+}
+
/**
Ajoute un nouveau schema a un projet
@param project Projet auquel il faut ajouter un schema
Modified: trunk/sources/qetdiagrameditor.h
===================================================================
--- trunk/sources/qetdiagrameditor.h 2014-02-07 07:04:27 UTC (rev 2817)
+++ trunk/sources/qetdiagrameditor.h 2014-02-07 07:54:54 UTC (rev 2818)
@@ -143,6 +143,7 @@
void editDiagramProperties(DiagramView *);
void editDiagramProperties(Diagram *);
void addDiagramToProject();
+ void addDiagramFolioListToProject();
void addDiagramToProject(QETProject *);
void removeDiagram(Diagram *);
void removeDiagramFromProject();
Modified: trunk/sources/qetproject.cpp
===================================================================
--- trunk/sources/qetproject.cpp 2014-02-07 07:04:27 UTC (rev 2817)
+++ trunk/sources/qetproject.cpp 2014-02-07 07:54:54 UTC (rev 2818)
@@ -46,7 +46,8 @@
project_qet_version_(-1),
modified_(false),
read_only_(false),
- titleblocks_(this)
+ titleblocks_(this),
+ folio_list_added_(false)
{
// 0 a n schema(s) vide(s)
int diagrams_count = qMax(0, diagrams);
@@ -846,6 +847,7 @@
diagram_folio_list -> border_and_titleblock.setTitle(title);
addDiagram(diagram_folio_list);
+ folio_list_added_ = true;
emit(diagramAdded(this, diagram_folio_list));
return(diagram_folio_list);
}
@@ -861,6 +863,10 @@
if (!diagram || !diagrams_.contains(diagram)) return;
if (diagrams_.removeAll(diagram)) {
+
+ DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diagram);
+ if (ptr)
+ folio_list_added_ = false;
emit(diagramRemoved(this, diagram));
delete diagram;
}
Modified: trunk/sources/qetproject.h
===================================================================
--- trunk/sources/qetproject.h 2014-02-07 07:04:27 UTC (rev 2817)
+++ trunk/sources/qetproject.h 2014-02-07 07:54:54 UTC (rev 2818)
@@ -121,6 +121,7 @@
DiagramContext projectProperties();
void setProjectProperties(const DiagramContext &);
QUndoStack* undoStack() {return undo_stack_;}
+ bool isFolioListAdded() {return folio_list_added_;}
public slots:
void componentWritten();
@@ -185,6 +186,8 @@
bool modified_;
/// Whether the project is read only
bool read_only_;
+ /// Whether folio_list has been added.
+ bool folio_list_added_;
/// Filepath for which this project is considered read only
QString read_only_file_path_;
/// Name of the category used when automatically integrating elements within the embedded collection