QElectroTech  0.70
projectview.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #include "projectview.h"
19 #include "qetproject.h"
20 #include "diagramview.h"
21 #include "diagram.h"
22 #include "diagramprintdialog.h"
23 #include "exportdialog.h"
24 #include "qetapp.h"
25 #include "qetelementeditor.h"
26 #include "borderpropertieswidget.h"
29 #include "qeticons.h"
30 #include "qetmessagebox.h"
31 #include "qettemplateeditor.h"
32 #include "diagramfoliolist.h"
34 #include "xmlelementcollection.h"
36 #include "dialogwaiting.h"
37 
43 ProjectView::ProjectView(QETProject *project, QWidget *parent) :
44  QWidget(parent),
45  m_project(nullptr)
46 {
47  initActions();
48  initWidgets();
49  initLayout();
50 
52 }
53 
59  // qDebug() << "Suppression du ProjectView" << ((void *)this);
60  foreach(int id, m_diagram_ids.keys()) {
61  DiagramView *diagram_view = m_diagram_ids.take(id);
62  delete diagram_view;
63  }
64 }
65 
70  return(m_project);
71 }
72 
79  if (!m_project) {
81  connect(m_project, SIGNAL(projectTitleChanged(QETProject *, const QString &)), this, SLOT(updateWindowTitle()));
82  connect(m_project, SIGNAL(projectModified (QETProject *, bool)), this, SLOT(updateWindowTitle()));
83  connect(m_project, SIGNAL(readOnlyChanged (QETProject *, bool)), this, SLOT(adjustReadOnlyState()));
84  connect(m_project, SIGNAL(addAutoNumDiagram()), this, SLOT(addNewDiagram()));
86  loadDiagrams();
87  }
88 }
89 
93 QList<DiagramView *> ProjectView::diagram_views() const {
94  return(m_diagram_view_list);
95 }
96 
102  int current_tab_index = m_tab -> currentIndex();
103  if (current_tab_index == -1)
104  return nullptr;
105  return(m_diagram_ids[current_tab_index]);
106 }
107 
112 void ProjectView::closeEvent(QCloseEvent *qce) {
113  bool can_close_project = tryClosing();
114  if (can_close_project) {
115  qce -> accept();
116  emit(projectClosed(this));
117  } else {
118  qce -> ignore();
119  }
120 }
121 
126  DiagramView *nextDiagramView = this->nextDiagram();
127  if (nextDiagramView!=nullptr){
129  m_tab -> setCurrentWidget(nextDiagramView);
130  }
131 }
132 
137  int current_tab_index = m_tab -> currentIndex();
138  int next_tab_index = current_tab_index + 1; //get next tab index
139  if (next_tab_index<m_diagram_ids.count()) //if next tab index >= greatest tab the last tab is activated so no need to change tab.
140  return(m_diagram_ids[next_tab_index]);
141  else
142  return nullptr;
143 }
144 
149  DiagramView *previousDiagramView = this->previousDiagram();
150  if (previousDiagramView!=nullptr){
152  m_tab -> setCurrentWidget(previousDiagramView);
153  }
154 }
155 
160  int current_tab_index = m_tab -> currentIndex();
161  int previous_tab_index = current_tab_index - 1; //get previous tab index
162  if (previous_tab_index>=0) //if previous tab index = 0 then the first tab is activated so no need to change tab.
163  return(m_diagram_ids[previous_tab_index]);
164  else
165  return nullptr;
166 }
167 
172  DiagramView *lastDiagramView = this->lastDiagram();
173  m_tab->setCurrentWidget(lastDiagramView);
174 }
175 
180  return(m_diagram_ids.last());
181 }
182 
187  DiagramView *firstDiagramView = this->firstDiagram();
188  m_tab->setCurrentWidget(firstDiagramView);
189 }
190 
195  return(m_diagram_ids.first());
196 }
197 
198 
208  if (!m_project) return(true);
209 
210  // First step: require external editors closing -- users may either cancel
211  // the whole closing process or save (and therefore add) content into this
212  // project. Of course, they may also discard them.
213  if (!tryClosingElementEditors()) {
214  return(false);
215  }
216 
217  // Check how different the current situation is from a brand new, untouched project
218  if (m_project -> filePath().isEmpty() && !m_project -> projectWasModified()) {
219  return(true);
220  }
221 
222  // Second step: users are presented with a dialog that enables them to
223  // choose whether they want to:
224  // - cancel the closing process,
225  // - discard all modifications,
226  // - or specify what is to be saved, i.e. they choose whether they wants to
227  // save/give up/remove diagrams considered as modified.
228  int user_input = tryClosingDiagrams();
229  if (user_input == QMessageBox::Cancel) {
230  return(false); // the closing process was cancelled
231  } else if (user_input == QMessageBox::Discard) {
232  return(true); // all modifications were discarded
233  }
234 
235  // Check how different the current situation is from a brand new, untouched project (yes , again)
236  if (m_project -> filePath().isEmpty() && !m_project -> projectWasModified()) {
237  return(true);
238  }
239 
240  if (m_project -> filePath().isEmpty()) {
241  QString filepath = askUserForFilePath();
242  if (filepath.isEmpty()) return(false); // users may cancel the closing
243  }
244  QETResult result = m_project -> write();
246  if (!result.isOk()) emit(errorEncountered(result.errorMessage()));
247  return(result.isOk());
248 }
249 
257  if (!m_project) return(true);
258  /*
259  La QETApp permet d'acceder rapidement aux editeurs d'element
260  editant un element du projet.
261  */
262  QList<QETElementEditor *> editors = QETApp::elementEditors(m_project);
263  foreach(QETElementEditor *editor, editors) {
264  if (!editor -> close()) return(false);
265  }
266 
267  QList<QETTitleBlockTemplateEditor *> template_editors = QETApp::titleBlockTemplateEditors(m_project);
268  foreach(QETTitleBlockTemplateEditor *template_editor, template_editors) {
269  if (!template_editor -> close()) return(false);
270  }
271  return(true);
272 }
273 
281  if (!m_project) return(QMessageBox::Discard);
282 
283  if (!project()->projectOptionsWereModified() &&
284  project()->undoStack()->isClean() &&
285  !project()->filePath().isEmpty()) {
286  // nothing was modified, and we have a filepath, i.e. everything was already
287  // saved, i.e we can close the project right now
288  return(QMessageBox::Discard);
289  }
290 
291  QString title = project()->title();
292  if (title.isEmpty()) title = "QElectroTech ";
293 
294  int close_dialog = QMessageBox::question(this, title,
295  tr("Le projet à été modifié.\n"
296  "Voulez-vous enregistrer les modifications ?"),
297  QMessageBox::Save | QMessageBox::Discard
299  QMessageBox::Save);
300 
301  return(close_dialog);
302 }
303 
311 QString ProjectView::askUserForFilePath(bool assign) {
312  // ask the user for a filepath in order to save the project
313  QString filepath = QFileDialog::getSaveFileName(
314  this,
315  tr("Enregistrer sous", "dialog title"),
316  m_project -> currentDir(),
317  tr("Projet QElectroTech (*.qet)", "filetypes allowed when saving a project file")
318  );
319 
320  // if no filepath is provided, return an empty string
321  if (filepath.isEmpty()) return(filepath);
322 
323  // if the name does not end with the .qet extension, append it
324  if (!filepath.endsWith(".qet", Qt::CaseInsensitive)) filepath += ".qet";
325 
326  if (assign) {
327  // assign the provided filepath to the currently edited project
328  m_project -> setFilePath(filepath);
329  }
330 
331  return(filepath);
332 }
333 
339  QETResult no_project(tr("aucun projet affiché", "error message"), false);
340  return(no_project);
341 }
342 
348  if (m_project -> isReadOnly()) return;
349 
350  Diagram *new_diagram = m_project -> addNewDiagram();
351  DiagramView *new_diagram_view = new DiagramView(new_diagram);
352  addDiagram(new_diagram_view);
353 
354  if (m_project -> diagrams().size() % 58 == 1 && m_project -> getFolioSheetsQuantity() != 0)
356  showDiagram(new_diagram_view);
357 }
358 
364  if (m_project -> isReadOnly()) return;
365  int i = 1; //< Each new diagram is added to the end of the project.
366  //< We use @i to move the folio list at second position in the project
367  foreach (Diagram *d, m_project -> addNewDiagramFolioList()) {
368  DiagramView *new_diagram_view = new DiagramView(d);
369  addDiagram(new_diagram_view);
370  showDiagram(new_diagram_view);
371  m_tab->tabBar()->moveTab(diagram_views().size()-1, i);
372  i++;
373  }
374 }
375 
382 {
383  if (!diagram_view)
384  return;
385 
386  //Check if diagram isn't present in the project
387  if (m_diagram_ids.values().contains(diagram_view))
388  return;
389 
390  // Add new tab for the diagram
391  m_tab->addTab(diagram_view, QET::Icons::Diagram, diagram_view -> title());
392  diagram_view->setFrameStyle(QFrame::Plain | QFrame::NoFrame);
393 
394  m_diagram_view_list << diagram_view;
395 
398 
399  connect(diagram_view, SIGNAL(showDiagram(Diagram*)), this, SLOT(showDiagram(Diagram*)));
400  connect(diagram_view, SIGNAL(titleChanged(DiagramView *, const QString &)), this, SLOT(updateTabTitle(DiagramView *)));
401  connect(diagram_view, SIGNAL(findElementRequired(const ElementsLocation &)), this, SIGNAL(findElementRequired(const ElementsLocation &)));
402  connect(diagram_view, SIGNAL(editElementRequired(const ElementsLocation &)), this, SIGNAL(editElementRequired(const ElementsLocation &)));
403  connect(&diagram_view->diagram()->border_and_titleblock , &BorderTitleBlock::titleBlockFolioChanged, [this, diagram_view]() {this->updateTabTitle(diagram_view);});
404 
405  // signal diagram view was added
406  emit(diagramAdded(diagram_view));
407  m_project -> setModified(true);
408 }
409 
416 {
417  if (!diagram_view)
418  return;
419  if (m_project -> isReadOnly())
420  return;
421  if (!m_diagram_ids.values().contains(diagram_view))
422  return;
423 
424 
425  //Ask confirmation to user.
426  int answer = QET::QetMessageBox::question(
427  this,
428  tr("Supprimer le folio ?", "message box title"),
429  tr("Êtes-vous sûr de vouloir supprimer ce folio du projet ? Ce changement est irréversible.", "message box content"),
430  QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
431  QMessageBox::No
432  );
433  if (answer != QMessageBox::Yes) {
434  return;
435  }
436 
437  //Remove the diagram view of the tabs widget
438  int index_to_remove = m_diagram_ids.key(diagram_view);
439  m_tab->removeTab(index_to_remove);
440  m_diagram_view_list.removeAll(diagram_view);
442 
443  m_project -> removeDiagram(diagram_view -> diagram());
444  delete diagram_view;
445 
446  emit(diagramRemoved(diagram_view));
447 
448  //Make definitve the withdrawal
449  m_project -> write();
451  m_project -> setModified(true);
452 
453 }
454 
460  if (!diagram) return;
461 
462  if (DiagramView *diagram_view = findDiagram(diagram)) {
463  removeDiagram(diagram_view);
464  }
465 }
466 
472  if (!diagram) return;
473  m_tab -> setCurrentWidget(diagram);
474 }
475 
481  if (!diagram) return;
482  if (DiagramView *diagram_view = findDiagram(diagram)) {
483  m_tab -> setCurrentWidget(diagram_view);
484  }
485 }
486 
492  if (!m_project) return;
493  ProjectPropertiesDialog dialog(m_project, parentWidget());
494  dialog.exec();
495 }
496 
502 }
503 
508  if (!diagram_view) return;
509  showDiagram(diagram_view);
510  diagram_view -> editDiagramProperties();
511 }
512 
518 }
519 
524  if (!diagram_view) return;
525 
526  int diagram_view_position = m_diagram_ids.key(diagram_view);
527  if (!diagram_view_position) {
528  // le schema est le premier du projet
529  return;
530  }
531  m_tab -> tabBar() -> moveTab(diagram_view_position, diagram_view_position - 1);
532 }
533 
538  moveDiagramUp(findDiagram(diagram));
539 }
540 
545  if (!diagram_view) return;
546 
547  int diagram_view_position = m_diagram_ids.key(diagram_view);
548  if (diagram_view_position + 1 == m_diagram_ids.count()) {
549  // le schema est le dernier du projet
550  return;
551  }
552  m_tab -> tabBar() -> moveTab(diagram_view_position, diagram_view_position + 1);
553 }
554 
559  moveDiagramDown(findDiagram(diagram));
560 }
561 
562 /*
563  * Deplace le schema diagram_view vers le haut / la gauche en position 0
564  */
566 {
567  if (!diagram_view) return;
568 
569  int diagram_view_position = m_diagram_ids.key(diagram_view);
570  if (!diagram_view_position) {
571  // le schema est le premier du projet
572  return;
573  }
574  m_tab -> tabBar() -> moveTab(diagram_view_position, (diagram_views().size(), 0));
575 }
576 
577 /*
578  * Deplace le schema diagram vers le haut / la gauche en position 0
579  */
581 {
582  moveDiagramUpTop(findDiagram(diagram));
583 }
584 
589  if (!diagram_view) return;
590 
591  int diagram_view_position = m_diagram_ids.key(diagram_view);
592  if (!diagram_view_position) {
593  // le schema est le premier du projet
594  return;
595  }
596  m_tab -> tabBar() -> moveTab(diagram_view_position, diagram_view_position - 10);
597 }
598 
603  moveDiagramUpx10(findDiagram(diagram));
604 }
605 
610  if (!diagram_view) return;
611 
612  int diagram_view_position = m_diagram_ids.key(diagram_view);
613  if (diagram_view_position + 1 == m_diagram_ids.count()) {
614  // le schema est le dernier du projet
615  return;
616  }
617  m_tab -> tabBar() -> moveTab(diagram_view_position, diagram_view_position + 10);
618 }
619 
625 }
626 
632  if (!m_project) return;
633 
634  // transforme le titre du projet en nom utilisable pour le document
635  QString doc_name;
636  if (!(m_project -> title().isEmpty())) {
637  doc_name = m_project -> title();
638  } else if (!m_project -> filePath().isEmpty()) {
639  doc_name = QFileInfo(m_project -> filePath()).baseName();
640  }
641  doc_name = QET::stringToFileName(doc_name);
642  if (doc_name.isEmpty()) {
643  doc_name = tr("projet", "string used to generate a filename");
644  }
645 
646  // recupere le dossier contenant le fichier courant
647  QString dir_path = m_project -> currentDir();
648 
649  // determine un chemin pour le pdf / ps
650  QString file_name = QDir::toNativeSeparators(QDir::cleanPath(dir_path + "/" + doc_name));
651 
652  DiagramPrintDialog print_dialog(m_project, this);
653  print_dialog.setDocName(doc_name);
654  print_dialog.setFileName(file_name);
655  print_dialog.exec();
656 }
657 
662  if (!m_project) return;
663 
664  ExportDialog ed(m_project, parentWidget());
665 #ifdef Q_OS_MAC
666  ed.setWindowFlags(Qt::Sheet);
667 #endif
668  ed.exec();
669 }
670 
678  return(doSave());
679 }
680 
689 {
690  if (!m_project) return(noProjectResult());
691 
692  QString filepath = askUserForFilePath();
693  if (filepath.isEmpty()) return(QETResult());
694  return(doSave());
695 }
696 
704 {
705  if (!m_project) return(noProjectResult());
706 
707  if (m_project -> filePath().isEmpty()) {
708  // The project has not been saved to a file yet,
709  // so save() actually means saveAs().
710  return(saveAs());
711  }
712 
713  // write to file
714  QETResult result = m_project -> write();
716  project()->undoStack()->clear();
717  return(result);
718 }
719 
729  if (!m_project) return(0);
730 
731  // s'assure que le schema n'est pas en lecture seule
732  if (m_project -> isReadOnly()) {
734  this,
735  tr("Projet en lecture seule", "message box title"),
736  tr("Ce projet est en lecture seule. Il n'est donc pas possible de le nettoyer.", "message box content")
737  );
738  return(0);
739  }
740 
741  // construit un petit dialogue pour parametrer le nettoyage
742  QCheckBox *clean_tbt = new QCheckBox(tr("Supprimer les modèles de cartouche inutilisés dans le projet"));
743  QCheckBox *clean_elements = new QCheckBox(tr("Supprimer les éléments inutilisés dans le projet"));
744  QCheckBox *clean_categories = new QCheckBox(tr("Supprimer les catégories vides"));
745  QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
746 
747  clean_tbt -> setChecked(true);
748  clean_elements -> setChecked(true);
749  clean_categories -> setChecked(true);
750 
751  QDialog clean_dialog(parentWidget());
752 #ifdef Q_OS_MAC
753  clean_dialog.setWindowFlags(Qt::Sheet);
754 #endif
755 
756  clean_dialog.setWindowTitle(tr("Nettoyer le projet", "window title"));
757  QVBoxLayout *clean_dialog_layout = new QVBoxLayout();
758  clean_dialog_layout -> addWidget(clean_tbt);
759  clean_dialog_layout -> addWidget(clean_elements);
760  clean_dialog_layout -> addWidget(clean_categories);
761  clean_dialog_layout -> addWidget(buttons);
762  clean_dialog.setLayout(clean_dialog_layout);
763 
764  connect(buttons, SIGNAL(accepted()), &clean_dialog, SLOT(accept()));
765  connect(buttons, SIGNAL(rejected()), &clean_dialog, SLOT(reject()));
766 
767  int clean_count = 0;
768  if (clean_dialog.exec() == QDialog::Accepted)
769  {
770  if (clean_tbt -> isChecked()) {
772  }
773  if (clean_elements->isChecked()) {
775  }
776  if (clean_categories->isChecked()) {
778  }
779  }
780 
781  m_project -> setModified(true);
782  return(clean_count);
783 }
784 
789  add_new_diagram_ = new QAction(QET::Icons::AddFolio, tr("Ajouter un folio"), this);
790  connect(add_new_diagram_, SIGNAL(triggered()), this, SLOT(addNewDiagram()));
791 }
792 
797  setObjectName("ProjectView");
798  setWindowIcon(QET::Icons::ProjectFileGP);
799 
800  // initialize the "fallback" widget
801  fallback_widget_ = new QWidget();
802  fallback_label_ = new QLabel(
803  tr(
804  "Ce projet ne contient aucun folio",
805  "label displayed when a project contains no diagram"
806  )
807  );
808  fallback_label_ -> setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
809 
810  // initialize tabs
811  m_tab = new QTabWidget(this);
812  m_tab -> setMovable(true);
813 
814  QToolButton *add_new_diagram_button = new QToolButton;
815  add_new_diagram_button -> setDefaultAction(add_new_diagram_);
816  add_new_diagram_button -> setAutoRaise(true);
817  m_tab -> setCornerWidget(add_new_diagram_button, Qt::TopRightCorner);
818 
819  connect(m_tab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
820  connect(m_tab, SIGNAL(tabBarDoubleClicked(int)), this, SLOT(tabDoubleClicked(int)));
821  connect(m_tab->tabBar(), SIGNAL(tabMoved(int, int)), this, SLOT(tabMoved(int, int)));
822 
823  fallback_widget_ -> setVisible(false);
824  m_tab -> setVisible(false);
825 }
826 
831  QVBoxLayout *fallback_widget_layout_ = new QVBoxLayout(fallback_widget_);
832  fallback_widget_layout_ -> addWidget(fallback_label_);
833 
834  layout_ = new QVBoxLayout(this);
835 #ifdef Q_OS_MAC
836  layout_ -> setContentsMargins(0, 8, 0, 0);
837 #else
838  layout_ -> setContentsMargins(0, 0, 0, 0);
839 #endif
840  layout_ -> setSpacing(0);
841  layout_ -> addWidget(fallback_widget_);
842  layout_ -> addWidget(m_tab);
843 }
844 
845 
853 {
854  if (!m_project) return;
855 
856  setDisplayFallbackWidget(m_project -> diagrams().isEmpty());
857 
858  DialogWaiting *dialog = nullptr;
860  {
861  dialog = DialogWaiting::instance();
862  dialog->setTitle( tr("<p align=\"center\">"
863  "<b>Ouverture du projet en cours...</b><br/>"
864  "Création des onglets de folio :"
865  "</p>"));
866  }
867  for(Diagram *diagram : m_project->diagrams())
868  {
869  if(dialog)
870  {
871  dialog->setDetail(diagram->title());
872  dialog->setProgressBar(dialog->progressBarValue()+1);
873  }
874 
875  DiagramView *sv = new DiagramView(diagram);
876  addDiagram(sv);
877  }
878 
880  this->currentDiagram()->diagram()->loadCndFolioSeq();
881 
882  // If project have the folios list, move it at the beginning of the project
883  if (m_project -> getFolioSheetsQuantity()) {
884  for (int i = 0; i < m_project->getFolioSheetsQuantity(); i++)
885  m_tab -> tabBar() -> moveTab(diagram_views().size()-1, + 1);
886  m_project->setModified(false);
887  }
888 }
889 
895  QString title;
896  if (m_project) {
897  title = m_project -> pathNameTitle();
898  } else {
899  title = tr("Projet", "window title for a project-less ProjectView");
900  }
901  setWindowTitle(title);
902 }
903 
909  bool editable = !(m_project -> isReadOnly());
910 
911  // prevent users from moving existing diagrams
912  m_tab -> setMovable(editable);
913  // prevent users from adding new diagrams
914  add_new_diagram_ -> setEnabled(editable);
915 
916  // on met a jour le titre du widget, qui reflete l'etat de lecture seule
918 }
919 
926 {
927  int diagram_tab_id = m_diagram_ids.key(diagram_view, -1);
928 
929  if (diagram_tab_id != -1)
930  {
931  QSettings settings;
932  QString title;
933  Diagram *diagram = diagram_view->diagram();
934 
935  if (settings.value("genericpanel/folio", false).toBool())
936  {
937  QString formula = diagram->border_and_titleblock.folio();
939  title = autonum::AssignVariables::formulaToLabel(formula, seq, diagram);
940  }
941  else
942  title = QString::number(diagram->folioIndex() + 1);
943 
944  title += " - ";
945  title += diagram->title();
946  m_tab->setTabText(diagram_tab_id ,title);
947  }
948 }
949 
955 {
956  for (DiagramView *dv : m_diagram_ids.values())
957  updateTabTitle(dv);
958 }
959 
964 void ProjectView::tabMoved(int from, int to)
965 {
966  if (!m_project)
967  return;
968 
969  m_project->diagramOrderChanged(from, to);
971 
972  //Rebuild the title of each diagram in range from - to
973  for (int i= qMin(from,to) ; i< qMax(from,to)+1 ; ++i)
974  {
975  DiagramView *dv = m_diagram_ids.value(i);
976  updateTabTitle(dv);
977  }
978 }
979 
986  foreach(DiagramView *diagram_view, diagram_views()) {
987  if (diagram_view -> diagram() == diagram) {
988  return(diagram_view);
989  }
990  }
991  return(nullptr);
992 }
993 
998  // vide la map
999  m_diagram_ids.clear();
1000 
1001  foreach(DiagramView *diagram_view, m_diagram_view_list) {
1002  int dv_idx = m_tab -> indexOf(diagram_view);
1003  if (dv_idx == -1) continue;
1004  m_diagram_ids.insert(dv_idx, diagram_view);
1005  }
1006 }
1007 
1015 void ProjectView::tabChanged(int tab_id)
1016 {
1017  if (tab_id == -1)
1019  else if(m_tab->count() == 1)
1020  setDisplayFallbackWidget(false);
1021 
1022  emit(diagramActivated(m_diagram_ids[tab_id]));
1023 
1024  if (m_diagram_ids[tab_id] != nullptr)
1025  m_diagram_ids[tab_id]->diagram()->diagramActivated();
1026 
1027  //Clear the event interface of the previous diagram
1029  dv->diagram()->clearEventInterface();
1030  m_previous_tab_index = tab_id;
1031 }
1032 
1038  // repere le schema concerne
1039  DiagramView *diagram_view = m_diagram_ids[tab_id];
1040  if (!diagram_view) return;
1041 
1042  diagram_view -> editDiagramProperties();
1043 }
1044 
1052  fallback_widget_ -> setVisible(fallback);
1053  m_tab -> setVisible(!fallback);
1054 }
QETResult doSave()
void changeFirstTab()
change current diagramview to first tab
void setProgressBar(int val)
DialogWaiting::setProgressBar.
void setTitle(const QString &val)
DialogWaiting::setTitle of action.
void diagramRemoved(DiagramView *)
QString title() const
Definition: qetproject.cpp:365
void editProjectProperties()
The ProjectPropertiesDialog class this class builds a dialog to edit whole properties of a project...
void setModified(bool)
QList< Diagram * > diagrams() const
Definition: qetproject.cpp:210
void updateAllTabsTitle()
ProjectView::updateAllTabsTitle Update all tabs title.
static QString formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt=nullptr)
AssignVariables::formulaToLabel Return the with variable assigned (ready to be displayed) ...
void projectClosed(ProjectView *)
void changeTabDown()
change current diagramview to next folio
void rebuildDiagramsMap()
QList< DiagramView * > m_diagram_view_list
Definition: projectview.h:137
void setDetail(const QString &val)
DialogWaiting::setDetail of action.
QString errorMessage() const
Definition: qetresult.cpp:61
QETResult saveAs()
Diagram * diagram()
Definition: diagramview.h:67
QETResult noProjectResult() const
void updateTabTitle(DiagramView *)
ProjectView::updateTabTitle Update the title of the tab which display the diagram view ...
void updateWindowTitle()
ProjectView::updateWindowTitle Update the project view title.
int folioIndex() const
Definition: diagram.cpp:1738
QUndoStack * undoStack()
Definition: qetproject.h:164
QETProject * m_project
Definition: projectview.h:130
void addNewDiagram()
ProjectView::addNewDiagram Add new diagram to project view.
void initActions()
void closeEvent(QCloseEvent *) override
void tabDoubleClicked(int)
static bool hasInstance()
Definition: dialogwaiting.h:46
void cleanUnusedDirectory()
XmlElementCollection::cleanUnusedDirectory Remove the empty directories of this collection.
void changeTabUp()
change current diagramview to previous tab
void initLayout()
void diagramActivated(DiagramView *)
void titleBlockFolioChanged(const QString &)
titleBlockFolioChanged Signal emitted after Folio has changed
int getFolioSheetsQuantity() const
Definition: qetproject.cpp:195
DiagramView * firstDiagram()
XmlElementCollection * embeddedElementCollection() const
QETProject::embeddedCollection.
Definition: qetproject.cpp:229
void addNewDiagramFolioList()
ProjectView::addNewDiagramFolioList Add new diagram folio list to project.
void addDiagram(DiagramView *)
ProjectView::addDiagram Add diagram view to this project view.
int tryClosingDiagrams()
ProjectView::tryClosingDiagrams try to close this project, if diagram or project option are changed a...
void diagramOrderChanged(int, int)
void errorEncountered(const QString &)
QString askUserForFilePath(bool=true)
DiagramView * previousDiagram()
QString title() const
Definition: diagram.cpp:1473
void exec()
ProjectPropertiesDialog::exec execute this dialog.
void setDisplayFallbackWidget(bool)
void exportProject()
void findElementRequired(const ElementsLocation &)
static QList< QETTitleBlockTemplateEditor * > titleBlockTemplateEditors()
Definition: qetapp.cpp:1039
void moveDiagramUpTop(DiagramView *)
void setProject(QETProject *)
Definition: projectview.cpp:78
void adjustReadOnlyState()
DiagramView * nextDiagram()
static QList< QETElementEditor * > elementEditors()
Definition: qetapp.cpp:1032
void moveDiagramUpx10(DiagramView *)
void changeLastTab()
change current diagramview to last tab
QETResult save()
QIcon tr
Definition: qeticons.cpp:204
QWidget * fallback_widget_
Definition: projectview.h:132
DiagramView * currentDiagram() const
ProjectView::currentDiagram.
void cleanUnusedElement()
XmlElementCollection::cleanUnusedElement Remove elements in this collection which is not used in the ...
QString folio() const
int progressBarValue() const
DialogWaiting::progressBarValue.
int cleanProject()
static DialogWaiting * instance(QWidget *parent=nullptr)
Definition: dialogwaiting.h:33
QIcon ProjectFileGP
Definition: qeticons.cpp:148
QETProject * project()
Definition: projectview.cpp:69
~ProjectView() override
Definition: projectview.cpp:58
QString stringToFileName(const QString &)
Definition: qet.cpp:379
void showDiagram(DiagramView *)
void loadDiagrams()
ProjectView::loadDiagrams Load diagrams of project. We create a diagram view for each diagram...
void initWidgets()
void removeDiagram(DiagramView *)
ProjectView::removeDiagram Remove a diagram (folio) of the project.
QList< DiagramView * > diagram_views() const
Definition: projectview.cpp:93
bool tryClosing()
QVBoxLayout * layout_
Definition: projectview.h:131
void printProject()
QTabWidget * m_tab
Definition: projectview.h:134
bool tryClosingElementEditors()
DiagramView * findDiagram(Diagram *)
void editCurrentDiagramProperties()
bool isOk() const
Definition: qetresult.cpp:47
QIcon Cancel
Definition: qeticons.cpp:34
void editDiagramProperties(DiagramView *)
QMessageBox::StandardButton question(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
QIcon AddFolio
Definition: qeticons.cpp:25
ProjectView(QETProject *, QWidget *=nullptr)
Definition: projectview.cpp:43
void moveDiagramUp(DiagramView *)
void loadCndFolioSeq()
Diagram::loadCndFolioSeq This class loads all conductor folio sequential variables related to the cur...
Definition: diagram.cpp:1415
QLabel * fallback_label_
Definition: projectview.h:133
QMap< int, DiagramView * > m_diagram_ids
Definition: projectview.h:135
void loadElmtFolioSeq()
Diagram::loadElmtFolioSeq This class loads all folio sequential variables related to the current auto...
Definition: diagram.cpp:1357
BorderTitleBlock border_and_titleblock
Diagram dimensions and title block.
Definition: diagram.h:74
TitleBlockTemplatesProjectCollection * embeddedTitleBlockTemplatesCollection()
Definition: qetproject.cpp:236
QMessageBox::StandardButton critical(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
void editElementRequired(const ElementsLocation &)
DiagramView * lastDiagram()
void tabMoved(int, int)
QAction * add_new_diagram_
Definition: projectview.h:129
QIcon Diagram
Definition: qeticons.cpp:43
void setFileName(const QString &)
void setDocName(const QString &)
void moveDiagramDownx10(DiagramView *)
void diagramAdded(DiagramView *)
void tabChanged(int)
ProjectView::tabChanged Manage the tab change. If tab_id == -1 (there is no diagram opened)...
int m_previous_tab_index
Definition: projectview.h:136
void moveDiagramDown(DiagramView *)