Folio List: New Diagram Folio list can be added if not already present.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2818 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
abhishekm71
2014-02-07 07:54:54 +00:00
parent 8bf916ca03
commit 52aeedfc0d
7 changed files with 36 additions and 3 deletions

View File

@@ -31,7 +31,12 @@ void DiagramFolioList::drawBackground(QPainter *p, const QRectF &r)
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);

View File

@@ -306,6 +306,15 @@ void ProjectView::addNewDiagram() {
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

View File

@@ -60,6 +60,7 @@ class ProjectView : public QWidget {
public slots:
void addNewDiagram();
void addNewDiagramFolioList();
void addDiagram(DiagramView *);
void removeDiagram(DiagramView *);
void removeDiagram(Diagram *);

View File

@@ -222,6 +222,7 @@ void QETDiagramEditor::actions() {
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 @@ void QETDiagramEditor::actions() {
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 @@ void QETDiagramEditor::slot_updateActions() {
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::addDiagramToProject() {
}
}
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

View File

@@ -143,6 +143,7 @@ class QETDiagramEditor : public QETMainWindow {
void editDiagramProperties(DiagramView *);
void editDiagramProperties(Diagram *);
void addDiagramToProject();
void addDiagramFolioListToProject();
void addDiagramToProject(QETProject *);
void removeDiagram(Diagram *);
void removeDiagramFromProject();

View File

@@ -46,7 +46,8 @@ QETProject::QETProject(int diagrams, QObject *parent) :
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 *QETProject::addNewDiagramFolioList() {
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 @@ void QETProject::removeDiagram(Diagram *diagram) {
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;
}

View File

@@ -121,6 +121,7 @@ class QETProject : public QObject {
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 @@ class QETProject : public QObject {
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